Download

FTexture3DRHIRef to Volume Texture ?

Hello dear Unreal Developers,

I have been using this plugin from Temaran ( GitHub - Temaran/UE4ShaderPluginDemo: A tutorial project that shows how to implement HLSL Pixel and Compute shaders in UE4 ) to compute a Texture3D that i would like to use in the material editor, as a Volume Texture input for a Custom node (texture object input).

As this is rather new to me, i might have overlooked or missed some details but at first glance the only way i can think of is generating a tiled 2D texture from the 3D texture and using the ‘optional’ 2D Texture input form the volume texture.
Find it a bit silly to do 3D -> 2D -> 3D, there must be a proper way of doing it ?

Thanks!

Answering to myself: as expected this is really simple !

The engine “volume texture” can be seen as a wrapper around the lower-level/HLSL understanding of “Texture3D”: creating an engine volume texture will create among other things, a Texture3D associated.
It can be highlighted with a simple task: drop a volume texture into a material editor, connect it to a Custom Node and check the generated HLSL code of the material. Your volume texture input has been translated straight into a texture3D input.

What i ended up doing is creating volume texture and using its corresponding Texture3D in my computation. Nice and easy !

You can check the engine code “…/Engine/Private/VolumeTexture.cpp” for further details.

Best,
Max