Gltf instancedbuffer.color has no effect

Hi Zhang. No replies yet, huh? Sorry.

Let’s ping @Deltakosh for this one… see if he has a moment to give us some ideas.

I made playgrounds #2 - #5 in that same series… blindly trying everything I could think-up, with no success. (I’m new to instancedBuffers and containers, though).

#5 tries a single instance (to the left-side of master model). hmm.

Also, it appears that the instance has reversed fan blades, too. Not sure what the story is, there.

Calling all helpers (thx).

The gltf objects are using a PBRMaterial and you need to enable vertex color support to see the vertex color (which is the one you specify with the instanced buffer)

Pinging @sebavan for more details

1 Like

You first need to enable vertex colors:

But as well you need to create a Buffer for it to work and not just assigning a color: Use Instances - Babylon.js Documentation


Wow. Thx guys. Generally speaking, this is simply the wrong type of model to use instancedBuffers upon, then, yes?

Any news on the fan blades and anim being reversed on the instances? [demo #9] (master in center, instances on each side). Black cord on wrong side for the instances, too.

SO, the best we can hope-for with THIS model… might be… what? .instantiateHierarchy(), I guess. [demo #10]. (notice fan blades and power cords are correct… on the instances… in demo #10).

It sure is a pretty model. Babylon “fan club”. arr arr arr.

But there’s no possibility to use instancedBuffers to change aqua-marine color on instances… to something different… because… the aqua-marine color is a texture and not vertexData colorKind data (stored in a vertexData colors buffer/array).

Does that sound correct? hehe. I ask more questions than the original poster, don’t I?

Wingy is attending “How to be a better forum helper” - school. :slight_smile: Containers and gltf and pbr… phew. Remember back when it was easier, back when we rendered models using a Playdoh Fun-Factory? heh. Mix in some Tinker Toys and Erector Set pieces, and ya had a beautiful creative mess (completely automatic physics, though).

Ahh, those were the days.

Thank you for your patience. Another question is can the instance support visibility.

Or some other transparent way

That’s because GTLF models are right-handed and Babylon is left-handed by default. When rendering the master mesh, Babylon is applying a -1 scale on the X axis, which for some reason it does not do for the instances. By setting scene.useRightHandedSystem = true, all fan blades rotate in the same way:

By digging deeper, I noticed that the fans were in fact not rendered as instances if you don’t use scene.useRightHandedSystem = true even if created with .createInstance… Somehow, Babylon notices that there is a discrepancy in the handedness of the scene and of the mesh and don’t treat them as instances. When you set scene.useRightHandedSystem = true, however, meshes are “merged” and displayed as instances.

It’s ok in demo #10 because instances are really instances, it’s the same case as demo #9 with scene.useRightHandedSystem=true.

1 Like

Correct. We disable instancing for instances with a different matrix determinant as this will imply a different face culling order

1 Like