Skip to content

Commit 893a228

Browse files
committed
[3d] fix shading of 3D point symbols
The vertex shader was incorrectly transforming world position and normal vectors for phong shading. This was causing wrong appearance that was noticeable when moving/rotating camera (e.g. specular reflection was always in the same place). This was caused by involving view matrix (i.e. camera position and orientation) to the vectors, but the world position and normal should be independent from camera.
1 parent 0f315e4 commit 893a228

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/3d/shaders/instanced.vert

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ void main()
2121
// which all keep "w" set to 1. correctly we should use translation matrix...
2222
vec4 offsetPos = inst * vec4(vertexPosition, 1.0) + vec4(pos, 0.0);
2323

24-
worldNormal = normalize(modelViewNormal * mat3(instNormal) * vertexNormal);
25-
worldPosition = vec3(modelView * offsetPos);
24+
worldNormal = normalize(mat3(instNormal) * vertexNormal);
25+
worldPosition = vec3(offsetPos);
2626

2727
gl_Position = modelViewProjection * offsetPos;
2828
}

0 commit comments

Comments
 (0)