Home Technical Talk

triangulate before baking nmaps or not?

polycounter lvl 17
Offline / Send Message
bugo polycounter lvl 17
Hey guys, im using Maya and im wondering if everybody does that or just in some cases? I know that triangulating in Maya might mess out with vertex normals, but what im wondering if after I bake the animation might change the triangles if I let them as quads, or no?

Thanks in advance.

Replies

  • glib
    Options
    Offline / Send Message
    bugo wrote: »
    im wondering if after I bake the animation might change the triangles if I let them as quads, or no?

    I can't decipher this.

    Are you asking about baking normal maps? Or baking animation? Or both?
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Triangulating will adjust your vertex normals in Maya, so only do it if at some point in the pipeline the mesh is going to be triangulated (although you could Lock the vertex normals before triangulating but that might get messy later on).
    I usually wouldn't bother, since our exporter at work takes the vertex normals before triangulating during the export step. If you're only planning on using the objects in Maya then it should be fine (although Maya's viewport display may be dodgy if your mesh is skinned, since it re-triangulates when deforming, for some insane reason). It should render ok in that case though.

    If you have to manually triangulate for whatever reason before exporting just remember to lock the normals before you do. That should mean that you don't ever need to work with the triangulated mesh. This is another reason why I much prefer Max's method of managing triangulation :P
  • kodde
    Options
    Offline / Send Message
    kodde polycounter lvl 19
    glib wrote: »
    I can't decipher this.

    Are you asking about baking normal maps? Or baking animation? Or both?

    My guess would be that without triangulation you might experience shifting triangle splits. Maya always places the hidden triangle splits along the shortest path, and since animation = polygons deforming the triangle splits might shift.

    Haven't studied this in detail, but I believe this is how it works.
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Yep, kodde is right. The thing is, Maya actually does store triangulation correctly internally, but when displaying in the viewport it will update to find the shortest path. There is a flag in the attribute editor for polygon meshes called "re-use triangulation" which supposedly helps avoid this, but the Maya help also says it can have adverse affects elsewhere. Look it up in the Help, you'll learn a bit.
  • kodde
    Options
    Offline / Send Message
    kodde polycounter lvl 19
    Something about picture something 1000 words?... or something... ;)

    triangleEdgeShift.jpg
  • glib
    Options
    Offline / Send Message
    Interesting. Thanks for the lesson guys.

    I wonder why I haven't noticed this on other animated models in maya before? I would expect this to look like shimmering or flickering on say an elbow during a deformation?
  • kodde
    Options
    Offline / Send Message
    kodde polycounter lvl 19
    glib wrote: »
    Interesting. Thanks for the lesson guys.

    I wonder why I haven't noticed this on other animated models in maya before? I would expect this to look like shimmering or flickering on say an elbow during a deformation?

    Note that my example shows a really skewed polygon face. You're pointy end of an elbow was probably defined by actual edges and not these "hidden" triangle dividing edges. Your actual edges never flip like this, only the hidden ones.

    I wouldn't say this is an issue you run into all that often, or at least not something you notice as an issue that often. However as Bugo was asking if triangulating would solve this? Yes it would, triangulating would eliminate all the hidden edges and instead let you choose exactly how every edges would be.
  • pior
    Options
    Offline / Send Message
    pior grand marshal polycounter
    Hi Bugo,
    Like kodde showed, Maya does dynamically choses the 'shortest edge path' between verts when ngons are deformed. However if you have a 'static' mesh in a tpose looking fine before triangulation, applying a mesh>triangulate wont change the surface (no edge flips), it will just make everything into tris. In that regard you can export for normalmap baking very safely (xnormal even requires that)

    However, you might want to save and store your mesh 'untriangulated' for readability reasons when you dont need to export it. BUT if animation is applied inside maya, you wil notice the edge 'flickering'. It's okayish on diffuse-only models, but horrible on normalmapped models.
    However, the mesh data exported to your engine will be triangulated anyways, so in-engine the flickering will diappear since you will have a edgeflipproof triangulated model driven by bones.

    The real problem arises with building morphtargets in Maya. If there are quads on the mesh, you very likely end up with morphB having different edge orientations than morphA, and it cause huges problems for export and ingame blending of A and B (in my experience, holes appeared where the edges were flipped.)

    Meaning that if you have morptargets to do in Maya, you want to :

    Create morphA in quads,
    deform it to get morphB in quads (flips will appear but save this anyways)
    before exporting A and B : apply triangulation to A, export as "exportedmorphA",
    apply morph B to the triangulated meshA,
    export this triangulated meshA with morph B applied, as "exportedmorphB". That way the deformation info is applied on top of the flipproof triangulated model, and Maya won't try to decide for you.

    Yes, this is a nightmare :P But it can be automated I guess.

    Good luck!
  • bugo
    Options
    Offline / Send Message
    bugo polycounter lvl 17
    Thanks Kodde, thats exactly what i meant.
    My only problem is that if I triangulate after the nmap is baked the vertex normals will change, and Im sure we dont want that, right? And if I bake before I wont be able to edit it later.

    My hope is that the engine itself saves not only vertex positions but also the normals even if I dont triangulate inside Maya (they will be triangles anyway ingame, i know)
  • kodde
    Options
    Offline / Send Message
    kodde polycounter lvl 19
    bugo wrote: »
    Thanks Kodde, thats exactly what i meant.
    My only problem is that if I triangulate after the nmap is baked the vertex normals will change, and Im sure we dont want that, right?

    I will help you with your issue, but...

    Someday, and that day may never come, I'll call upon you to do a service for me. But, until that day, accept this as a gift on my daughter's wedding day.
  • Mark Dygert
    Options
    Offline / Send Message
    I have nothing to add except hidden triangles in Maya drive me bat sh!t nuts. Being able to control hidden edges in 3dsmax and not have it re-triangulate, is very helpful when rigging.

    I'll have to read up on the info MoP posted sounds like it might be pretty helpful.
  • SHEPEIRO
    Options
    Offline / Send Message
    SHEPEIRO polycounter lvl 17
    what prior says.

    although i never skin stuff as im an env artist. any export would be made from the t pose surely so baking the norms when in this position would be best and triangulating befor baking always gets better results if using external baker in my experience
  • kodde
    Options
    Offline / Send Message
    kodde polycounter lvl 19
    Here we go!

    Time spent finding solution: 5 minutes
    Time spent f-ing around with screencap, re-encode, publishing: roughly 1 hour

    [ame]http://www.youtube.com/watch?v=L2z7Qu0hKxM[/ame]

    EDIT: Crap... just noticed that I had missed to check recording With Mouse showing... Not going to redo this.
  • bugo
    Options
    Offline / Send Message
    bugo polycounter lvl 17
    I got it, dont worry, not needed to redo, thanks!
  • beartraps
    Options
    Offline / Send Message
    beartraps polycounter lvl 8
    I actually find this to be extremely useful for props or environment pieces (stuff that doesn't have to be skinned). Since game engines automatically triangulate meshes it can cause some dark spots to occur and you'll have stuff that doesn't look nice. My pipeline for anything that gives me this issue is:

    1. bake normals on quaded mesh in maya
    2. triangulate mesh and check to see where dark spots are occuring with normal map
    3. flip tris where it would make sense and rebake with triangulated mesh.
    4. exoprt that tri mesh, import into your engine (this way your game engine doesn't automatically triangulate a quaded mesh)
    5. peep the super crispy normal map
    6. profit
Sign In or Register to comment.