Skip to content
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

SkinningNode: Fix previousBoneMatrices #30161

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/nodes/accessors/SkinningNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class SkinningNode extends Node {

const mrt = builder.renderer.getMRT();

return mrt && mrt.has( 'velocity' );
return ( mrt && mrt.has( 'velocity' ) ) || builder.object.userData.useVelocity === true;

}

Expand Down
9 changes: 9 additions & 0 deletions src/nodes/lighting/ShadowNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -662,12 +662,21 @@ class ShadowNode extends ShadowBaseNode {
const currentRenderObjectFunction = renderer.getRenderObjectFunction();
const currentMRT = renderer.getMRT();

const useVelocity = currentMRT ? currentMRT.has( 'velocity' ) : false;

renderer.setMRT( null );

renderer.setRenderObjectFunction( ( object, scene, _camera, geometry, material, group, ...params ) => {

if ( object.castShadow === true || ( object.receiveShadow && shadowType === VSMShadowMap ) ) {

if ( useVelocity ) {

object.userData = object.userData || {};
object.userData.useVelocity = true;
Copy link
Owner

@mrdoob mrdoob Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be better to do a local WeakMap for this?
I think we should avoid leaking renderer internals into userData.


}

object.onBeforeShadow( renderer, object, camera, shadow.camera, geometry, scene.overrideMaterial, group );

renderer.renderObject( object, scene, _camera, geometry, material, group, ...params );
Expand Down
Loading