How to use color buffer with GreasedLine and Thin Instances?

Hello,
I am trying to draw the same GreasedLine multiple times with thin instances with different colors. I am pretty sure I missed something simple fundamental here, such as the wrong buffer kind name or enabling a color buffer altogether. I created a playground as a base: I want to draw the 3 squares with 3 different colors.

Best regards,
Axel

Summoning the god of GreasedLines: @roland

Hello!

I’ve added this property to the material options colorMode: BABYLON.GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY
and a HemisphericLight to the scene in the following PG:

Result:

Docs for colorMode:
https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colormode

Another approach is this (1 draw call):
You can draw as many lines in instance mode. All the lines will be joined into one mesh so it renders fast.

Docs for instance:
https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#instance-mode

Docs for lazy:
https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#lazy-mode

1 Like

Hi,
unfortunately, while both ideas are nice, they do not solve my problem (which I did so far not clearly state):

So I want to have many instances and when I hover one of them, I want to change its color. So even if it might work for low numbers of instances, I consider the second approach as not usable (although the idea is nice).

The first one is close to what I want to to do, but I need the emissive color set as I have a technical drawing scene that does not use lights or shading. Can it be modified to set the emissive color so I dont get any shading but basically a flat fill with the color?

I also tried in the meantime using a custom shader material with one color attribute, but it looks like I cannot just plug any material into GreasedLine. No pixels are filled at all using my custom material. Using a custom material would actually be my preferred solution but looks like this is not so easy.

Best regards,
Axel