Node material and instances

Hello guys,

I have a scene where I load a mesh via asset container to make use of instantiateModelsToScene(). Unfortunately I encountered a problem here. I want to use the same node material for all the instantiated meshes. But this leads break the functionality of separated animations.

Even though I added the instances block to my node material: https://playground.babylonjs.com/#8RJEY8#7

Any idea what I am doing wrong?

Best

I don’t think this is related to instances, because it happens for single meshes too, with any node material: Available Mesh BrainStem | Babylon.js Playground (babylonjs.com). Probably related to skinning? I’ll have to ping @bghgary again for that :rofl:

1 Like

Oooh, you’ll have to add the bones in the material for it to work: Node Materials and animated meshes. (4.1) - Questions - Babylon.js (babylonjs.com)

Hi @samevision

Like this? https://playground.babylonjs.com/#8RJEY8#10. The problem is the cloned animation groups for eyes are not started. I manually triggered play and it worked. The rest of the mesh were actually started, but you didn’t set a different position so their anim are overlapped with the original model.

@carolhmj is correct. instantiateModelsToScene is cloning, not instancing.

Yep adding the proper bone nodes solves the issue, there’s already an example on the linked question but here’s a simpler one: Babylon.js Node Material Editor (babylonjs.com)
Available Mesh BrainStem | Babylon.js Playground (babylonjs.com)

1 Like

This function will instance when possible or clone otherwise.

Despite adding all of it, there is still smthg wrong with the eyes https://playground.babylonjs.com/#8RJEY8#13

But I added the bones block already - not working :frowning:: https://nme.babylonjs.com/#V3R0KJ#31

The eyes are not my problem here. My problem is that with node material the animation are played synchronously. But I want to be able to play them separately.

With node material: https://playground.babylonjs.com/#8RJEY8#15

Without node material: https://playground.babylonjs.com/#8RJEY8#16

As you can see without node material the animations are separated. They second one has a delay of one second due to the timeout.

It seems that the missing morph target block caused this problem. It’s working now :slight_smile: : https://playground.babylonjs.com/#8RJEY8#17

The eyes are still broken.

Ohhhh :frowning:

It was too early. It is working with the alien model but I noticed that my model is still not working properly.

Alien - this is how it should look like (animations can be played independently): https://playground.babylonjs.com/#8RJEY8#19

My model - animations are running synchronously (if you check the animation groups at inspector you will see that the first animation group animates both meshes and the second one does nothing): https://playground.babylonjs.com/#8RJEY8#18

What’s wrong with my model or node material?

Eyes will be fixed by NME Fixes by sebavan · Pull Request #12172 · BabylonJS/Babylon.js · GitHub You ll be able to try out on your other models as soon as it as shipped.

4 Likes

Hey there @samevision have you had a chance to try out the fix, did it work for you? :smiley:

1 Like

Hey @carolhmj,

I tested it in my local project and it seems to work now :slight_smile:

1 Like