Thin Instance LinesMesh Question/Issue

I’ve been working on my g-code viewer and I wanted to provide a lighter weight rendering using linesmesh and not just boxes. I wanted to utilize thin instances to reuse existing code to render out the lines. In my application the linemesh thin instances show up but I get constant flickering.

I tried to put a PG together that lightly mimics the shader I have written and does thin instances but I can’t get the lines to show up. If you flip the flag to use a box it works fine. Any help would be appreciated because this would help me greatly.

Video of my app with thin instanced linesmesh
PG :

I am not sure that thinInstances support lines, lets add @Evgeni_Popov their daddy in the thread.

I’m sure it is unintended but if you do
scene.performancePriority = BABYLON.ScenePerformancePriority.Intermediate

You can see the instances do exist. Would be great to see LinesMesh get thin instances support if it lacks it.


Edit: Could it possibly have to do with a lack of normals on the line?

This PR should do it:

1 Like

I made the changes in the PR locally and the thin instances are working! However, my shader does not appear to fully appreciate the linesmesh and has some artifacts that I am trying to chase down. But the instances themselves are working. Looks like

Edit: StandardMaterial causes the same effect.


Looks like I’ll need to work a custom shader for the linesmesh thanks for your help! Looking forward to this change getting merged in.

Try to set the emissive color instead of the diffuse color. It’s probably the lighting which is causing the artifacts.

1 Like

You rock! Thank you guys for all your help!

     color = vec4(diffuseColor.rgb, color.w);