View Full Version : Refelctions without a stencil buffer
Can anyone give me info on real time reflections without a stencil buffer? I know it can be done.. and fast, I just dont know how.. Unreal, with their OpenGL drivers does quite a nice job and my card doesnt have a stencil buffer (at least I cant find one if it does http://www.opengl.org/discussion_boards/ubb/smile.gif
09-24-2000, 02:53 PM
To do this you need to take the polygon of the reflective surface and the viewpoint and form a frustum. Then you need to reflect every object across the plane of the reflecting surface, and then manually (ie: on the CPU, in your code) clip each polygon to this frustum. It works, Ive actually done it in my engine (which is a zero overdraw portal engine). However, the manual clipping is actually quite slow, so using this technique can limit your max acceptable poly count quite a bit.
It is really recommended to use a stencil buffer for the clipping. If you must do the reflections without a stencil buffer, then there is one optimization on the above scenario you can make. Instead of mirroring each object across the mirror plane (ie: transforming each vertex), you can reflect the viewpoint once and then use the verticies as is. This will save a lot of calculation.
The code is actually quite complex, so hopefully just the theory is good enough for you. If not, maybe someone can recommend a tutorial the includes code.
Hehe, that helps demystify the idea http://www.opengl.org/discussion_boards/ubb/smile.gif A tutorial would be great though. At least one to calculate the viewing volume. I'll start trying to figure it out though.. Thank you http://www.opengl.org/discussion_boards/ubb/smile.gif
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.