PDA

View Full Version : Reflections by distance



Dies_Irae
11-26-2001, 05:35 AM
Hi,

Im currently working with the stencil buffert to create a realistic reflections from the environment.

Everything looks cool exept the fact that long (tal) objects in the room, is reflected as powerfull from the buttom to the top.

What i want is to fade the objects reflection some how.

Objects that are near the ground should light up stronger than objects in the roof, etc.


I have absolutly no idea on how this can be done http://www.opengl.org/discussion_boards/ubb/wink.gif I have played around with fog, and other stuff to make it more realistic but
it really doesnt look/feels right.

Thanks in advance

/ Dies_Irae

dorbie
11-26-2001, 06:06 AM
You are describing an effect, but describing it incorrectly. The reason objects further from the reflector reflect less in not distance (light doesn't attenuate like that as you know) it's the angle the reflection makes with the surface. The reflectivity by angle is defined by the 'Fresnel' coefficient for the surface.

That might seem complex, but for a planar surface it is really simple to implement in OpenGL. After you draw the object's reflections you draw a transparent black polygon over the surface where transparency determines the ammount of reflectivity. You vary the transparency as a function of the dot product of the view vector to any given point on a surface, and the surface normal. A direct mapping of transparency like alpha = 1.0 - V.N looks reasonable but you can vary this for other effects.

I do this on the water surface here:
http://www.dorbie.com/bumplogo.html

Here is an image of the effect, it's a little more complex because I also draw the container surface under the water in addition to the reflected room.
http://www.dorbie.com/images/reflect6.jpg

This should give you a feel for what it looks like in an application.


[This message has been edited by dorbie (edited 11-26-2001).]