Commit 5d647693 authored by chili's avatar chili
Browse files

fixing rgb=>n mapping all shaders


fixing rgb=>n mapping all shaders
parent 263b66a9
......@@ -36,9 +36,8 @@ float4 main(float3 viewPos : Position, float3 n : Normal, float3 tan : Tangent,
);
// unpack the normal from map into tangent space
const float3 normalSample = nmap.Sample(splr, tc).xyz;
n.x = normalSample.x * 2.0f - 1.0f;
n.y = -normalSample.y * 2.0f + 1.0f;
n.z = normalSample.z;
n = normalSample * 2.0f - 1.0f;
n.y = -n.y;
// bring normal from tanspace into view space
n = mul(n, tanToView);
}
......
......@@ -33,15 +33,6 @@ float4 main( float3 viewPos : Position,float3 n : Normal,float2 tc : Texcoord )
{
// sample normal from map if normal mapping enabled
if (normalMapEnabled)
{
// unpack normal data
const float3 normalSample = nmap.Sample(splr, tc).xyz;
n.x = normalSample.x * 2.0f - 1.0f;
n.y = -normalSample.y * 2.0f + 1.0f;
n.z = -normalSample.z;
n = mul(n, (float3x3) modelView);
}
else
{
// unpack normal data
const float3 normalSample = nmap.Sample(splr, tc).xyz;
......
......@@ -35,9 +35,7 @@ float4 main(float3 viewPos : Position, float3 n : Normal, float3 tan : Tangent,
);
// unpack normal data
const float3 normalSample = nmap.Sample(splr, tc).xyz;
n.x = normalSample.x * 2.0f - 1.0f;
n.y = -normalSample.y * 2.0f + 1.0f;
n.z = normalSample.z;
n = normalSample * 2.0f - 1.0f;
// bring normal from tanspace into view space
n = mul(n, tanToView);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment