Skip to content

Commit

Permalink
volumetric: Fix tcmask normals
Browse files Browse the repository at this point in the history
  • Loading branch information
vlj committed Jan 15, 2024
1 parent a1178b2 commit 67e6365
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion data/base/shaders/vk/tcmask_instanced.frag
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,10 @@ void main()
MaterialInfo materialInfo;
materialInfo.albedo = diffuse;
materialInfo.gloss = specularMapValue;
light += iterateOverAllPointLights(clipSpaceCoord, fragPos, -N, normalize(halfVec - lightDir), materialInfo, identityMat);
// Normals are in view space, we need to get back to world space
// No idea why we need the minus
vec3 fragNormal = -(inverse(ViewMatrix) * vec4(N, 0)).xyz;
light += iterateOverAllPointLights(clipSpaceCoord, fragPos, fragNormal, normalize(halfVec - lightDir), materialInfo, identityMat);
}

light.rgb *= visibility;
Expand Down

0 comments on commit 67e6365

Please sign in to comment.