PDA

View Full Version : Polygon with a hole

NOAH IV
01-17-2001, 02:53 AM
I would like to draw a polygon over an environment and then I would be able to see the scene just through a hole in this polygon. For exemple:

****************** ******************
&#0124; &#0124;&#0124; &#0124;&#0124; &#0124;&#0124; &#0124; + **** **** = ****&#0124; &#0124;| ****
&#0124; &#0124;&#0124; &#0124;&#0124; &#0124;&#0124; &#0124; ** ** **&#0124; &#0124;&#0124; &#0124;&#0124; &#0124;| **
**** **** **** ****
****************** ******************
scene cloudy polygon we just can see
with a hole part of the scene

Any ideias about how to make hole in a polygon?

NOAH IV
01-17-2001, 02:56 AM
Arghh!!!

What happened to my ilustration??
It does not accept "spaces"!

Kilam Malik
01-17-2001, 03:12 AM
1) You can draw the poly completely by yourself, which means you are free to bould it up of triangles.

2) You could use polygon tesselation (search for tesselation in the docu).

But if you know how the poly is shaped, build it up on your own as fixed code.

Kilam.

NOAH IV
01-17-2001, 03:30 AM
The polygon should be a QUAD and the hole a circunference.
Is there any way to subtract shapes? I mean, take a quad and subtract a circle... than the problem would be over.

Dodger
01-17-2001, 06:23 AM
If you want the subtraction, the hole in the polygon, to be static, then the best solution is, to build the whole thing including the hole, out of triangles.
If it's supposed to be dynamic (the position of the hole in the quad changes), you have 2 possibilities:
1. compute the geometry of the polygon with the hole at the current position for every frame
2. use the stencil buffer (draw the circle into the stencil buffer, then draw the quad everywhere where the stencil buffer is empty)

Michael Steinberg
01-17-2001, 07:37 AM
Sounds like shooting holes... Maybe use a 1 alpha bit texture (ie: transparent of not)? That wouldn't be very fast though (since you don't know which faces are behind it and would have to draw all). Maybe add little portals... Okay, sounds slow as well.