Keep size of Line2 always the same

Hello, I’m trying to preserve the width of the fat line (Line2) always the same no matter the zoom of the camera, but I’m struggling. How would be this possible without using the Orthographic camera

Should I resize it on zoom or ?

TBH, I don’t understand the issue. The width property of wide lines is defined in pixels. Perspective size attenuation is not supported and does not make sense when the line width is defined in pixels.

Fat lines always have the same size right now independently of the camera’s transformation.

Sorry that I didn’t explain it so well. Yes, the width property of the line is always the same in pixels. But I need to preserve the constant size of the line regardless of perspective. So when I zoom out the width should increase and the opposite when I zoom in the width should decrease

Just like in this example with the labels

It seems you can use the code from this PR:

There is no worldUnits property in the LineMaterial, or you meant something else

I have meant that you create a custom wide line version based on the PR’s code.

Thanks for your help. I found MeshLine, and I will use it for my case.

What you are describing is the default behavior of Line2. The line is constant thickness in pixels regardless of whether you zoom in or out.

1 Like