PDA

View Full Version : opengl clipplane



GameMaker
04-15-2002, 05:40 PM
Does anybody know if the opengl clip plane stuff is done in hardware on most cards? Is it fully supported on all platforms?

How much of a hit do I take if I have a high poly model that is clipped by this clip plane? Should I try to do some checks myself before drawing each poly or should I just throw all the polys at the card and let opengl do its thing?

billy
04-16-2002, 12:07 AM
Hi,

That is an interesting question.
I think you mean that you could calculate which polys are being clipped and therefore not send them to OpenGL.
I don't think that most programs do this kind of optimisation. I don't even know if it would be an optimisation, but I will try this myself.

Devulon
04-16-2002, 02:24 AM
In general Gamemaker I usually clip objects, whole objects from opengl. Using a simple bounding volume (sphere or box). And more details clipping such as individual polygons or even parts of individual polygons I let the card handle.

This is just a general rule of thumb. You really don't want to start telling the card what to do. But at the same time you want to give it little hints now and again.

Happy Coding.

Devulon

GameMaker
04-17-2002, 07:06 AM
Is there a way to get the clipped (directly on the clip plane) polygons from opengl after the clip process?

davepermen
04-17-2002, 09:19 AM
it doesn't clip them geometrically.. it just renders the poligon and for every pixel it checks if this pixel is in front or behind the clipplane (simple dotproduct). if so, it will be rejected..
its grafical csg, not mathematical.. like intersecting shadow-volumes with the geometry.. you never intersect them but just check perpixel what is more near..

so no way to get it back..

ehart
04-17-2002, 11:17 AM
Careful, the geometric versus per-pixel clipping is an implementation specific detail. A great number of implementations do not perform raster based clipping. Radeon cards always perform geometric clipping. Depending on your bottleneck and the individual implementation, geometric or raster based clipping may be faster.

To answer the original question, clip planes do have a cost. The cost is completely implementation dependent. On Radeon cards, you pay an approximately linear hit on geometry processing for each plane you turn on. They really aren't that expensive, and are essentially free if you are fill limited. Note that they typically are much cheaper than attempting to kill on a per-pixel basis to do the clipping on Radeons.

-Evan

davepermen
04-17-2002, 12:08 PM
well ok.. so on radeons its geometrical clipping but on geforces as far as i know its fragment-clipping.. at least, u loose texture-stages if u enable them..