normalMap的DDS压缩

关于normal map的dds压缩,有一张图可以说明问题:


可以注意到普通的dtx5压缩后,那些颗粒的光照细节丢失得比较厉害,同时栅格现象也很严重。

同时可以看到DXT5_NM在相同文件大小的情况下,细节保存得不错。

 

使用Swizzled DXT5格式:基本上还是DXT5格式,但是把X值放到A,把Y值放到G,R/B channel可忽略,理由是DXT5压缩特性使得A/G channel压缩品质比较高。品质会比直接把DXT5存XYZ的方式好很多。

使用3Dc:目前只有AMD(ATI)的GPU支援。效果应该比Swizzled DXT5好。(由于手边沒有ATI的卡,所以无从比较)

 

The DXT1 compressed normal map on the right shows noticeable
blocking artifacts compared to the original normal map on the left.

 

The DXT5 compressed normal map on the right
compared to the original normal map on the left.


The DXT5 compressed normal map with re-normalization on
the right compared to the original normal map on the left.

 

此时引入关键字:3Dc dxt5_nm swizzle

我在D3D里没看到有对DXT5_NM的直接支持,在使用nvtt生成dxt5_nm格式的normalMap,因为xy=ag,r=1,所以颜色是桔黄的。

 


shader中作相应处理

float3 fvNormal;
fvNormal.xy 
=  (tex2D( normalMap, texCoord ).ag  *   2.0f   -   1.0f );
fvNormal.z  =  sqrt( 1.0  -  dot(fvNormal.xy, fvNormal.xy));


渲染效果 

 

链接:

http://codefield.blogspot.com/2007/04/normal-map_6771.html 

http://www.ozone3d.net/tutorials/bump_map_compression_p3.php#z_generation 

http://code.google.com/p/nvidia-texture-tools/wiki/NormalMapCompression 

http://developer.nvidia.com/object/real-time-normal-map-dxt-compression.html 

转载于:https://www.cnblogs.com/oiramario/archive/2011/03/18/1988351.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值