sphere mapping

本文介绍了一种将球面坐标映射到纹理坐标的方法,该方法可用于压缩normal信息,将其从3通道减少到2通道,同时保持良好的信噪比。通过计算反射向量并映射到纹理坐标系中,此技术特别适用于图形渲染和游戏开发。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

# what is it
- 一种映射球面坐标到tex2d坐标的方法
- 也可以用来encode normal(3channel->2channel)

# 算法
- u is a uniti vector(0,0,1) pointing from "point on sphere surface" to some where
- n is normal vector(pass sphere origin and point on the sphere)
- r is reflection vector of u, r = u - 2n nT u
- m = is the length of r + u, m = 2 * sqrt(pow(rx, 2) + pow(ry, 2) + pow(rz + 1, 2))
- s = rx / m + 0.5
- t = ry / m + 0.5
- 说白了得到的uv就是((0,0,1)通过n反射过的)reflection vector的x和y坐标,入射方向定死在(0,0,1)是在z方向上的
- 为啥要搞得这么麻烦,不直接用n呢?感觉是因为这样映射后,在靠近(0,0,1)的方向上留了更多的贴图空间,而在边缘部分dot((0,0,1), v)的值接近0的部分

# reference
- 似乎是种不错的压缩normal的方式(从3通道变成2通道,而且信噪比不错)https://aras-p.info/texts/CompactNormalStorage.html
- 如何从球面向量(n)算出spheremap上的坐标(s, t) https://blog.youkuaiyun.com/huangzhipeng/article/details/7957963
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值