What's the formula for B3D Sphere mapping?

Blitz3D Forums/Blitz3D Programming/What's the formula for B3D Sphere mapping?

Gabriel(Posted 2006) [#1]
Hi,

Just trying to emulate B3D-style sphere mapping in a pixel shader, and not really sure how to do it. On GameDev, I found this :

U = N.x * (width / 2) + ((width / 2) - 1)
V = N.y * (height / 2) + ((height / 2) - 1)


But that doesn't take into account the camera position, so I'm not sure if that's right anyway. Is that right, but just missing a transform into camera space? Or is it done differently?


EDIT: Damn, this isn't Blitz3D Programming. Sorry, please move.