Sharing same textures of different gltf PagedLODs #1455
Replies: 6 comments 1 reply
-
Ideally you'd want the vsg::DescriptorImage associated texture shared across the subgraphs. In principle the vsgXchange::assimp loader should attempt to find duplicates and then share the first instance that matches if you have the vsg::SharedObjects setup. Whether you've set things up correctly, whether the textures are fully compatible and whether there might be issue in SharedObjects/vsgXchange::assimp is something I can't provide any guidance on as I simply don't know enough about your specific set of models and how you have set up and use the VSG. |
Beta Was this translation helpful? Give feedback.
-
I have such folder structure for every route (it is railway simulator): route_name model1.gltf and model2.gltf both in image field have uri: "../textures/texture1.tga" Next, in my program, I write:
And later, to load objects of specified route:
Same models with same .gltf path and filename seem to be shared, but multiple .gltf with same image "uri" create new texture for each of them |
Beta Was this translation helpful? Give feedback.
-
In principle what you are trying to do should be possible, but even with these extra details it's not possible to know what part is preventing the sharing. Is you work open sourced? I'm not currently in the position to review code but perhaps others can, or later down the line when I have more time available could have a look. |
Beta Was this translation helpful? Give feedback.
-
Yes, it is open-source, here is the link to file that I was shared code from: https://github.com/avilkinnick/RRS/blob/ANI4/viewer2/src/RouteViewer.cpp |
Beta Was this translation helpful? Give feedback.
-
It seems that problem is inside VulkanSceneGraph/src/vsg/utils/GraphicsPipelineConfigurator.cpp in method DescriptorConfigurator::assignTexture:
Even though textureData is really shared, every time it creates a new DescriptorImage and so, it makes new copy of texture in graphics memory |
Beta Was this translation helpful? Give feedback.
-
I found why the same Image Descriptor already available in SharedObjects is not being used. I found that mipLevels and usage are changed during compiling by ImageInfo::computeNumMipMapLevels(). So I fix the problem adding call this method before share: vsg-dev/vsgXchange#217 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently I load my gltf models through pagedLODs, but even if they have the same uri, renderdoc shows that the texture is loaded into memory as many times as the number of gltf files that contain the path to that texture. options->sharedObjects is created, but it doesn't help. How to load each texture only one time?
I thought about vsg::External, but I haven't seen in examples how to set it up and attach to root scene node
Beta Was this translation helpful? Give feedback.
All reactions