I'm using MeshNormalMaterial and MeshDepthMaterial as override materials and I sometimes set morphTargets to true. Now in [email protected], this setting prevents objects without morph targets from being rendered altogether.
I'm not sure if this behaviour is intentional but since this change hasn't been documented I thought I should let you know.
Uncomment line 23 in index.js:
https://codesandbox.io/s/override-material-morph-targets-06hjw
I can confirm this worked with R110. The regression was probably introduced via #17649.
Simplified example:
R110: https://jsfiddle.net/aoLbzj1s/
R111: https://jsfiddle.net/aoLbzj1s/1/
The problem is that setting morphTargets to true does not render the mesh when the geometry contains no morph targets. With R110 the mesh is still rendered.
@zeux It seems the uniform morphTargetBaseInfluence still needs an update even if no morph targets are defined. Adding this code in WebGLRenderer.renderBufferDirect() seems to fix the fiddle:
if ( material.morphTargets === true && object.morphTargetInfluences === undefined ) {
program.getUniforms().setValue( _gl, 'morphTargetBaseInfluence', 1 );
}
Can you think of a better way fixing this? Maybe we can refactor WebGLMorphtargets.update() so it is called when morphTargets is set to true (and not when morphTargetInfluences is defined).
Yeah we definitely need to always set the base influence if the material being used has the morph target shader variant. I will take a look...
FYI: the same problem occurs when morphNormals is set to true in MeshNormalMaterial.
Most helpful comment
Yeah we definitely need to always set the base influence if the material being used has the morph target shader variant. I will take a look...