Home Technical Talk

Game Dev and n - gons

polycounter lvl 10
Offline / Send Message
3dcaspar polycounter lvl 10
Hi there!

So I recently started working at a game company and now I have a question regarding n-gons in terms of game development.
During school time I learned from several industry professionals, that one should try to only work with tri's or poly's but should try to avoid any kind of n-gon.

Right now a co-worker said I should use n-gons instead of polys/tris whenever I can.

I always thaugt, the game engine itself would triangulate the model so or so, so modelling in polys and tris gives me more control.

As you can see in the picture, I should do it like the right hand side example... I personally would do it like on the left hand side.

4UX1HFj.jpg

What do you think? Please let me know.

THANKS! ;)

Replies

  • respawnrt
    Offline / Send Message
    respawnrt polycounter lvl 8
    You lose tris if you let the engine triangulate circles like that, fact :p count the tris.
    VxxovV9.png
  • Farfarer
    Offline / Send Message
    Farfarer polycounter lvl 17
    I'd avoid ngons as much as possible - they can cause some pretty painful issues if the winding order gets upset at all. Leave 'em in as you make it, but I always remove them before I call something finished or pass it on to someone else.

    You're best triangulating things with max-area method (make the biggest, most evenly shaped triangle you can, then continue on with the smaller ngons left until no ngons remain) as that's friendliest on the fill-rate.

    (For high poly stuff, that's not going in-game, it's not usually such a big issue.)

    See: http://www.humus.name/index.php?page=News&ID=228
  • Volantk
    Offline / Send Message
    Volantk polycounter lvl 11
    It is as you say - they're all triangles in the end, no matter what you do, so why not do it in a way that gives you full control over what's happening.

    N-Gons can be a timesaver while modeling, but when you're finalizing your mesh for export, the more triangles you have, the more accurate that representation of the mesh is, compared to what you see in-game. Even quads can be divided the wrong way by the exporter, leading to all kinds of silhouette and shading problems.

    When it comes to high poly modeling, quads are prefered, as they subdivide nicest, but tris and even N-Gons can be used if you know what you're doing.

    To sum it up, there are no hard rules here, but tris and quads are always a safe bet.
  • WarrenM
    respawnrt wrote: »
    You lose tris if you let the engine triangulate circles like that, fact :p count the tris.
    VxxovV9.png
    Which engine would add a vert to the center of the N-gon like that? That seems like a really bad idea, modifying meshes as they are imported.

    I imagine most would turn the n-gon into a fan, which would result in the same 4 triangles.
  • 3dcaspar
    Offline / Send Message
    3dcaspar polycounter lvl 10
    Hey and thanks for your replies! ;)

    So what I learned is actually right, good to hear that.
    I think I will just carry on the way I did before (use tris and quads), so this way I have the most control of the actual edge flow.

    But I will for sure consider the max-area method ;) sounds good to me.

    Again, thank you all for the replies and advice!
  • WarrenM
    Remember that n-gons are fine if they are:

    - in areas that don't need to deform
    - not in areas that affect subdivision (aka flat areas)

    Just like poles, they can be left in a model if used with care.
  • Farfarer
    Offline / Send Message
    Farfarer polycounter lvl 17
    Eh, I'd disagree. I'd just avoid them entirely.

    The amount of issues they can (and do) cause really isn't worth the few seconds it takes to just split 'em up into quads and tris.
  • respawnrt
    Offline / Send Message
    respawnrt polycounter lvl 8
    WarrenM wrote: »
    Which engine would add a vert to the center of the N-gon like that? That seems like a really bad idea, modifying meshes as they are imported.

    I imagine most would turn the n-gon into a fan, which would result in the same 4 triangles.
    Right, i'm an idiot i meant to not triangulate like that, as i've some people doing that :)
  • JohnnyRaptor
    Offline / Send Message
    JohnnyRaptor polycounter lvl 15
    dont forget, if you calculate your normalmaps with one set of triangle stripes, and then let the engine triangulate, the triangle stripes may be different and you will get smoothing errors.
  • dpadam450
    Offline / Send Message
    dpadam450 polycounter lvl 12
    Just fyi - there is no such thing as n-gons. In your image on the right, your modeling application has simply decided to not draw edges for faces that are co-linear (share the same flat 3d plane). Those are all triangles, everything always is, they are just hiding the triangle edges.
  • Farfarer
    Offline / Send Message
    Farfarer polycounter lvl 17
    Usually only as far as the renderer is concerned.

    The 3D application itself likely holds it as a polygon with >4 vertices, with their indices stored to determine the winding order of those vertices and thus it's triangulation.

    Upsetting the winding order (as simple removing a vertex, or changing the winding direction by exporting/importing to another app that goes anticlockwise rather than clockwise, or that does some other attempted organization of the ngons triangulation) will throw it out of whack.
  • WarrenM
    Farfarer nailed it. While technically there are no real n-gons, there ARE disagreements among apps about how to triangulate them.
Sign In or Register to comment.