sphere mapping

# 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.csdn.net/huangzhipeng/article/details/7957963
 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值