I want to try DXT5 format for my normal maps to save some memory, but i have ugly artifacts showing and i was wandering is this to be expected with this compression or am i doing something wrong?
Saving my "normal" normal map in photoshop as DXT5:
and used info from here to reconstruct Z, so my pixel shader looks like this:
#pragma pack_matrix(row_major)
...
#if 1 // normal bumpmap
float3 bump = txBump.Sample(samLinear, IN.TexCoord).xyz * 2.0f - 1.0f;
#else // dxt5
float3 bump = txBump.Sample(samLinear, IN.TexCoord).wyy * 2.0f - 1.0f;
bump.z = sqrt(1 - saturate(dot(bump.xy, bump.xy)));
#endif
float3x3 tangentBasis = float3x3(normalize(IN.TangentW), normalize(IN.BinormalW), normalize(IN.NormalW));
float3 n = normalize(mul(bump.xyz, tangentBasis));
...
Output with DXT5 (notice artifacts):
and with "normal" normal map (no artifacts):