I was reading about modelling in Blender and some stuff still unclear to me…
Trying to do a " economic character game " i low down the polygons using only triangles instead of quads. Is this an advantage? OR
Does the game engine “understand” a tria as a quad? (That because the default plan is a quad…) :-?
because if you have polygon with four vertex, it may be problem while graphic card calculate shading. 4vetrex “never” lie out of polygon deformation(deformation slow down computing). 1 of 4 vertex is “always” out of plane with the others vertices.
JM, the only reason blender sometimes lights a plane like that is the normals aren’t facing the right way. Select the face and hit shift-n or ctrl-shift-n to get it pointing the right way to recieve the light.
I prefer quads, they’re easier to work with, and though graphics cards render stuff in triangles, it seems to look better in the game.
jm is refering to something totally different: He’s talking about what I call ‘face flipping’ - a behaviour when the renderer isn’t able to decide how exactly to triangulate a quad.
I prefer quads, they’re easier to work with, and though graphics cards render stuff in triangles, it seems to look better in the game.
No, it doesn’t - it just did not happen to show that ‘face flipping’ because all your quads were flat or unproblematic.
I think that it is good to triangulate the mesh (select all verts, hit ctrl-t) and check the edges to avoid such strange behaviour. And tris are faster because the mesh doesn’t have to be triangulated each frame.
A quad has 4 vertices. If that quad is triangulated, it goes up to 6 vertices. On big models, if you can afford to use quads (mostly flat areas) it saves quite a bit of memory.
Although I don’t think this one small bonus is enough to make you want to use quads over tris in most cases.
If you look at the way python handels vertices there are several variables for each point of each face, 32 in a cube.So switching to triangles may not seem to rais the number of verts but on a deeper level it does, I think that’s what Saluk means.
my conclusion: quads are sometimes easier to work with
tris have more control over the final look
the proformance and memory differences are not important
I said “it seems to look better in the game” because that is my opinion. I mostly try not to use those abnormal quads, but i’ve never had a problem with them. But the above statement is my opinion. You like triangles better, you don’t have to say my opinion is wrong.
That’s only true if you’re using Direct3D, in OpenGL the mesh isn’t triangulated each frame.
OpenGL uses a true quad primitive for rendering. Which makes quads slightly faster than triangles in OpenGL, because fewer vertices have to be sent to the graphics card.
That’s only true if you’re using Direct3D, in OpenGL the mesh isn’t triangulated each frame.
OpenGL uses a true quad primitive for rendering. Which makes quads slightly faster than triangles in OpenGL, because fewer vertices have to be sent to the graphics card.[/quote]
Sorry to disappoint you, wise, but quads are triangulated after the clipping process each frame (internally in OpenGL (which can be done by the graphics card though - most cards are optimized for tris so it depends on the OpenGL implementation and the driver what exactly is done by the GPU or the CPU - e.g. lighting, tesselation, triangulation, etc.)). Even clipped triangles that end up as quads are usually triangulated. The only speed up would be in your own routines (e.g. in a loop) to tell OpenGL the geometry. And it doesn’t really matter much if your list has a count of let’s say 15000 vertices while processing quads or 18000 while processing tris, but now you’ve got around 4000 quads to be triangulated (even if it’s done by the GPU) instead of 100 (all these numbers are just imaginary - they might not be exact ). So the main load may be much higher if you’re using quads.
But Quads are always kinda problematic in 3D because they tend to cause weird effects like lighting problems or some coloring issues, just because GL_QUAD are definined and expected to be planar (like GL_QUAD_STRIP or GL_POLYGON). Now think of a rigged and animated character - you can’t tell anymore if a quad is planar or not. It might be. But most probably it isn’t, what causes really ugly lighting, coloring or just a weird deformation because the quad was triagulated using the wrong diagonal.
But anyway: Quads are easier to handle while modelling or texturing - so there they are preferable. It’s no problem at all: make your models using quads, convert them to tris - but don’t forget to check some edges in some problematic regions because they could be wrong.
And Pooba: I just put some facts against your opinion. If you like wobbling caves or something similiar then it’s ok. Surely nice if you’re creating organic caves in H.R. Giger style. But i doubt that ppl also desire those effects - and trust me: I’ve seen those kind of disturbing problems often - and they were solved just by using triangles instead. So it’s no rare happening - it’s a widespread 3D disease… Search the web if you don’t believe me or just try it out… I’m sure you will know what I mean…
kEinStein: No offense taken, and I hope you don’t take offence if I disagree with you again. I’m talking from personal experience, I ran into the triangles vs. quads thing when I made a program that rendered a landscape from a 128 x 128 heightmap, (that’s 16384 faces.)
Rendering the landscape with GL_QUADS I got 42fps. Unfortunately The landscape had that weird warping problem so common with quads, so I switched to GL_TRIANGLES. With triangles I only got 36fps! Using vertex arrays brought it back up to around 40fps though.
So I stand by what I said earlier. Quads are faster, but triangles have less problems if the face isn’t completely flat, and you’re not going to notice much difference unless you are rendering tens of thousands of faces.
[EDIT] That is, you’re not going to notice much speed difference. Using triangles will still look nicer if rendering polygons that aren’t perfectly flat, (like the landscape example above.)
Why should I be offended? This is a forum open for discussion. And discussion means an exchange of arguments and not offending each other. That’s why I couldn’t resist to post a little bit of sarcasm and irony on Pooba’s reaction…
Well, that’s weird because I observed exactly the opposite with my experiments I have made - even when the face count was “really” high (>10,000). So I’ve stuck to the recommendations to use GL_TRIANGLES or GL_TRIANGLE_STRIP instead of GL_QUADS not only for issues of beauty but also for efficiency. Perhaps it is an effect based on memory usage on your side, the different 3D architecture including drivers or just the way you create the geometry out of a heightmap, I don’t know. I’ve always used static geometry which is not created on the fly. That also may be a reason.
I could probably post a lot of links on this kind of OpenGL stuff (some older and newer stuff) if I can overcome my lazyness and sort the bookmarks…
EDIT:
No, I give it up the search and wait till tomorrow or so - RATM aren’t playing anymore on tv and I don’t like Placebo. So good night, have fun and a Happy New Year for the case that I don’t visit the forum in 2003 anymore!
Other primitives such as polygons and quads are decomposed into triangles before rasterization. OpenGL does not provide controls over how this decomposition is done, so it is best for the application to do it itself.
Okay, I guess quads are triangulated. Although that paragraph mentions the lack of control when using quads, it doesn’t say anything about speed :-?
Curious about the speed difference, I made a quick test in Blender. I duplicated the default plane 2000 times. (In edit mode, so all the planes were part of the same object.) Then I duplicated the scene. In the second scene, I triangulated all the quads. (Since they were all part of the same mesh, I just selected all vertices and pressed Ctrl-T.) After that, I ran the game for a few seconds in each scene with framerate and profile turned on. Both scenes ran at almost exactly the same framerate (17fps.)
here’s the .blend file http://24.161.175.95/BBS/BSS/wiseman/b3d/files/tris_vs_quads.blend
I guess the reason I got slowdown in my program when using triangles, was because of extra overhead from calling glVertex3f, glTexCoord2f, ect. 1.5 times more often than when using quads. Since (IIRC) Blender uses vertex arrays, it doesn’t have that extra function call overhead.
np, it was just a quick google. I really have to put some order in my bookmarks. I know that I’ve got lots of links regarding OpenGL stuff, but it’s all a mess. Probably you know this problem: When I find something interesting I usually just add the bookmark with a keystroke without adding it in the right place.
Okay, I guess quads are triangulated. Although that paragraph mentions the lack of control when using quads, it doesn’t say anything about speed :-?
There are other documents that cover that topic, too. Just have to find them. I promise that I will share the links.
Curious about the speed difference, I made a quick test in Blender. I duplicated the default plane 2000 times. (In edit mode, so all the planes were part of the same object.) Then I duplicated the scene. In the second scene, I triangulated all the quads. (Since they were all part of the same mesh, I just selected all vertices and pressed Ctrl-T.) After that, I ran the game for a few seconds in each scene with framerate and profile turned on. Both scenes ran at almost exactly the same framerate (17fps.)
here’s the .blend file http://24.161.175.95/BBS/BSS/wiseman/b3d/files/tris_vs_quads.blend
Hmm… I’ve got high load on the machine right now, so it’s hard to tell. I get around 18-20 fps with tris and around 16-19 fps with quads. But this might be caused by the other applications (especially seti) in the background. I think I’ll check it when there is not that much running.
I guess the reason I got slowdown in my program when using triangles, was because of extra overhead from calling glVertex3f, glTexCoord2f, ect. 1.5 times more often than when using quads. Since (IIRC) Blender uses vertex arrays, it doesn’t have that extra function call overhead.
Yeah, that might be the reason.
Oh! And Abracsis: Well, I used to like Placebo - not a fan though - but that changed after that concert. All songs just sound the same - kinda boring. Especially early in the morning when you just want to sleep…
does all the quad vs. tri issue has anything to do with the vertex arrays feature in blender ? i too made my own tests to see the effect of triangle strips on preformance and got mixed results with the vertex arrays button on\off - in the end i couldn’t decide if it one of the methods really gives a speed increase. AFAIK, an engine has to support these features from start, and i have no idea if the blender game engine really makes use of triangle strips.