Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ half3 NormalInTangentSpace(float2 texcoords)
// This is a replacement for UnityStandardUtils UnpackScaleNormalRGorAG to use XYZ normals even with DXT5nm enabled
half4 packedNormal = tex2D(normalTexture, texcoords);
half3 normal = packedNormal.xyz * 2 - 1;
// Reconstruct Z from X,Y.
// This makes two-channel normalmaps (BC5 / EAC_RG) work and matches the behavior of Unity's own shaders.
normal.z = sqrt(1.0 - saturate(dot(normal.xy, normal.xy)));
#if (SHADER_TARGET >= 30)
// SM2.0: instruction count limitation
// SM2.0: normal scaler is not supported
Expand Down