Home Technical Talk

Edges and their effect on normals

eld
polycounter lvl 18
Offline / Send Message
eld polycounter lvl 18
This is the effect of how some engines optimize their vertex normals, or something similar I believe.
The tilted edgeflow will make the upper row on this cylinder tilt a bit, to the oposite of the lower, and the way to fix this is to equalize the edgeflow in a sigsag pattern, it was the most visible with high gloss speculars shining on the cylindrical tube, or generally anything made out of a strip.

edges.jpg

Now this is something I got used to alot while working, and I've always wondered why it is the single thing never mentioned anywhere in any tutorial, but I've still seen the results of this, in various games, including the sample I took with 3dsmax's standard realtime shader.

now discuss below; do you turn your edges, does your engine of choice have this artifact?

Replies

  • Ben Apuna
    I don't see any pics, but I think I know what you are talking about. Yeah I do turn my edges so they all go in the same direction, especially on round shapes. It seems to help with getting a smoother more uniform normal map bake. Not sure why no one ever mentions it either...

    EDIT: Oh now I see the pics. I do the left one. Interesting result with the one on the right though, this may require some experimentation...
  • Vailias
    Offline / Send Message
    Vailias polycounter lvl 18
    ELD: ouch. Kills the triangle stripping though. Memory inefficient mesh bits.
  • eld
    Offline / Send Message
    eld polycounter lvl 18
    Vailias, yeah its a downside, but the shading errors can be quite obvious at some times.
  • pior
    Offline / Send Message
    pior grand marshal polycounter
    Maybe your exporter puts the 'hidden' triangles in a way that is completely different from what your modeling app does. Try to slap a triangulate modifier on top of your mesh before both bake-export and game-export, and see what happens. Honestly this should be a more widespread practice. Especially with stuff like Maya dynamically re-orienting diagonal edges, what a nightmare.

    I personally dislike working in tris but sometimes just to make sure things are being taken care of the way they should I don't mind losing quad readability, for the sake of accurate normals bake...
  • eld
    Offline / Send Message
    eld polycounter lvl 18
    Pior, this is without any normalmap, this is the shading from the vertexnormals themselves, with a flat surface, but using realtime "pretty" gourad shading with specular.

    even if you baked a highpoly beneath this, it would still tilt it.
  • SyncViewS
    Offline / Send Message
    SyncViewS polycounter lvl 13
    This issue has been discussed here: http://boards.polycount.net/showthread.php?t=66651. Maybe you can find some useful information.
  • Neox
    Offline / Send Message
    Neox godlike master sticky
    maya with the automatic interior edge stuff, like pior describes is driving me nuts. I always turn the interior invisible edges in max when i need to, i only triangulate when the exporter doesn't grab out of max what i did with the interior edges.
    That brings me to another question how does Maya shade? I worked with some mayaproductions recently and there are concave interior edges on the models which are obvious in max, not only in silhouette but in shading, it seems like maya shades the model dependent on the center face normal or something? As those zigzags are not that easily to see in maya and therefore sometimes just don't get cleaned, at least thats my conclusion to why a lot of the models i got from maya based clients had those issues. And not only clients i know some places in the airborn env where it happens too, phew soon we switch to max for that :P
  • eld
    Offline / Send Message
    eld polycounter lvl 18
    my experience with maya is that it has too good o a shader, not displaying the shadingerrors that you will most likely get inside of your game of choice.

    I've seen some horribly smoothed lowpolys get perfect bakes and show off the normalmap without problems in maya, but would break apart when ingame.


    SyncViewS, I read through that thread, and I know of the problem, how to fix it, and such, I'm mostly curious on peoples experience with it, what games have that same artifact, and how people usually choose to deal or not deal with it.
  • Farfarer
    There's a similar problem in modo, too. In that it renders quads in the viewport (and baking) with the opposite triangulation they get when you manually triangulate the quads.

    It's a real pain when you export your model to find loads of slight flaws as the normal map tries to compensate for trianglulation that's now the opposite to what it was when you baked the mesh. Or even just checked the silhouette of the mesh.

    The only way I've found to fix it is to always triangulate the mesh before baking or exporting.



    I'm guessing the issue there is that it's per-vertex and not per-pixel. So the fact they're stretched (rather than right angled isosceles as you'd get from a perfect quad) means that the shading gets skewed slightly.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    eld wrote: »
    my experience with maya is that it has too good o a shader, not displaying the shadingerrors that you will most likely get inside of your game of choice.

    I've seen some horribly smoothed lowpolys get perfect bakes and show off the normalmap without problems in maya, but would break apart when ingame

    The only reason this would happen is if your game exporter isn't properly reading/storing Maya's vertex normals. The instant you start saving Maya's vertex normals (since this is where your whole original issue comes from) then the entire problem goes away in the game engine.

    If your game engine generates its own vertex normals then there is of course no guarantee that stuff which looks fine in Maya will look the same in the engine.
    The only way to ensure this is to either store and load the Maya vertex normals in your model format, since Maya derives the vertex normals from the number of edges attached to the vertex (as you proved in your first example image), and so a "quad" will behave differently to a "triangle" section because it has less edge attachments.
    A game engine cannot derive this the same way since it will all be triangle data by the time it reaches the engine, so the number of edge connections to each vertex will be different from Maya therefore you have to save it instead of deriving it.

    You can also store this data in Maya by doing a "lock normals" operation before performing a Triangulate, this way it will use the normals generated from the quad geometry even after triangulation - again this will only make a difference if your format/engine store and read custom normals instead of generating their own.

    If you can't store custom normals in your model format, the only way to guarantee a match between the app and the engine is to triangulate the whole mesh and make sure there are no locked normals, as Talon said. Providing your engine respects soft/hard edges then it should derive the vertex normals in the same way in-game.
  • eld
    Offline / Send Message
    eld polycounter lvl 18
    I never did work with maya though, and our exporter was max-based.

    generally maya seems to be the only app to deviate from the shading "standard" that every other application and engine seems to follow, but thats another thing aside from the tilted cylinder effect.
Sign In or Register to comment.