Skip to content

Commit

Permalink
SkinningNode: Fix previousBoneMatrices (#30161)
Browse files Browse the repository at this point in the history
* fix previousBoneMatrices

* fix no MRT
  • Loading branch information
sunag authored Dec 18, 2024
1 parent 86018eb commit 428eb72
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
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;

}

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

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

0 comments on commit 428eb72

Please sign in to comment.