Texture 3D Sub Image updating

I’ve been exploring and testing the capabilities of a 3D Texture engine, focusing particularly on the ability to add sub-images—a feature not yet supported by the engine. The primary advantage of using 3D Textures is the simplification it brings to dynamically assigning different textures to meshes. Without this support, the process tends to be more cumbersome and less efficient.

In scenarios lacking 3D Texture support, assigning different textures to various meshes typically requires creating multiple meshes, each with its own material. This approach is resource-intensive and complex, especially when managing a large number of meshes, due to the need for creating and managing many individual elements.

However, with a 3D Texture engine, this process becomes much more streamlined. Instead of multiple meshes and materials, a single mesh with the 3D Texture can be used. The 3D Texture acts as a container for multiple texture layers, allowing different textures to be assigned to different parts of the mesh, or to different instances of the same mesh, without the need for multiple mesh-material combinations.

This method is currently being explored and tested. The use of 3D Texture has the potential to provide a more efficient and flexible way to handle multiple textures in 3D environments.

The first step in this process was to declare new ThinEngine methods, utilizing the TypeScript extension mechanism and syntax already in use in Babylon.

You can see the progression of this exploration in the following BabylonJS Playgrounds:

The next step is to introduce a new TextureType to extend the framework. For this, I created a new type of BaseTexture:

Finally, I modified the shader to account for the texture depth.

This marks a solid beginning to augmenting the engine with this feature. The next phase may involve exploring support for WebGPU to complete the work. Any assistance or input would be greatly appreciated!
G.

6 Likes

Why texture 3D instead of array ? as you do not seem to need the interpolation across depth here.

Hello @sebavan ,
Yes, I don’t require the 3D aspect here (which I included just to verify that everything is functioning properly). However, I do need this for my work on atmospheric shaders later on. I might be using some terms incorrectly in my explanation; translating from French can sometimes lead to awkward phrasing.

1 Like