Original Post
I know this has been asked and beaten to death but I saw this a couple of months ago and I don't know where and hoping some one can fill in the blanks for me. So the standard way to "compress normal maps" using DXT5 is to use the Green and Alpha channels and compute the z. What I remember seeing is a way to use a partial derivative if that is what I remember. So you store -Nx/Nz and -Ny/Nz. What this accomplishes is the previous shader code looks like this, half3 norm = tex2D(NormalSampler, IN.TexCoord.xy).agb; norm.xy = 2.f* (norm.xy - .5f); norm.z = sqrt(1.0f - norm.x*norm.x - norm.y*norm.y); norm = normalize(norm); with the derivatives it would look like this half3 norm = half3(-tex2D(NormalSampler, IN.TexCoord.xy).ag,1); norm = normalize(norm); So basically X,Y,Z become X/Z, Y/Z, Z/Z = X/Z,Y/Z,1 which can be normalized back to the original vector. This reduces the number of instructions in the shader. I found some of this described in the following site http://www.gamasutra.com/features/20030903/crespo_02.shtml but what Im missing is what happens to values where Nx is larger than Nz, my assumption was that for most maps, Nx and Ny were less than Nz and I map the result of 0 - 1 to 0 to 255, but this doesn't work in this case. Second benefit is I can add multiple Normal maps directly and and then normalize at the end half3 norm1 = half3(-tex2D(NormalSampler1, IN.TexCoord1.xy).ag,1); half3 norm2 = half3(-tex2D(NormalSampler2, IN.TexCoord2.xy).ag,1); half3 norm = normalize(norm1 + norm2); Thoughts? Anyone know what I am talking about, why are the values neg? Is there anything I am missing?