# Enviromental Mapping

This topic is 5055 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Uh I thought that if I do Sphere mapping Ill do just that, but no I gotta unrotate the texture matrix, so that it shows whats on the other side. Sphere Mapping its almost like eye linear, the texture keeps "looking" at you. Any quick answers ? :D

##### Share on other sites
What are you talking about.
For enviroment mapping, you take the eye to vertex vector and reflect it with the vertex normal.
then you convert that resulting vector to a uv cordinate(either trough cubemapping or sheremapping).
then render the enviroment texture with those uv coordinates over the previously renderd geometry.

##### Share on other sites
What he is refering to is the facet of Cube Mapping that makes the cube map "world-aligned" by setting the rotation values of the texture matrix to those of the inverse of the modelview matrix. this works for a cool linear algebra rules that I wont get into here. However, because sphere map coordinate generation uses a stranger method to apply its environment mapping, you CAN NOT use this technique to encode world wrappable environment maps on sphere map texture generation. In order to support cube mapping style functionality on hardware that does not support it, you need to either precompute the tex coordinates, compute it yourself with a custom cubemapping implementation, or make your environment maps non-dynamic...at least those are the only solutions I have come up with...maybe there are others...google might offer some solutions

##### Share on other sites
Sorry for being late :D

Well imagine you have a texture that when mapped to a sphere(no cubemap) it represents the skybox, thats what I get from 3DS Max when I export the image with the panoramic renderer. So... I got this texture Sphere Mapped onto an object, I must rotate it based on Camera Position so it shows exactly the oposite of the side Im looking from right ? so the texture matrix must be rotated some way right ? I tryed some implementation, but the rotation works for only 90 degrees or so, not entirely 360...

##### Share on other sites
You are absolutly correct about the necessity to change the texture matrix to remap the environment map with the camera...unfortunatly, like I said before, you can only do that with a coordinate system that is manipulatable by a matrix (i.e. uses LINEAR transformations) . Like I said before, spheremapping is nonlinear, and to my knowledge therefore simple manipulations with the texture matrix are not enough to solve this problem. There is an nVida extention called texgen_reflection that is supposed to help with this, but I think it would be a LOT easier just to use cubemaps to store your environment maps, which are really simple to code and are LINEAR. To find out a better idea of what I am talking about, go to Environment Map explanation + cubemap tutorial

good luck

##### Share on other sites
Aha... well I Guess Ill have to add that kind of implementation to my engine so... Ill comment more when Ill have it done :D

1. 1
Rutin
25
2. 2
3. 3
4. 4
5. 5

• 10
• 9
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633309
• Total Posts
3011301
• ### Who's Online (See full list)

There are no registered users currently online

×