I’m currently investigating a side project and was wondering if UE4 has support for Texture Arrays or 3D Textures (The names can be interchangeable) for the purpose of painting procedural geometry such as terrain. Traditionally Texture Atlas’s are used but are a bit aged and has a number of limitations (Mipmapping, size & number of textures, etc).
To keep the draw calls down I’d love to be able to supply my terrain patch geometry with a material that contains 10-100 (There shouldn’t really be a limit apart from memory considerations) textures packed in a texture array.
I’ve found FTexture2DArrayResource in the UE4 documentation but it provides no real implementation information.
unfortunately I don’t know the answer, but I’m also quiet interested if UE4 supports 3DTextures (not for Terrain - more some visualization stuff) or any other kind of technique to display voxel/volume data.
It would be great to get any information on that.
So…i think my answer does not quiet help since i dont know how to take advantage of it BUT i do know that arrays are supportet. For example the reflection capture actors use it…but due to dx11 specifications the number seems to be limited to 341 cubemaps per Array. Maybe looking into the code of them gets you further
Why do you specifically want to use a 3D Texture? It seems like that’s not ideal for terrains which aren’t likely to change shape dynamically (eg, dynamically carving out a solid like wood is more suited for 3d textures).
Typically what you do is create a shader with several textures then blend/mask between them at different elevations and slopes. I do this in conjunction with landscape painting layers and it comes out real nice, I even have a nice, patchy transition between grass and rock. If that might be useful for you, you can get a copy of the terrain shader here: A different kind of cel shader - Work in Progress - Unreal Engine Forums
A 3D texture or texture array has nothing to do with the object it is being used with. A 3D texture allows one to upload an array of textures in a single call and also reference the texture as an array in a shader. This allows one to paint on a terrain with “unlimited” (Its large enough) combinations of textures in a single draw call.
We’ve used Substance in Unity previously. Unfortunately it doesn’t perform very well under certain scenarios. It is a solution, but just not the one we’re after here. Thanks though.
As you have been able to see, UE4 does have support for 3d textures and such, but does not provide any method to apply it to terrain, or the material editor. So you would need to either code that functionality in yourself. Or write your own shader (or modify the existing landscape shader) providing the FTexture2DArrayResource as an input to that shader which then you could potentially apply to your landscape.
I have not had experience with that particular resource, but its similar to the other resource structures that I have used in custom shaders. I can probably chuck together a quick example of using it in a custom shader, and you could adapt that to your needs hopefully.
I will upload the code I have to my over the weekend once I find it, I implemented Texture Array assets and material editor usage a while ago, but haven’t used it for anything yet.
the other advantage with 3D textures is that you can replace the Noise function which is firsts - not supported on several platforms and second - much cheaper to calculate than that function.
Galaxy man can you if you are not uploading to git hub can you at least post an image of the material and how you put it together? I need a material that displays and over under 3D texture please…