Tuesday, March 13, 2018

What are 3D textures?


Google has failed me, I could not find anything informative. So perhaps GameDev can :).



  • What are 3D textures?

  • When are they used?

  • Performance costs?

  • How are they stored?


I have many vague ideas, but no 'definitive' definition.



Any references to examples or tutorials is appreciated, especially in rendering particle systems via 3D textures.



Answer



3D texture works like regular texture. But it is truly 3D. 2D textures has UV coords, 3D has UVW (you had to use them propably). Texture coords are unit cube (0 - 1, 0 - 1, 0 - 1).


Possible usage:



  • volumetric effects in games (fire, smoke, light rays, realistic fog)

  • caching light for realtime global illumination (CryEngine for example)

  • scientific (MRI, CT scans are saved into volumes)


Performance:

Same as regular texture - super fast (fastest memory access in gpu). Cached for threads and optimized for the situation when near threads (pixel shaders) are looking for near values.


Can be read as point or used linear sampling (native tri-linear interpolation. Eq bi-linear interpolation in 2D texture).


They are stored in memory like a array of 2D textures.


Mipmapping on 3D texture:
enter image description here


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...