• 13
• 18
• 19
• 27
• 9

# Environment Mapping - top end.

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

## Recommended Posts

I'm planning to learn environment mapping, but I just google it and I got many different ways of doing it: Cube maps, spherical coordinates, etc. So... I was wondering what method(algorithm) is used in todays top-end video cards to do environment mapping? Thanks a lot. ps. Any link will put a big smile in my face :)

##### Share on other sites
Cubemaps, dual paraboloid maps, spherical maps - they're all using the same principle, just different encodings.

The easiest, most widely used, and best in terms of visual quality, is cubemapping.

PS: oh yeah, the link [wink]

##### Share on other sites
Quote:
 Original post by Yann LCubemaps, dual paraboloid maps, spherical maps - they're all using the same principle, just different encodings.The easiest, most widely used, and best in terms of visual quality, is cubemapping.PS: oh yeah, the link [wink]

Great Thanks a lot.

WOW, I know this forum is fast, but 5 minutes for an answer! WOW.

Thanks again Yann L.

I'll just get working hahah.

BTW, Yes, Im smiling now.

PS> any other link or comment is welcome.

:)

##### Share on other sites
Cube maps are great for static environments but I would suggest dual paraboloid maps if you plan to have real-time reflections of the surrounding, for the simple fact that they need less rendering passes.

Here is a link to a demo I found

##### Share on other sites
Quote:
 Original post by AxoDosSCube maps are great for static environments but I would suggest dual paraboloid maps if you plan to have real-time reflections of the surrounding, for the simple fact that they need less rendering passes.

I would actually not suggest dual paraboloid maps for dynamic reflections. Although cubemaps require six faces to be updated, straight world lines stay straight lines within the cube projection. DP maps, however, will transform your environment into a paraboloid coordinate system, where straight lines become curved. The problem with that is, that your scene/level needs to be highly tesselated (ie. needs to have a lot of redundant faces) in order to avoid serious visual artifacts. This problem does not exist with cubemaps.

DP maps used to be the only possible way to do shadowmapping on point lights, before the availability of pixel shaders. Now, even for this special application, cubemaps are to be preferred over DP maps.

##### Share on other sites
Sorry to high-jack the thread - but I just wanted to ask Yann L a question about using cubemaps for shadowmaps on pointlights:

Are you saying that cubemaps are better than DP maps for this case, even though you have to do 3 times the work? Is performance not a problem here?

Thanks!

##### Share on other sites
Quote:
 Original post by Yann LI would actually not suggest dual paraboloid maps for dynamic reflections. Although cubemaps require six faces to be updated, straight world lines stay straight lines within the cube projection. DP maps, however, will transform your environment into a paraboloid coordinate system, where straight lines become curved. The problem with that is, that your scene/level needs to be highly tesselated (ie. needs to have a lot of redundant faces) in order to avoid serious visual artifacts. This problem does not exist with cubemaps.

You are correct about the scene need to be highly tesselated but could I not get away with it for some special cases maybe like for example I would have a model of a monster or something in the scene. The monster model is probably tesselated to the extent that it would look ok on the DP map? Besides my monster model would probably not cover such a large portion of the DP map for a person to notice the errors?

##### Share on other sites
Quote:
 Original post by JimfingSorry to high-jack the thread - ...Thanks!

No problem! :)

##### Share on other sites
Quote:
 Original post by JimfingAre you saying that cubemaps are better than DP maps for this case, even though you have to do 3 times the work? Is performance not a problem here?

It depends on your scene and how often you update the maps, obviously. Cubemaps are better in terms of quality. Of course, they require 6 sides to be updated, if your object (environment mapping) or lightsource (shadowmapping) moves. OTOH, generating a shadowmap cubemap is very lightweight on fillrate, ie. you can disable everything except the fragment depth.

Here is a short DP vs. cubemap list, generally valid for both reflective environment mapping and shadowmapping:

Cubemaps:
* directly supported by the hardware, uses only one single texture unit
* Fast and euclidean projection (ie. straight lines stay straight, no visual artifacts)
* Continuous sampling space (ie. all regions are sampled at approximately the same resolution)
* No overlapping regions or connective seams (such as with DP maps), no additional separation logic required
* much easier to implement than DP maps

DP maps:
* only two maps to update, instead of six
* take slightly less memory than a cubemap of the same quality
* works on hardware without native cubemap support

Quote:
 You are correct about the scene need to be highly tesselated but could I not get away with it for some special cases maybe like for example I would have a model of a monster or something in the scene.

Well, sure, if your environment is highly tesselated anyway, then they're OK. But be careful with your monster example: not the reflective object needs high tesselation, but the reflected object(s). In this case, as well as in the case of shadowmapping, that would be the entire scene or level.

##### Share on other sites
Well its me again. :)

Let see, so the best way to go is using cube maps. Right?
Now, I know its posible to load cube maps to the fragment shader, but what next?
For example in GLSL I have the function:
textureCube(samplerCube sampler, vec3 coord);
But what should I use for the 3D Coord vector (==vec3 coord)?

Thanks.