What's the formula for B3D Sphere mapping?

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

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

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.