Skip to content

Commit

Permalink
Improved visual quality of zebra stripes
Browse files Browse the repository at this point in the history
The stripes were computed based on the normal vector
of the vertex, not on the fragment. This lead to
visual distortions. Now, we use the normal
vector from the fragment shader as offered by the occt api.
  • Loading branch information
rainman110 committed Nov 7, 2023
1 parent f8e14d2 commit d7e763f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion TIGLViewer/shaders/PhongShading-v7.6.fs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ vec4 computeLighting (in vec3 theNormal,
vec3 v = vec3(0., 0., -1.);

// Direction of the view reflected on the surface
vec3 vReflect = 2. * (dot(Normal, v)*Normal - v);
vec3 vReflect = 2. * (dot(theNormal, v)*theNormal - v);

// normal vector of the light stripe plane
vec3 lightDir = normalize(vec3(0., 1., 0.));
Expand Down

0 comments on commit d7e763f

Please sign in to comment.