You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like there might be a memory issue caused by changing the material of the Text.
I'm attempting to incorporate some post-effects into my project, and one of them involves selective blooming for Text meshes. The usual approach for selective blooming involves rendering the scene twice. In the first render, the non-blooming objects (Text in my case) are replaced with something dark, and in the second render, the original material is restored.
I suspect that the automatically createdDerivedMaterial is not properly disposed of after setting a material because I've noticed that when trying to implement this with Text meshes, the memory consumption keeps increasing until the page crashes. To be specific, the automatically created DerivedMaterial from the first render are likely not disposed during the material restoration process in the second render.
Please see codesandbox for the issue. Post-processing parts are skipped for simplicity.
The text was updated successfully, but these errors were encountered:
Thanks, it seems likely you're correct about disposal.
How are you measuring the memory consumption? Is this JS heap memory or GPU memory, or both?
I measure JS allocated memory with the stats component. See the top left corner in the codesandbox, the memory consumption keeps rising. Not yet sure about GPU memory though.
Not to ignore the issue, but in your specific case couldn't you just temporarily change the color to black rather than replacing the whole material?
It seems like there might be a memory issue caused by changing the material of the
Text
.I'm attempting to incorporate some post-effects into my project, and one of them involves selective blooming for
Text
meshes. The usual approach for selective blooming involves rendering the scene twice. In the first render, the non-blooming objects (Text
in my case) are replaced with something dark, and in the second render, the original material is restored.I suspect that the automatically created
DerivedMaterial
is not properly disposed of after setting a material because I've noticed that when trying to implement this withText
meshes, the memory consumption keeps increasing until the page crashes. To be specific, the automatically createdDerivedMaterial
from the first render are likely not disposed during the material restoration process in the second render.Please see codesandbox for the issue. Post-processing parts are skipped for simplicity.
The text was updated successfully, but these errors were encountered: