Using morphs with a material

Hello,

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) .morphNormals=true. https://threejs.org/docs/#api/en/materials/MeshStandardMaterial

I replaced mesh.material, also tried setting morphTargets and 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:

If you’re having trouble getting this to work, you’ll need to share your code or a demo for others to help further.

3 Likes

Thank you, i’ll try this and come back :0)

We lately discussed a similar issue here at github:

Check out the fiddle from this comment. It shows how you integrate the necessary code for morph targets into an instance of ShaderMaterial.

3 Likes

@Mugen87 Are there currently any plans regarding node material or shader chunks documentation? Is it coming soon or still far away? Maybe hopefully this year? :innocent: :gift::christmas_tree:

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 :smiling_face_with_three_hearts:

1 Like

Thank you @Mugen87 your shader example from the fiddle worked for me!

1 Like

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. https://github.com/mrdoob/three.js/issues/17971

2 Likes