-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disposing scene background texture does not remove the geometry #26897
Comments
What problems does this cause and why do you need this 1 piece of reusable internal geometry to be disposed? |
There are certain features of the engine that require to allocate internal resources (e.g. for env map conversions or backgrounds). For performance reasons, it makes sense to keep certain resources allocated. E.g. for the case when the user decides to replace a background texture with a new one. As long as there is no memory leak we do not consider this issue as a bug. |
BTW: We could hide internal resources from I personally prefer the current way. Meaning |
No worries - it came up while I was in the process of trying to manage memory in a more complex environment that involved clearing and loading new scenes. I got stuck on why I couldn't get rid of everything in the renderer.info.memory object, and discovered it was the scene.background. I thought it probably was a miniscule amount of memory but thought I'd report it in case others ran into the same issues, and might save them the several hours I spent tracking it down. |
Hi, Even after disposing of the renderer the geometry and "BackgroundMaterial" shader still exist according to renderer.info. If I create a new renderer and a new scene are these same resources reused, cleanup or leaked? |
Description
When a scene background is set to a Texture, /src/renderers/webgl/WebGLBackground.js creates a mesh:
However there doesn't seem to be any way to dispose of that PlaneGeometry. Calling
scene.background.dispose()
only disposes of the Texture.Here's an example: https://codesandbox.io/s/still-voice-zwrpsn?file=/src/index.mjs
The scene has a cube and a background texture. When you execute dispose() in the gui, you are still left with 1 geometry hanging around.
Reproduction steps
scene.background
to a Texture.renderer.info.memory
and verify there is 1 geometry and 1 texture.scene.background.dispose()
and see that there is still 1 geometry in memory.Code
Live example
Screenshots
No response
Version
r157
Device
No response
Browser
No response
OS
No response
The text was updated successfully, but these errors were encountered: