瀏覽代碼

Merge pull request #7970 from Popov72/shadowdepthmat

Fix bug in ShaderMaterial when using morph targets
David Catuhe 5 年之前
父節點
當前提交
08292e8429
共有 2 個文件被更改,包括 8 次插入2 次删除
  1. 1 0
      dist/preview release/what's new.md
  2. 7 2
      src/Materials/shaderMaterial.ts

+ 1 - 0
dist/preview release/what's new.md

@@ -125,6 +125,7 @@
 - Fix bug in NME where collapsed frames didn't redraw output links to outside nodes([belfortk](https://github.com/belfortk))
 - Fix bug in NME where links were not redrawn after moving frame port ([belfortk](https://github.com/belfortk))
 - Fix bugs in NME that were causing inconsistent behavior displaying Move Node Up and Down buttons on frame ports([belfortk](https://github.com/belfortk))
+- Fix bug in `ShaderMaterial` when using morph targets ([Popov72](https://github.com/Popov72)
 
 ## Breaking changes
 

+ 7 - 2
src/Materials/shaderMaterial.ts

@@ -528,6 +528,8 @@ export class ShaderMaterial extends Material {
         }
 
         // Bones
+        let numInfluencers = 0;
+
         if (mesh && mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {
             attribs.push(VertexBuffer.MatricesIndicesKind);
             attribs.push(VertexBuffer.MatricesWeightsKind);
@@ -538,7 +540,9 @@ export class ShaderMaterial extends Material {
 
             const skeleton = mesh.skeleton;
 
-            defines.push("#define NUM_BONE_INFLUENCERS " + mesh.numBoneInfluencers);
+            numInfluencers = mesh.numBoneInfluencers;
+
+            defines.push("#define NUM_BONE_INFLUENCERS " + numInfluencers);
             fallbacks.addCPUSkinningFallback(0, mesh);
 
             if (skeleton.isUsingTextureForMatrices) {
@@ -601,7 +605,8 @@ export class ShaderMaterial extends Material {
                 defines: join,
                 fallbacks: fallbacks,
                 onCompiled: this.onCompiled,
-                onError: this.onError
+                onError: this.onError,
+                indexParameters: { maxSimultaneousMorphTargets: numInfluencers }
             }, engine);
 
             if (this._onEffectCreatedObservable) {