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?
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?
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.
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.
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.