-
-
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
onBeforeRender called twice per render when passing a Mesh to the renderer. #19477
Comments
I think we have to change this line: three.js/src/renderers/WebGLRenderer.js Line 1174 in 452a9e9
to if( scene.isScene ) scene.onBeforeRender( _this, scene, camera, renderTarget || _currentRenderTarget ); and do the same thing for |
The renderer expects a If you do not think a |
Associated comment. onBeforeRender() does not seem to get called when applied THREE.Group. |
That's correct. It's only called for renderable 3D objects and scenes. |
Thanks. That should be clearer in the documentation. Is there any reason not to apply it to groups? |
This was already discussed here: #11306 |
Description of the problem
When onBeforeRender is applied to a mesh, and that mesh is rendered directly (not via a scene), then the onBeforeRender callback is applied twice for each render call.
I appreciate that it is not standard practice to render a mesh directly, but there are cases where it is helpful to avoid (the very small) overheads in performance, and in code noise.
https://jsfiddle.net/sjpt/t664p2yn/
Three.js version
Browser
OS
Hardware Requirements (graphics card, VR Device, ...)
The text was updated successfully, but these errors were encountered: