Closed Consti10 closed 4 years ago
Because in the current sceneform implementation a 'Renderable' holds the raw gltf buffer. And a RenderableInstance holds a FilamentAsset.
I think 'Renderable' should hold a FilamentAsset and 'RenderableInstance' should be used to add / remove this filamentAsset from the scene.
I don't know about the specifics of Sceneform's implementation. What is your question/issue for Filament?
Can you add the same filamentAsset multiple times to the filament renderer ? And if so, is there any example.
You can use AssetLoader.createInstancedAsset()
to generate multiple FilamentAsset
instances. Each FilamentAsset
gives you a hierarchy of entities you can add to a scene.
@Consti10 hey which version of Sceneform you are using? Are you using setIsFilamentGltf(true) property? Also can you share some details on the fix Thanks
Hello, I am using the latest open sourced version that has been heavily modified to fix bugs that arose when using it in our project. For example, not a bug but a weak design choice in my opinion: The version I am talking about doesn't work with anything else than gltf. Therefore, setIsFilamentGltf() is obsolete and I removed it / deleted anything leftover from that variable.
My current fix is customized for our specific need - We have some really big assets (memory wise) that need to be swapped. Therefore, I modified Sceneform to add a filament asset when a RenderableInstance is added to a node and delete the asset when it is removed.
In the original sceneform OS release, each time an Renderable is added to a node a new instance was created, but it never got deleted when going out of scope, resulting in quaranteed crashes after some time.
The better solution would be to use what's recommended by romainquy, but I was not yet able to update filament to the latest release in scenefom .
I cannot share the source code right now since we are using assets that are not under a OS license. But I'l see what can be done.
@Consti10 Hey thanks for the explanation. I figured out how to fix the issue at least for my use case.
Hi everyone, I have the same problem while clearing the app screen from the glb objects. the graphical memory is not released and it causes the crash. could you help me with it?
Sceneform in its latest version does not properly release the gpu resources when switching the displayed renderable for a Node. AssetLoader.destroyAsset() is never called. I implemented a quick fix here: repo by calling this method when a RenderableInstance goes out of scope.
However, I am not sure if a FilamentAsset should be created for each RenderableInstance. Can you draw one filamentAsset multiple times in a scene (with different transforms) ?
If so, is there a filament example how to do so ?