View Full Version : How sphere environment mapping is calculationg?

11-25-2003, 09:48 PM

Sorry for stupid question but recently I palyed with sphere environment mapping and found out some interesting effects.

So the question is: How sphere environment mapping is caclulating? Do I need vertex normals at the object where I would like to apply env.mapping?

11-25-2003, 10:43 PM
Reflect the view vector about the normal, add the z axis (+1 to v.z), normalise. Your texture coordinates are then:

u = v.x * 0.5 + 0.5
v = v.y * 0.5 + 0.5

Obviously, this is all in eye space.

11-25-2003, 11:01 PM
At what point are texture matrices applied in this process?

I've never been able to get anything useful to happen when I try to apply a texture matrix to an environment map. It always ended up as garbage.

Brian Paul
11-26-2003, 05:34 AM
The texture matrix is applied after texgen so trying to rotate a conventional spherical reflection map isn't going to work.

Texcoord rotation with a texture cube map would work fine though.