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 bd9dca3 commit b9afb4a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion TIGLViewer/shaders/PhongShading-v6.fs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,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
2 changes: 1 addition & 1 deletion TIGLViewer/shaders/PhongShading-v7.fs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,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 b9afb4a

Please sign in to comment.