Skip to main content
GameDev.net gamedev.net
🔒 Locked

Cubemap generation

Started by pasman Feb 16, 2005 at 5:12 PM 5 replies 1.2k views
Original Post
pasman
pasman
hi, I know this might be a stupid question but here goes... I want to add reflections to my scene, for now to the water. If I'm not mistaking this can be done using cubemaps and shaders. For their generation I have to render the scene 6 times, for each face of the cube. Is this approach common in games (I belive Morrowind uses this approach for water). Are there some things I need to know before starting implementing this (regarding performance) beside the fact that I don't need to generate them every frame. I'm using OpenGL and CG for shading. Should I use other methods for water reflection? Thank you.
poly-gone
poly-gone
Since the reflections will be distorted, you can get away with a fairly small cubemap. Since it's generated almost every frame, this will help save some fillrate.

The best method for rendering water is by using planar reflection and refraction maps. There's an article here on GameDev by Yann that describes the technique in fair detail. You might want to check that.
silvermace
silvermace
using 6 PBuffers that share their OpenGL names (wglShareLists) you should be able to render on each pbuffer with the camera @ current position and only changing the look at vector to up(0,1,0) left(1,0,0) etc etc.

once you've rendered the scene, using WGL_ARB_render_texture bind the appropriate PBuffer to the matching side of the cube-map, and hey-presto.

not too hard, just a paint to setup.
poly-gone
poly-gone
Quote:
Also, are there any games using this method, does it worth to implement (and to get good performance results) or should I stick to planar reflections?

It depends. The planar reflection method for rendering water is pretty "texture" intensive, especially since you need atleast 2 fetches of a bump map, a reflection and refraction map and a couple of more textures depending upon the "detail" you want to achieve. Besides, the shading calculations are definately more complex than the general cube-map method. You might want to try both and see how things go.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.