问题
I am trying to compress my normal map textures, so I am using ASTC 4x4.
It works completely good for other textures (aka diffuse), but quality lost for normal maps were too big.
Is there a way to improve ASTCs quality directly for Normal Maps ?
I have tried to use -normal-psnr flag, but it makes my texture greyed (instead of normal blue)
ASTC normal map:
PNG normal map:
回答1:
Compressing normal maps using a normal mode in the reference encoder stores normal maps as X+Y maps. X is stored in the R channel (and duplicated in G and B) and Y is stored in the A channel, which is why it looks grey. You need to reconstruct Z in the shader; based on the fact that the full normal should be unit length you don't need to store it which gives the compressor a lot more bits to play with to boost quality.
vec3 normal;
normal.xy = texture(sampler, uv).ra;
normal.z = sqrt(1 - dot(normal.xy, normal.xy));
I tend to find normals look OK with 5x5 blocks (5.12bpp), but much lower bitrate than that starts to hit quality problems.
来源:https://stackoverflow.com/questions/51916805/astc-for-normal-maps