python-opengl icon indicating copy to clipboard operation
python-opengl copied to clipboard

linestrip-3d.py

Open straitsboy opened this issue 4 years ago • 1 comments

Hi,

In linestrip-3d.py, when I changed n=2048 to n=3, that is, two jointed segments spinning in 3D space, I get the following "faded", tapered ends. Peek 2021-03-23 16-04

Looking at the code, I suspect it is because linelength was calculated in model space but it is used like a screen space quantity in the shader.

For example, in the vertex shader, the code: "v_uv.x = linelength+w;" sums together a model space and a screen space quantity (w). As a result, v_uv.x doesn't interpolate exactly to the start/end of the polyline.

Any suggestion on how to fix it?

straitsboy avatar Mar 23 '21 08:03 straitsboy

You analysis is right. Length should be computed in screen space. I don't remember if I fixed the problem in http://jcgt.org/published/0002/02/08/. Might be worth a look.

rougier avatar Mar 29 '21 05:03 rougier