-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
WebGLRenderer: onAfterRender() and onBeforeRender() are not called for Object3D and Group. #11306
Comments
Just for reference: There is already an existing issue for |
Yeah, |
Say, I have an Object3D with some meshes as children sharing a common material and thus uniforms. The latter are updated each frame. Then it would make sense to have onAfterRender/onBeforeRender on the Object3d to avoid the logic needed to ensure only a single updates of the uniforms. This approach allows to adapt to e.g. differently implemented maxVertexUniforms by creating meshes as needed. |
Hmm, in my case the onBeforeRender is not called. Did the issue raised up again?
From the the debugger I can see, that the function onCenterBeforeRender is assigned correctly (is also defined). Update: Just tested on this fiddle: |
I just ran into this myself. I wanted to contain a large FBX scene in a custom class which inherits from For the sake of context, this was my particular implementation:
|
@fernandojsg I guess this would be a good use case for the component system with a |
Just for the record: Sprites support the callbacks in the meanwhile. Renaming the PR's title... |
It seems that the thrust of this thread that onBeforeRender for groups is a useful feature, and I don't see any argument put forward against that point of view. The comment 'mrdoob added this to the rXX milestone on 9 Mar 2018' even appears to indicate that it accepted. If it is still intended behaviour that the onBeforeRender for groups does not work it should be made much clearer in the documentation. An optional callback that is executed immediately before the Object3D is rendered. This function is called with the following parameters: renderer, scene, camera, geometry, material, group. |
Is it an intentional behavior?
The functions are called on meshes, it is working fine there.
I wanted to redraw images on sprites depending on the distance to the camera, but onBeforeRender is not called.it is fixed now. thank you!I wanted to make the objects inside a group always facing the camera, but onBeforeRender is not called on the group.
The text was updated successfully, but these errors were encountered: