ASTC for normal maps

心不动则不痛 提交于 2019-12-11 15:45:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!