I load an FBX model that has blendshapes (morphs) on it and was able to reach them and play around using dat.gui sliders. Then I tried loading a texture on the model, but the I lost the control of the morphs, they were zeroed out. Without material it works fine but with it I can not seem to get morph value changes working.
Are you replacing
mesh.material, or just modifying
mesh.material.map? If you replace a material, you’ll have to enable morph targets on the new one with
.morphTargets=true and (perhaps)
mesh.material, also tried setting
morphNormals set to true in my
ShaderMaterial. Still didn’t work, I havent try the material map tho.
Ah, important to mention if you’re using ShaderMaterial. By using ShaderMaterial instead of the default materials, you’re going to have to implement the morph targets in the shader yourself. For an example of how it’s implement in the builtin materials, see:
This file has been truncated.
export default /* glsl */`
// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:
// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence)
// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting
transformed *= morphTargetBaseInfluence;
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
transformed += morphTarget1 * morphTargetInfluences[ 1 ];
transformed += morphTarget2 * morphTargetInfluences[ 2 ];
transformed += morphTarget3 * morphTargetInfluences[ 3 ];
transformed += morphTarget4 * morphTargetInfluences[ 4 ];
transformed += morphTarget5 * morphTargetInfluences[ 5 ];
transformed += morphTarget6 * morphTargetInfluences[ 6 ];
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
If you’re having trouble getting this to work, you’ll need to share your code or a demo for others to help further.
Thank you, i’ll try this and come back :0)
We lately discussed a similar issue here at github:
04:19AM - 18 Nov 19 UTC
02:14PM - 18 Nov 19 UTC
Follow-up to #8799 (comment) - it appears this is broken in r110:
THREE.WebGLProgram: shader error: 0 35715 true gl.getProgramInfoLog Must have a...
Check out the fiddle from this
comment. It shows how you integrate the necessary code for morph targets into an instance of
Sorry, I’m afraid the respective documentation does not have a high priority right now. You have to wait for 2020.
Thats okay, we appreciate the hard work of all the contributors
@Mugen87 your shader example from the fiddle worked for me!
Are there currently any plans regarding
node material [documentation]?
I’d be willing to write this, but there are some open questions that make it too early just yet.