Cropping texture atlases

So, I’ve been trying to crop a texture atlas (this one have 2x2 textures within the same 2D sheet and I want to be able to choose which one to use).
The way I got it to work in UDK doesn’t seem to work so I’m trying to figure out how to do it in UE4.
I found a texture cropping function that I figured would work but I can’t figure it out. Any ideas?

Thanks in advance!

Lets go over this one again in order to clarify, So you have a 2x2 sheet, You would like to choose 1 out of the 4 images in it randomly or manually correct?

Do you know how texture co ords work and how to use them with other things, how to offset them etc?

tex2dgrad and samplegrad don’t currently work in UE4, so you’re a bit stuck when it comes to effectively using atlases.

I put in a request about six weeks ago, so hopefully it won’t take too long to appear.

Yes, I have 4 textures(in this case normal maps) (2x2) to save on texture sheets for my landscape material.
I want to be able to choose which one to use.

You won’t be able to do it; without the aforementioned shader functions, you will get artifacts and sampling errors due to the way mip maps are handled.

So does this mean something like speedtree is currently not going to work?

That’s different. Cropping parts of a texture can be easily done by using the frac node - making these sub-textures to tile seamlessly is not that easy. So something like a speedtree billboard atlas would work just fine.

^ that. I don’t suppose you have any genius suggestions in the mean time, mAlkAv!An? We couldn’t come up with anything.

In fact I did build a UDK material recently which handles manual mipmap selection by using ddx/ddy of the texcoords and tex2Dlod. You could use this in a pretty similar way to tex2Dgrad and specify different coordinates for the texture mapping and MIP selection. It’s rather expensive and needs some polishing but the basic functionality should be there.

Have a look at these for some code example: