PDA

View Full Version : Reflections.....



Powerino
02-28-2003, 12:56 AM
hi anyone knows a good solution to make reflection in a scene?
Possible technics are:

(0) Stencil buffer (VERY SLOW if i applied for each polygon in the scene but very accurate)

(1) Cube mapping

In the second case how can i create the 6 faces for the cube? i have to render the scene 6 times (but in this case the point of view what is? (maybe the camera position?!?! but for far object how this works?!?!?)

Anyone has good source code for these problems?

Any other suggestions?

Mazy
02-28-2003, 02:03 AM
Stencil works for planar objects, not good for curved things.

cubemap works best for inconvex objects, but you can get away with a teapot as well ( human brain arent the fastest on checking if multiple reflections are accurat or not) and then you should render 6 views from the center of the reflective object.

M/\dm/\n
02-28-2003, 03:03 AM
That's not an advanced topic, but anyways -> opengl.nutty.org

Humus
02-28-2003, 02:25 PM
For planar reflections you can also use a technique similar to that in my "reflections and refractions" demo. Basically you render everything that's in front of the reflective surface into a 2D texture, but inverted with respect to the surface normal. In the simple case of a reflective water surface at y = 0 that means you render everything above the water but with y inverted into the texture. Then you can use eye-linear texgen to get the right texture coordinates to get the reflection from the texture.
http://esprit.campus.luth.se/~humus/