Jump to content
The Dark Mod Forums

Long thin triangles


SteveL

Recommended Posts

In another thread:

The only concrete tip I can offer is that GPU's hate "long thin triangles" and shaders that call textures too many times.

 

The advice on long thin triangles is often mentioned, but I always have the same question in mind when I read it: how best to triangulate a long thin surface?

 

Easy enough to understand that for two triangles that have the same area, the graphics card will do better on an equilateral one than a long one. But usually the choice you're faced with is between two long triangles and twenty or so equilateral ones, like in the common case when you have to triangulate a long thin rectangle like the edge of a wall. What's better then?

Link to comment
Share on other sites

I'd say it depends on what you want to do. For a photorealistic render go fo the equilateral ones as you don't care for the polygon count. For a game, if I take these numbers as is I'd still go for twenty equilateral ones. Eighteen polygons are not something you should worry about. But if this is a mesh that appears several times in the rendered cell and those eighteen polygons become like 5-6k then there's a big difference in which you'll have to decide in favor of performance or visuals (keep in mind that twenty equilateral ones can be UVed much, much easier and textured as such).

 

And that's for DR in the way I understand it.

Sometimes I want to scream

So long that life escapes

And then I'd shut my eyes

I'd be the angel of disgrace

Link to comment
Share on other sites

There probably is a mis-understanding here what long-thin triangle means. A triangle which is already long and thin, or one that appears long and thin on the screen. The latter can happen even if you view a triangle from a steep angle. Plus, "long" is rather relative. :)

 

Also, the size of a triangle matters if one triangle is hit by two lights. The tri in idTech4 is then rendered twice (for each light). If you cut it up in two tris, each tri is rendered once (for each light).

 

So, basically, avoid overly large (or overly long) triangles (beyond a few hundred/thousand units). But don't chop them up in 20 tris, because replacing them with twenty equilateral ones will not really help - it increases the triangle count, the edge count (and thus shader costs).

 

This article discusses a few topics:

 

http://www.andythoma...timization.html

 

See also: http://www.g-truc.net/post-0662.html

 

 

This might also be something we want to add to the engine in the future:

 

http://w3.impa.br/~d...SanNehBar07.ppt

 

While googling for the paper which explained the high overdraw due to small triangles (which I did not find again, sadly), I came across this:

 

http://wiki.thedarkm...tial_Must-Knows :D

Edited by Tels

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Alright I shut up :P

I didn't think of view angle I just thought about the big polygons, in which case I'd still prefer to retopo them even with higher polycount.You may have a point about shader costs but for vertices/edges/polys count it shouldn't be any problem if you get a couple dozen more of each. Unless you reuse it several times throughout the cell. Shaders might be a problem tho'.

 

Now I go back to try and do basic operations in DR and stop missreading posts way above my DR understanding :)

Sometimes I want to scream

So long that life escapes

And then I'd shut my eyes

I'd be the angel of disgrace

Link to comment
Share on other sites

Hah, found it at least:

 

http://graphics.stanford.edu/papers/fragmerging/shade_sig10.pdf

 

This shows the effect of very small triangles (and why LOD models for far-away detailed mehses like our AI models are so important).

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Cheers. The take away message I saw in that paper was, reduce the account of triangle edge in view where you make a decision. Borders and small tris and two edges close together cause wasteful shading. It wouldn't have occurred to me either that a triangle seen edge on is equivalent to a long thin triangle, but it makes sense from the point of view of that problem at least.

Link to comment
Share on other sites

Yeah, I only knew of Humus's work on this:

 

http://www.humus.name/index.php?page=Comments&ID=228

 

which I linked in our Optimization wiki.

 

I don't know if dmap optimizes for "max area" triangulation but I believe it I've seen fan style triangulation in screens

for func_statics, thus models would have that advantage in optimization.

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

I think of it like playing with triangle slivers is rolling the dice, so they shouldn't be unnecessarily or gratuitously made when they don't have to be -- like using the subtract tool when you can use the cut tool to do the same job. You should make them very consciously, for a specific reasonable thing that has no other way to make it, when you think the benefit is worth the cost, and you're ready to spend time fixing up any problems that might pop up.

 

It's not a hard rule you can never break, I think, just a rule of thumb people have learned from hard experience that will save a lot of avoidable pain in the long run.

  • Like 1

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
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.

  • Recent Status Updates

    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 2 replies
    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 7 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
×
×
  • Create New...