-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Transparent double-sided materials causes a new Program to be created each frame #22255
Comments
This should already be fixed on |
I don't think that's true. Programs are internally cached and you can see in the debugger that the material holds two programs for each render pass. They are reused and not recreated. |
Ah, I understand. I thought that it was constantly updating the program since the material version is incrementing by 1 each frame. This appears to only happen with transparent double-sided materials, and not with opaque double-sided materials. |
The three.js/src/renderers/WebGLRenderer.js Lines 1355 to 1367 in 434b33e
However, it does not recompile shaders. |
Ah, now I get it. Then all that remains is a mystery lag when a transparent double-sided object enters the screen the first time, despite calling compile on the entire non-frustum culled scene with all lights present. Is there maybe a bug in .compile for these materials? |
AIFACS, Good catch! Do you mind creating a new issue for this? |
As the title says, if a material uses side = THREE.DoubleSide and transparent, it causes the material properties version to increment each frame creating a new program.
To reproduce, add a breakpoint before program changes due to needsProgramChange === true, and use the following material:
Due to an additional issue which I will submit, the morphTargets will also cause a new program to be created each frame. That issue hides this issue.
The text was updated successfully, but these errors were encountered: