-
-
Notifications
You must be signed in to change notification settings - Fork 35.7k
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
ShadowNode: Introduce onBeforeUpdate
and onAfterUpdate
#30856
ShadowNode: Introduce onBeforeUpdate
and onAfterUpdate
#30856
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
Could |
No because |
I had noticed this but it seems that in the example you are dealing with meshes individually but it still makes sense. I still don't know if adding it to the Node is the best option, we should have events in the Nodes that manipulated the Node class (the scope) and events in the |
Without even having to update the API, I think we could add in bakedShadow.shadow.camera.onBeforeRender = () => {
staticMesh.visible = true;
dynamicMesh.visible = false;
}; _renderScene( scene, camera, useFrameBufferTarget = true ) {
if ( this._isDeviceLost === true ) return;
camera.onBeforeRender() // also object doesn't exist here, nor material ect...
...
sceneRef.onAfterRender( this, scene, camera, renderTarget );
//
camera.onAfterRender() // <-- after or before sceneRef.onAfterRender?
return renderContext; (Btw |
Yes, |
Nevermind, I realized using |
Description
This PR adds two new hooks to shadow nodes:
onBeforeUpdate
andonAfterUpdate
. These can be very useful for applying specific behavior to individual shadows in the scene.For example, in the case of a static shadow and a dynamic shadow, a mesh can be hidden for one and visible only to the other:
This contribution is funded by Renaud Rohlinger @ Utsubo