diff --git a/packages/dev/core/src/Materials/Node/Blocks/Fragment/fragDepthBlock.ts b/packages/dev/core/src/Materials/Node/Blocks/Fragment/fragDepthBlock.ts index b885a1477cf..17ed8dab725 100644 --- a/packages/dev/core/src/Materials/Node/Blocks/Fragment/fragDepthBlock.ts +++ b/packages/dev/core/src/Materials/Node/Blocks/Fragment/fragDepthBlock.ts @@ -61,7 +61,7 @@ export class FragDepthBlock extends NodeMaterialBlock { } else if (this.worldPos.isConnected && this.viewProjection.isConnected) { state.compilationString += ` ${state._declareLocalVar("p", NodeMaterialBlockConnectionPointTypes.Vector4)} = ${this.viewProjection.associatedVariableName} * ${this.worldPos.associatedVariableName}; - ${state._declareLocalVar("v", NodeMaterialBlockConnectionPointTypes.Vector4)} = p.z / p.w; + ${state._declareLocalVar("v", NodeMaterialBlockConnectionPointTypes.Float)} = p.z / p.w; #ifndef IS_NDC_HALF_ZRANGE v = v * 0.5 + 0.5; #endif diff --git a/packages/dev/core/src/Materials/Node/Blocks/Fragment/shadowMapBlock.ts b/packages/dev/core/src/Materials/Node/Blocks/Fragment/shadowMapBlock.ts index 5c90358ee92..4b89f90d4dd 100644 --- a/packages/dev/core/src/Materials/Node/Blocks/Fragment/shadowMapBlock.ts +++ b/packages/dev/core/src/Materials/Node/Blocks/Fragment/shadowMapBlock.ts @@ -83,7 +83,7 @@ export class ShadowMapBlock extends NodeMaterialBlock { state._emitUniformFromString("biasAndScaleSM", NodeMaterialBlockConnectionPointTypes.Vector3); state._emitUniformFromString("lightDataSM", NodeMaterialBlockConnectionPointTypes.Vector3); - state._emitUniformFromString("depthValuesSM", NodeMaterialBlockConnectionPointTypes.Vector3); + state._emitUniformFromString("depthValuesSM", NodeMaterialBlockConnectionPointTypes.Vector2); state._emitFunctionFromInclude("packingFunctions", comments); diff --git a/packages/tools/tests/test/visualization/ReferenceImages/nmeshadowmap.png b/packages/tools/tests/test/visualization/ReferenceImages/nmeshadowmap.png new file mode 100644 index 00000000000..ec29a127a9f Binary files /dev/null and b/packages/tools/tests/test/visualization/ReferenceImages/nmeshadowmap.png differ diff --git a/packages/tools/tests/test/visualization/config.json b/packages/tools/tests/test/visualization/config.json index e93b9cf15e2..49177896a43 100644 --- a/packages/tools/tests/test/visualization/config.json +++ b/packages/tools/tests/test/visualization/config.json @@ -1,6 +1,11 @@ { "root": "https://cdn.babylonjs.com", "tests": [ + { + "title": "NME Shadow Map", + "playgroundId": "#M3QR7E#83", + "referenceImage": "nmeshadowmap.png" + }, { "title": "NMEGLTF", "playgroundId": "#WGZLGJ#10320",