Create a line whose thickness on screen stays independent of camera position

I made these yellow lines with Windows’ Paint to illustrate what I’m trying to achieve

near perspective:

far perspective - zoom out: ( watch the linewidth - it stays the same)

farer away:


So the goal is that the thickness (on the screen) stays the same.
Is this possible in BJS?

Assuming you are using CreateLines for the line then the answer is no, it will always be 1px wide.

When you create a line using a tube the line thickness will change with distance

https://www.babylonjs-playground.com/#W34AAP

Since the tubes will be thin then you can decrease the tessellation (number of points around circumference) from 64 to 3 to save vertices

https://www.babylonjs-playground.com/#W34AAP#1

1 Like