sphere mapping

宰父淳
2023-12-01

# 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
 

 类似资料:

相关阅读

相关文章

相关问答