Skip to content

Commit

Permalink
Kamzik's shader fix for normals
Browse files Browse the repository at this point in the history
  • Loading branch information
Greavesy1899 committed Nov 29, 2024
1 parent 9e5ed2b commit 7d73efc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Mafia2Libs/Shaders/LightPS.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ float3 CalculateFromNormalMap(VS_OUTPUT input)

normalMap = 2.0f * normalMap - 1.0f;

// sometimes specular is in blue channel, need to ignore this value for calculating bump
normalMap.z = 1.0f - normalMap.x * normalMap.x - normalMap.y * normalMap.y;

// Ensure the tangent and binormal are perfectly orthonormal to the normal vector
float3 Normal = input.Normal;
float3 Tangent = normalize(input.Tangent - dot(input.Tangent, input.Normal) * input.Normal);
Expand Down

0 comments on commit 7d73efc

Please sign in to comment.