How sphere environment mapping is calculationg?


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?

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.

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.

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.