3D Volume Texture in QtQuick3D CustomMaterial
-
Hi all!
I am looking into ways to use a 3D volume texture within a QtQuick3D CustomMaterial.
I want to (dynamically) create a volume texture so I can use it within the fragment shader as asampler3D
.So far, I have found the (somewhat) relevant things:
- TheQCustom3DVolume does not integrate with QtQuick3D at all
- QSGDynamicTexture is the base class for textures but I could not find anything for 3D textures. So guess I would have to subclass this to implement a 3D texture.
- QSGTextureProvider would be the class to implement to actually create the texture and bring it into the scene graph. The VulkanTextureImport example shows how to do this on vulkan, but I could not find a corresponding OpenGL example.
- QQuick3DTextureData seems to be a new Qt6 way to provide dynamic texture data. However, again only 2D.
So, I am guessing that even if I implement a custom QSGDynamicTexture to create and upload a 3D texture, the CustomMaterial system would try to map it as a 2D texture and provide only a sampler2D to my shader.
I could not find any information on how to map custom uniforms in a custom material (that way I could manage the 3D texture outside of qml, and just map it in somehow).
So, does anyone have pointers on how to go about this? It this simply something that is not possible/feasible with QtQuick3D , and I would have to just use the Qt3D or a custom rendering engine instead?
Any help or pointers to additional resources/examples is greatly appreciated! -
@Jakob-Weiss I have exactly the same issue. Qt3D allowed to defined Texture3D Parameters in Shader Effects and thus in the Shader Source Code as sampler3D uniform. If something similar is available for QtQuick3D please let us know.
-
We could not figure out how to achieve this without pure QtQuick3D without major modifications.. In the end, for this we opted to go with Qt3D instead of QtQuick3D. it seems that Qt3D is more geared towards customizable rendering while QtQuick3D just covers the standard cases and little else.