Reflection effect

Hi all,

I’m new to OpenGL. I have a building model. And all windows on model need to be more realistic. First of all, i would like to implement reflection effect. I made some research on this issue and got confused :).
Can anybody suggest me what technique to use to achive reflection effects on building windows.

Thanks in advance…

Presumably you will have more than one building. Simulating more than one set of ‘true’ reflections is not a trivial matter. For example, have you considered the case of a second building reflecting the first building and visa-versa. How many levels of inter-reflection should happen?
You also have not indicated just how accurate these reflections should be?
Most games simply do not bother with true reflections for this kind of thing as it’s too complex in this general case which your describing. The answer is to cheat!
The best and simplest way to cheat is to use a cube map for reflection. This is nice and fast and you could have many of these scene reflection maps scattered throughout your level/scene. Your objects could then just ‘select the nearest environment map’ and use that as its source of reflection.

Old stencil reflection is still good if your reflection happens only on a plane.

Check this:

Yes planar refelections will give you an accurate reflection - at the cost of re-rendering your scene.
How you go about multiple planar refelctions for each building, or sides of a building is another matter!
Hence my suggestion of environment cube mapping.

Thanks for reply.

How should i organize environment cube maps in case if i have a city model and when all windows on buildings should be with reflection effect?

Start by having just 1 set of cube maps and get that applied to each window.
Are you using shaders - because this sort of thing is trivial with shaders and not so easy with fixed function rendering.
I suggest a Google search on cube mapping - nVidia developer web site has some basic example if I recall.
You first need to know how to load the 6 face images and create a cube map texture. Then you need to know how to render a cube map. After that, you’ll need to combine the glass texture of your building(s) with the cube map.
Easy via shaders…

Well, then i’ll keep learning…

Thank you…