Jump to content
Sign in to follow this  
Jenni Darkwatch

Basics Q: Quads or tris when modeling?

Recommended Posts


Kwakkelde Kwak wrote:

Ok, educate me here. The behaviour of lighting on this hexagon would be different from one where the lower triangles would be mirrored horizontally, but I really don't see why this is "not so good". When it's flat I see no disadvantage at all to be honest.

If it's flat it won't matter much but in general the polygons would not be flat and then those triagulations in the middle row of Chosen Few's pic produce triangles with less sharp angles (and shorter crease egdes) can give flatter patch and more natural looking reflections. That's why those triangulations are commonly used.

I think (but i dont know) that the polygon triangulation methods wouldn't add vertices so the ones in Chosen Few's pic right column would require manual triangulation.

Kwakkelde Kwak wrote:

LindaB Helendale wrote:

Quads are done the same way, so for quads you could let the mesh uploader do it, but not for any polygon with more than four vertices.

This is just not true. As both Chosen and I said earlier, the way light hits a quad when bent, is affected by the orientation of the triangles within it.

Two quads with the same vertice pulled up, as you can see they are nothing alike.

Yes of course the result depends on the direction the triangulation is done but for quads the only way to do it is to split between  two opposing vertices, so unless you specifically need it done in the other direction (from vertex 1 to 3, not from  0 to 2) the SL uploader does it the same way as any other tools.

I definitely agree that doing it yourself gives better control  than letting the SL mesh uploader do it.

 

 

Share this post


Link to post
Share on other sites

Jenni Darkwatch wrote:

For all intents and purposes the SL shader seems to ignore triangle orientation _if_ the surface is normal mapped. If not, your distinction is of course correct, though in that case I'd thing the edge is intentionally placed by the person modeling it.

Normal mapped? in SL? I'm getting a bit dizzy...

And ignoring triangle orientation? that really would surprise me. Are you saying SL treats both quads I drew the same as far as shade and light go?

Share this post


Link to post
Share on other sites

LindaB Helendale wrote:

If it's flat it won't matter much but in general the polygons would not be flat and then those triagulations in the middle row of Chosen Few's pic produce triangles with less sharp angles (and shorter crease egdes) can give flatter patch and more natural looking reflections. That's why those triangulations are commonly used.


If they are not flat we're not talking about polygons... or are you talking about multiple flat polygons like this resulting in a curved surface?


LindaB Helendale wrote:

Yes of course the result depends on the direction the triangulation is done but for quads the only way to do it is to split between  two opposing vertices, so unless you specifically need it done in the other direction (from vertex 1 to 3, not from  0 to 2) the SL uploader does it the same way as any other tools.

I definitely agree that doing it yourself gives better control  than letting the SL mesh uploader do it.


 

I really don't see the difference between the quad and the other polygons. If you follow the same logic you and Chosen did for the pentagon and hexagon, you could add a vertice in the center of a quad aswell.

Share this post


Link to post
Share on other sites

I always thought that the definition of polygon does not require it to be flat . take 4 vertices and connect them by edges. As long as the edges define a closed path, the polygon is a quad. independent of whether the vertices lay in one plane or not.


Kwakkelde Kwak wrote:

I really don't see the difference between the quad and the other polygons. If you follow the same logic you and Chosen did for the pentagon and hexagon, you could add a vertice in the center of a quad aswell.

I think the goal is to cut all polygons with vertexcount > 3  into an "optimal" set of triangles. I learned that the triangulation in this example is a "fan strip" compared to a "triangle strip" which seems to be the favorised triangluation regarding texturing. I can imagine that fan strips suffer more from texture distrotions than triangle strips. I read about this some time ago but i can no longer find the link to the article. Wikipedia has something about "fan strips" and "triangle strips" ....

Share this post


Link to post
Share on other sites


Kwakkelde Kwak wrote:

Normal mapped? in SL? I'm getting a bit dizzy...

And ignoring triangle orientation? that really would surprise me. Are you saying SL treats both quads I drew the same as far as shade and light go?

I'm not sure I used the term normal mapped correctly. SL definitely does some kind of mapping, to smooth out surfaces. I tried it with a relatively simple example: Create a cylinder with 8 segments, upload it. The edges are hard and quite noticeable, UNLESS you check "Generate Normals" in the uploader. Left image is without checking that box, right is with normals generated at the default 75 degrees. This computer isn't powerful enough to crank up graphics, so I can't tell for sure what kind of shading this enables. It does obviously not add any triangles to the model. Based on the naming of the option I'd guess(!) it automatically generates a normal map. Normal maps included in the collada file seem to be ignored as far as I can tell.Normal Mapped_001.png

Btw, a little testing did actually confirm what others have posted here... letting the uploader auto-generate triangles from ngons is just bad. I've uploaded a rectangular ngon, and the uploader did triangulate it so that the triangles were connected like this:

ngon oddity.jpeg

 

The top "triangles" were essentially a two-dimensional line. Again, based on old knowledge that's not a good thing and a good argument for doing the triangulation or at least quadrangulation by hand before uploading. Of course, things have changed so much that it might just as well be irrelevant with modern GPUs

Edited to add: I realized I made one connection too many in that graphic... sorry. Basic principle remains though.

Share this post


Link to post
Share on other sites


Gaia Clary wrote:

I always thought that the definition of polygon does not require it to be flat . take 4 vertices and connect them by edges. As long as the edges define a closed path, the polygon is a quad. independent of whether the vertices lay in one plane or not.

Looks like both you and I are not done learning then:) As soon as you pull one vertice out of the flat plane you create a new edge, then the shape can't possibly be a polygon. Ofcourse a 3D program will still tell you it's a polygon, but for that program the polygon wasn't a polygon in the first place, but a set of triangles. (which are ofcourse polygons on their own..) In other words, in polymodelling or meshmodelling the only true polygon you use is a triangle.

 


Gaia Clary wrote:

I think the goal is to cut all polygons with vertexcount > 3  into an "optimal" set of triangles. I learned that the triangulation in this example is a "fan strip" compared to a "triangle strip" which seems to be the favorised triangluation regarding texturing. I can imagine that fan strips suffer more from texture distrotions than triangle strips. I read about this some time ago but i can no longer find the link to the article. Wikipedia has something about "fan strips" and "triangle strips" ....

There should be no texture distortion at all with either setup, since we have UV mapping. Both objects are flat, so is the texture.

Still I do not see a difference between a quad with a vertice added to the center and any other polygon with the same treatment. (you were quoting that).

Share this post


Link to post
Share on other sites


Jenni Darkwatch wrote:

Btw, a little testing did actually confirm what others have posted here... letting the uploader auto-generate triangles from ngons is just bad. I've uploaded a rectangular ngon, and the uploader did triangulate it so that the triangles were connected like this:

ngon oddity.jpeg

 

The top "triangles" were essentially a two-dimensional line. Again, based on old knowledge that's not a good thing and a good argument for doing the triangulation or at least quadrangulation by hand before uploading. Of course, things have changed so much that it might just as well be irrelevant with modern GPUs

Edited to add: I realized I made one connection too many in that graphic... sorry. Basic principle remains though.


I've uploaded plenty of quads onto the grid and never have I had any results you describe. It might be a bug in either the model you built, the exporter you use or the SL importer combined with any of these two.

There seems to be something fundamentally wrong with the picture you show. It should have 5 triangles or it can't exist, unless the line is doubled with one line between the outer vertices, but that should be impossible aswell. As far as I've read, two dimensional objects are not recognised by the uploader. (never checked this, but it makes sense)

Either way ofcourse it's good to check the triangulated model before uploading, but in a lot of cases it will simply be wasted work. It depends on the model ofcourse, so if you aren't sure when it's needed, better have a look at all your work.

I am very confused today...quadrangulation by hand?

 

EDIT..forgot about the smooth/normal.... I prefer setting smooth and hard edges by hand rather than by uploader...but I get the "normal map" you mentioned. When I think of a normal map I think of something else...I probably shouldn't:)

Share this post


Link to post
Share on other sites


Kwakkelde Kwak wrote:

If they are not flat we're not talking about polygons... or are you talking about multiple flat polygons like this resulting in a curved surface?

Hopefully we don't get stuck with vague terminology. In math polygons are plane figures, but for example in collada format specifications the term polygon is used for generalized polygon, "Polygon primitives that contain four or more vertices may be non-planar as well." Similarly the LL avatar mesh in (in wavefront obj format) has 638 triangle faces and 3274 faces with four vertices (that some people might call quads) , and very few of them are planar.

Also Maya documentation talks about both planar and non-planar polygons

http://download.autodesk.com/us/maya/2010help/index.html?url=Polygons_overview_Planar_and_nonplanar_polygons.htm,topicNumber=d0e201272

 

I don't know which terminology  we should use but i thought concepts in the collada specs would be more relevant than pure math. 

Share this post


Link to post
Share on other sites

I admit I simplified a little. The actual object was of course fully 3D (largely to test what exactly the uploader does). LindaB's post made me wonder just how smart the uploader really is, so I created a collada file by hand with a text editor to add a few edge cases. The shape was essentially a box, with the top side being a 4x4 quad grid and the sides being ngons (but rectangular in shape) and the bottom then being a regular quad. The idea was to see if the uploader really just uses the 1st point of the ngon and traverses from there. Indeed it does, thus producing the odd result.

Btw, I do passionately despise the term polygon, even if it's used quite frequently even by me. :matte-motes-evil-invert: It simply is too broad for a in-depth discussion of geometric models. Akin to having a non-planar quad... bad karma, it is.

Share this post


Link to post
Share on other sites

Um yes so that means the uploader does a fine job then:)

And YES I despise the term polygon aswell, it's way too confusing... a tri and quad are generally accepted as "building blocks" (yes again confusing), anything over I see as multiple tris or quads...

Share this post


Link to post
Share on other sites


Jenni Darkwatch wrote:

LindaB's post made me wonder just how smart the uploader really is, so I created a collada file by hand with a text editor to add a few edge cases.

 At least the uploader is smart enought to merge duplicate vertices and to remove vertices not referenced in the face list.

 

Share this post


Link to post
Share on other sites

 

Heh, this starts getting fun
:)

Ok, i seem to be talking about  
skew quadrilaterals.
These are Quads in 3D Space. And since i guess that Blender seem to use Skew Quadriliterals all over the place, i might name them Quads where i should name them "sqew quads" with more acuracy.

And i just stumbled over:


Kwakkelde Kwak wrote:

Still I do not see a difference between a quad with a vertice added to the center and any other polygon with the same treatment. (you were quoting that).

Maybe i missunderstood your comment. I was thinking about the different triangulations of a skew Quad:

Top row contains top view of 4 skew quads with different triangulation.

The rows below are just rotations of the skew Quads:

quads.png

When you compare the 2 right most columns, you see they are equal, which demonstrates that Blender's 3D view is aware of how Blender will do the triangulation, which might not be the same as what the SL Importer does.

Share this post


Link to post
Share on other sites

Getting fun? I got the impression I was annoying half the forum users, but I'm glad to hear this...:)

Not sure what you are trying to say with the picture, but the quad in the top left corner should be added to Chosens diagram, that was all I ment. Furtermore, the one on the top right is an impossible one for rendering. I know it can show on your screen like that in a 3D program..well untill you move a vert, then you will (even without a visible line) see you are most definately dealing with two triangles.

Share this post


Link to post
Share on other sites

Well... I wrote that the 2 rightmost columns are equal (i did that in an edit, so maybe it slipped through your attention) and that this equality demonstrates that Blender internally always uses triangles. and it automatically takes a choice which edge it will use for triangulation (BTW You can change this choice if you find "wrong" triangulated spots in your mesh).

So maybe we agree without knowing :)

Share this post


Link to post
Share on other sites

I missed the comment indeed, not the fact the two right columns are the same. One would think the Blender data is converted into collada data is converted into SL data, keeping the triangulation the same way. I do not think Blender "thinks" it's a quad, it just doesn't show the diagonal. I would be very surprised if that quad looked different in SL. Then again, today seems to be the perfect day for that since it's kwak confusion day it seems.

Hmm....someone said something about "polygons" in the DAE....if the DAE stores quads, it SHOULD be possible SL does the triangulation differently....never looked in a DAE file really... Still my guess is the triangulation is the same, makes sense to me the vertex with the lowest number is where all the triangles meet, or originate from...

Share this post


Link to post
Share on other sites

Not necessarily. Today, most renderers are triangles. However, there were some oddball render engines around that could indeed handle ngons, as long as they were flat. I'd suspect some render engines even today can handle ngons too, though I don't know of any non-raytracing ones that do. The old DOS AutoCAD renderer had ngon surface rendering. I wouldn't call it realtime though. :)

Share this post


Link to post
Share on other sites


Kwakkelde Kwak wrote:

I missed the comment indeed, not the fact the two right columns are the same. One would think the Blender data is converted into collada data is converted into SL data, keeping the triangulation the same way. I do not think Blender "thinks" it's a quad, it just doesn't
show
the diagonal. I would be very surprised if that quad looked different in SL. Then again, today seems to be the perfect day for that since it's kwak confusion day it seems.

As long as you tell Blender to do the triangulation, then i also believe that what Blender shows in the 3D view will be exactly what you will get later in SL (regarding triangulation).

But with blender 2.49 you can tell the exporter to export Quads instead of doing the triangulation. In that case the SL importer would need convert the Quads to Triangles by itself. And there i am not sure if it will create the same triangulation as Blender does.

Share this post


Link to post
Share on other sites

I know I mix up 3D software and mathematical lingo, well I use them both, but try to keep them apart really... but as far as rendering goes I only talk SL:) Otherwise we would get even more confusion...nurbs and all the other non polygonal...eh non triangular methods.

Share this post


Link to post
Share on other sites

Yes now that you mention it I have that same option in the collada exporter. Still I'd be surprised if the result was different. (However it won't hurt to tick the box.) This is not the same as triangulating the object yourself to see if you need to change geometry...

Share this post


Link to post
Share on other sites


Kwakkelde Kwak wrote:

Are there really renderers that convert polygons the way they are drawn on the far right? I can see how a shape like that is useful in some cases, but it's no longer a polygon by definition. It's a flat pyramid.

Sorry for any confusion.  I didn't mean to imply the renderer would take it upon itself to add an extra vertex.  It won't.  All I meant was that in the absense of deliberate triangulation, a human conceivably could create a shape like that, including the stray vertex, and think of it as a pentagon or a hexagon or whatever, without realizing that's not actually what it is to the computer.

You're right, by the way, that I somehow overlooked the possibility that a "quad" could similarly be made from four triangles.  I'll add that to the diagram when I get a minute.

 

 

I'll respond to the rest of the thread later.  Lots of good stuff in here!  I'm just a little short on time right now.

Share this post


Link to post
Share on other sites


Kwakkelde Kwak wrote:

Hmm....someone said something about "polygons" in the DAE....if the DAE stores quads, it SHOULD be possible SL does the triangulation differently....never looked in a DAE file really... Still my guess is the triangulation is the same, makes sense to me the vertex with the lowest number is where all the triangles meet, or originate from...

Hmm.. i have no idea how to add xml stuff in this text, it thinks they are html and removes them all... really awfully awkward editor on  this forum :( 

"polylist" means <__polylist__ >  with __ removed in the following.... omg it cant be this hard...   

 

Collada has three basic formats for the polygons; "triangles" contains the list of each triangle vertex indices, and "polygon" where the vertex indices of each polygon are separately listed (and it's not recommended, it takes a lot text in the file, and the most generic "polylist" that i use to save almost all my meshes. Polylist contains a list "vcount" that lists all the polygon orders (for example triangles would be "vcount" 3 3 3 3 3 3 3 ... "/vcount" but any of the polygons can have any number of vertices (and don't need to be planar), and it contains a list "P" that lists the vertex indices + normal indices + uv map vertex indices. As each polylist produces one texture face (=material in blender) the polylists are handy way to save meshes for SL, no need to use materials at all (unless the uploader is changed in future to use the actual material attritbutes instead of the or triangles and polylist blocks to set the texture faces).

My comment on the triangulation of faces with more than 3 vertices was about how the SL uploader triangulates polylists.

Share this post


Link to post
Share on other sites

LindaB Helendale wrote:

My comment on the triangulation of faces with more than 3 vertices was about how the SL uploader triangulates polylists.

Yes I got that:) ... looks like creating triangles is preferred then, before exporting to dae. It probably won't give better results, but it makes life a bit easier for the uploader, since it doesn't have to process as much data.  I think there was some (cough) confusion about triangulating, when in the process and why to begin with. Lots of things to consider, the one you described was certainly one I didn't think of.

You should be able to set the material IDs (which are apparantly grouped in a dae file) without adding an actual material. Just use different channels for the different faces. No idea how it's done in Blender, but I'm sure it's possible. I've never had any real issues with smoothing or grouping or order of materials and I never looked inside a dae to make that happen. (I have for other issues)

Share this post


Link to post
Share on other sites

You can use the "Insert Code" block for XML, like this:

<polylist count="1" material="BottomFace">  <input offset="0" semantic="VERTEX" source="#cube1-0-Vtx"/>  <input offset="1" semantic="NORMAL" source="#cube1-0-Normal"/>  <input offset="2" semantic="TEXCOORD" source="#cube1-0-UV"/>  <vcount>4</vcount>  <p>0 2 22 4 2 29 7 2 6 3 2 1</p></polylist>

 SL's importer seems to be very selective when it comes to collada :) I'd dearly love a good collada format explanation myself btw... I can write very simple geometry files by hand, but really nothing more complicated than that. UV maps? Normal maps? Forget it, haven't got that far yet.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...