Shader Snipet for Line (ParticlesGPU)

I have a bit a problem with making the width of the Lines independent from the camera distance. How is this done for example in the Shader of the Line module or in the splinesGPU or particlesGPU contrubutions?


from Line (EX9) module shader

// translate point to get a thick curve
    float2 off = Pos.y * normal * w * p.w;

I believe that p.w is what you are looking for (p is position multiplied by WorldViewProjection matrix)

hey unc, thank you!

Here is the almost finished version. may you or someone else have a look on it? It is working nicely but a final little rotation problem occurs, that causes some kind of shading if you move around the camera.

Will be clear with low particle count and high width… (435.9 kB)

Ah no sorry, I think everything is correct now with the new mesh… I make a contribution