I am trying to figure out, how to render a terrain with my deffered lighting and i still have problems with normal map.
I am passing my terrain blocks into vertex shader, where i read heightmap texture to set heights to verticles.
I have also normal map, which was generated in LT3D software.
It seems, normal map from LT3d is in tangent space. I tried to convert it into world space by this formula:
float3 normal = NormalTexture.SampleLevel( ss, input.texnorm, 0 ).xyz; normal = float3(0,0,1)*normal.x + float3(1,0,0)*normal.y + float3(0,1,0)*normal.z; normal = normalize(normal * 2 - 1);All terrain normals "shows" green colours mostly .. and that's still wrong.
What i need to get normals working ? I read somewhere in this forum, i don't need tangents and bitangents as terrain is not rotating.
Edited by wh1sp3rik, 11 August 2012 - 02:15 PM.