Skip to content

Commit

Permalink
fix(MeshRefractionMaterial): vNormal should be normalized (#1184)
Browse files Browse the repository at this point in the history
  • Loading branch information
gydence committed Dec 15, 2022
1 parent c20af06 commit 57d95f1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/materials/MeshRefractionMaterial.tsx
Expand Up @@ -47,9 +47,9 @@ export const MeshRefractionMaterial = shaderMaterial(
projectionMatrixInv = inverse(projectionMatrix);
viewMatrixInv = inverse(viewMatrix);
vWorldPosition = (modelMatrix * transformedPosition).xyz;
vNormal = (viewMatrixInv * vec4(normalMatrix * transformedNormal.xyz, 0.0)).xyz;
vWorldPosition = (modelMatrix * transformedPosition).xyz;
vNormal = normalize((viewMatrixInv * vec4(normalMatrix * transformedNormal.xyz, 0.0)).xyz);
viewDirection = normalize(vWorldPosition - cameraPosition);
gl_Position = projectionMatrix * viewMatrix * modelMatrix * transformedPosition;
}`,
Expand Down

1 comment on commit 57d95f1

@vercel
Copy link

@vercel vercel bot commented on 57d95f1 Dec 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.