Archived

This topic is now archived and is closed to further replies.

Kirkbag

A little polygon problem...

Recommended Posts

Hey guys, i have a problem. i''m trying to draw a texture mapped blended box, with a sqaure hole in the middle of each wall. so i used 4 quads for every wall, leaving a hole in the middle, but the polygons don''t connect smoothly... and u can notice it especially while rotating the scene. i''m sure there''s a simple solution for this.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
you could map a texture onto the quads, where in the middle a box is cut out (alpha == 0), so one can see through...

Share this post


Link to post
Share on other sites
What do you mean by "do not connect smoothly" ?
You mean the quares between them, or the holes ?
At best, could you give a screenshot ?

The texture solution might not work depending on the problem. Moreover, it would cost more memory, more gpu time, and would need multitexturing if the cube already have a texture mapped. So, I''d recommend using it as a last resort.

Share this post


Link to post
Share on other sites
Using 4 quads by wall is your mistake. Doing that, some vertices are connected to the border of a quad, while maths used for drawing the poly on screen aren't perfect, the vertices don't stay on the border of the quad.

To avoid this, make your wall using 8 quads like this :
  
|--|--|--|
|@@|@@|@@|
|--|--|--|
|@@|##|@@|
|--|--|--|
|@@|@@|@@|
|--|--|--|


(the @ are textured quads, the # is the whole)

Edited by - Melgo on January 16, 2002 7:01:47 AM

Share this post


Link to post
Share on other sites
Melgo, if you draw :
  
+--------+
|\@@@@@@/|
|@\@@@@/@|
|@@+--+@@|
|@@|##|@@|
|@@|##|@@|
|@@+--+@@|
|@/@@@@\@|
|/@@@@@@\|
+--------+

what''s worse than drawing your set of 8 quads, stp ?

The connection seems to be same (at least, geometrically).

Share this post


Link to post
Share on other sites
I think it works too.

The trick is just to avoid things like this :

  
|--------|
|@@@@@@@@|
|--|--|--|
|@@|##|@@|
|--|--|--|
|@@@@@@@@|
|--------|

or this

|-----|--|
|@@@@@|@@|
|--|--|@@|
|@@|##|@@|
|@@|--|--|
|@@|@@@@@|
|--|-----|


cause the polys won''t stay connected when you''ll translate, rotate or scale the scene.

Sorry if you don''t understand all, i read english a lot better than i write (that''s why i draw littles pictures in ascii)...

Share this post


Link to post
Share on other sites