Home Technical Talk

[UE4] Does importing ngons save on performance in UE4? Debate with my colleague

polycounter lvl 6
Offline / Send Message
Stu2Prof polycounter lvl 6
I have a technical question. I'm working on a project here and my colleague has had really good results in the past in Unreal when he takes a 5 mill polygon object (construction industry projects) and reduces the polycount by removing edges based on an angle selection. In the end its just a bunch of ngons at a way lower count. Unreal of course is just triangulating this mesh when it comes into the engine but he's adamant that the difference in performance is really significant. I'm however convinced this must be a false read and there's gotta be a downside somewhere. Whatcha think? Ive seen the work he created with the ngoned meshes and it does look great. Just seems like the type of thing that's gaming workflow sacrilegious.  Would love to hear back from some technical people

Replies

  • Michael Knubben
    It's a very easy test: export a mesh that's triangulated, and one that isn't. Copy them however many times is necessary to experience a framedrop, and see which is more performant with the exact same level/camera/anything settings.

    My educated guess:
    He's wrong, you're right.
    Ngons are simply triangulated.
  • fearian
    Offline / Send Message
    fearian greentooth
    Well.. ngon's are not sacrilegious. They are just part of a model that will, in engine, just be triangulated. The perception of ngons comes from the fact that they get triangulated at lots of different places in a traditional games art pipeline and this can affect your asset in different ways that you don't have control over. So it is advised that artists clean them up.

    Different programs triangulate an ngon in different ways. So if you UE4 triangulates a mesh differently from how your baking software did when you made a normal map, then that normal map will display wrong.

    Another reason is that if you wanted to import a mesh to zbrush and subdivide it, ngon's might not subdivide well. This is kind of moot now with all the tools zbrush has at it's disposal.

    Basically what your colleague is doing is totally pointless. It's not more preformant one way or the other.*

    Your fear of ngon's in this case is also totally pointless. It doesn't sound like they're going to affect the kind of work he's doing.

    ...But if he gets any rendering issues, tell him to clean up his model and maybe you get to say I told you so. ¯\_(ツ)_/¯
  • fearian
    Offline / Send Message
    fearian greentooth
    * But wait, I lied!

    technically some triangles are more expensive than others to render. A long thin tri that overlaps lots of other tris would be more expensive, for example. Manually triangulating the mesh to avoid these triangles would be the best way to fix this. But with multi-million-polygon engineering CAD models/scans then you really should just find a nice way of decimating that preforms well and stick with that, regardless of triangles.
  • Mant1k0re
    Offline / Send Message
    Mant1k0re polycounter lvl 8
    Long triangle consideration aside in both scenarios isn't the number of vertices the same? I know we are used to think in terms of polygon count but mostly what matters is *vertex* count, I believe.
  • sprunghunt
    Offline / Send Message
    sprunghunt polycounter
    if you have all the edges on your model set to "hard" so they have more than one normal per vertex unreal will duplicate the vertexes for each face that's set this way. However if you've got a bunch of N-gons the triangles within the n-gon will basically be soft edged. This could mean the n-gons are stopping the vertex splits caused by the normals. 

    The better option is to smooth the vertex normals on faces that don't need a hard edge. If it's a really high poly count mesh then you could even just smooth every edge since there's probably enough triangles that you won't need the normals to do much work. 
  • Stu2Prof
    Offline / Send Message
    Stu2Prof polycounter lvl 6
    Thanks for these responses guys. I'm curious what particular effect this has on performance but wont have time to do a side by side until the week after next. Its possible that there was previously a large amount of hard edges on the content my colleague was using but Ill have to wait and see. 
  • pior
    Online / Send Message
    pior grand marshal polycounter
    No offense, but I have a hard time imagining what this "debate" with your colleague sounds like considering that the summary given in the OP is barely understandable.

    "[...]reduces the polycount by removing edges based on an angle selection. In the end its just a bunch of ngons at a way lower count.

    I personally have no idea what that means. "Angle selection ?" You mean that he is performing a reduction based on an angle threshold between faces, like what Decimation Master and other simple reduction algorithms do ?  If yes then of course the result will be lighter than without such reduction ... because it will be ... well ... reduced.



  • Stu2Prof
    Offline / Send Message
    Stu2Prof polycounter lvl 6
    @pior In this case he is "reducing poly count" by deleting edges in the scene and creating a lower number of ngons before sending to Unreal. Although these get re-triangulated in-engine he still found a large performance boost

  • pior
    Online / Send Message
    pior grand marshal polycounter
    Show exactly what this looks like, with a practical example. Something as seemingly simple as "deleting edges" can mean very different things depending on how it's done.
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    Oh! i think i've met people like this before, on a contract job no less.

    I was asked to make a digital version of a physical object with a "polygon limit" of 1200. I did it in triangles (target engine was unity) and the director of the animation studio where the model got shipped off to got all pissy because the visual quality wasn't what he was after, but i couldn't alter the silhouette without adding more triangles, i argued.

    He emailed me an fbx file that he'd made, he'd essentially rotoscoped the object using splines and converted it to a mesh, the "polygon" count was ~1100 but the triangle count was 9000 lol.

    When i pointed this out, an argument ensued and my client was advised not to work with me anymore.

    i guess TLDR here is:
    Just make them happy, if they want ngons deliver ngons. Some assholes just won't be educated.

    FYI, whether you pre-triangulate or let the engine triangulate for you, if the number of triangles is the same, the performance will be the same. BUT you will get fucked up normals if the engine triangulates in a way you hadn't predicted.
  • csprance
    Offline / Send Message
    csprance polycounter lvl 13
    Gotta love when clients want you to make a green diagonal line with a red marker going straight up and down and claim you're the idiot.
  • monster
    Offline / Send Message
    monster polycounter
    Assuming UE4 triangulates the NGons using a max area algorithm, it could be saving loads of performance vs a clean looking remesh of a similar tricount. This gets passed around polycount every year or so. Guess it's time again. But in a nutshell, the more larger triangles you have, the better the perf.

    http://www.humus.name/index.php?page=News&ID=228
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    It's equilateral triangles you want to be aiming for  rather than just large. 
    Humus explains it pretty clearly in that article but in addition consider what happens when viewed at glancing angles. 

    That aside.. Almighty_gir makes a very important point in that if he's doing simple visible edge removal to "reduce" "polycount" (quotes for a reason)  and then letting ue4 retriangulate the mesh then his normals are going to be fucked and in all likelihood so is the silhouette. 
Sign In or Register to comment.