Home Technical Talk

Wonky Normal Generation

OddlyOrdinary
polycounter lvl 9
Offline / Send Message
OddlyOrdinary polycounter lvl 9
I was wondering if I could get some help. I'm experimenting with the high poly to low poly process and I'm stuck on a issue regarding my normal map generation.

I've created a shape that is basically an extruded box top for a piece of real world lab equipment. In the normals however there are gradients everywhere even though most of the surfaces are perfectly flat. The normals are generated in tangent space, tried using xNormal and Maya's transfer maps and get the same issue.

I've also introduced my first experience with floater geometry, simple planes with recessed insides and a slight bevel. When the normals are generated the slots don't look identical like I would expect, and the slots closest to the center of the face have the least amount of normal map data. Any help would be greatly appreciated.

I've also checked all faces and their normals are in the appropriate direction.

BTUPe.png

Replies

  • Dylan Brady
    Options
    Offline / Send Message
    Dylan Brady polycounter lvl 9
    thats what a normal map does mate.
    Its trying to counteract the smoothing errors of the low poly.
    If you want to get a better idea of how this stuff works read the wiki page.

    otherwise just bevel the corners, and if the normal map shades correctly ingame, than who really cares how wonky your normal map looks?
  • 00Zero
    Options
    Offline / Send Message
    harden edges on the low poly. then seperate the same edges in the unwrap and give a little bit of space between the uv clusters.

    its just the normal map trying to compensate for the uniform roundness of your low poly which has one smoothing group
  • OddlyOrdinary
    Options
    Offline / Send Message
    OddlyOrdinary polycounter lvl 9
    Currently the normal map doesn't not shade correctly in game. It shades acceptable well for most of the model but the float geometry doesn't have enough of an edge on it.

    XuyHr.png

    If you look at the top indention, verses the bottom there's a trend where the edge closest to the center is less and less visible, and towards the outside of the image the outer edges are really large. Am I generating this wrong? Do I need to make some sort of change to my low poly model, or the UV map to fix this error. Each indention is the same, so I would expect the same amount of pixels on the edges for each indention, and not for it to change closer to the center of that face.
  • Dylan Brady
    Options
    Offline / Send Message
    Dylan Brady polycounter lvl 9
    ehh, that looks like some kind of problem with the projection cage or something....
    Make sure you reset your Xforms before baking, if your not using an exported cage use the ray distance calculator within xnormal to get it right.
  • OddlyOrdinary
    Options
    Offline / Send Message
    OddlyOrdinary polycounter lvl 9
    Just to check, when you say reset my Xforms, what are you refering to?

    I did a quick test with a beveled cube, and a default cube with chamfered edges.
    o2tXg.png
    In the center area of each face there is a consistent tone of the background that I would expect. This isn't present in my original normal maps even for faces that are perfectly flat and sample normals from a flat area of the high poly. I also tried setting the normals to face, and again with average normals and I don't see a difference.
  • throttlekitty
    Options
    Offline / Send Message
    It looks like you might be using soft edges for the 90 degree angles?
  • Rick_D
    Options
    Offline / Send Message
    Rick_D polycounter lvl 12
    you need to add support edges in your low poly, only need to be there for the bake.
    the projection cage is interpolating around 90 degree corners, so the rays are being fired from very steep angles, causing it to miss indentations on the floating geometry.
  • Dylan Brady
    Options
    Offline / Send Message
    Dylan Brady polycounter lvl 9
    Rick_D:
    Is that a normal workflow for hardsurface stuff?
    IT seems like it would create alot of problems with your UV map if you had to remove those edges after you baked.
  • Rick_D
    Options
    Offline / Send Message
    Rick_D polycounter lvl 12
    deleting interior edges in any 3d app shouldn't destroy the uv's.

    if you find it does for whatever reasons there's nothing stopping you making a copy of the low poly that you use solely for the baking operations.
  • Dylan Brady
    Options
    Offline / Send Message
    Dylan Brady polycounter lvl 9
    My thoughs:
    if you create a UV map AFTER adding in supporting edges, than that will negatively affect opperations like relax. and consequently when you remove the edges, you'll be left with a sub-par UV map that will be stretched.

    if you add in the supporting edges AFTER UV mapping than you would have to use ring connect since beveling/extruding edges does not maintain proper UV mapping (in max at least)

    additionaly, if you use a "middleman" object you would have to either UV map your object twice, or use an automatic UV function whitch would create many seams that could cause problems with supersampling while projecting...


    if someone has a tut for this method Id love to see it.

    Ill be making some test bakes real quick myself
  • Orgoth02
    Options
    Offline / Send Message
    Orgoth02 polycounter lvl 9
    @ Rick_D your website is fucking awesome...that is all
  • Scruples
    Options
    Offline / Send Message
    Scruples polycounter lvl 10
    At all your 90° angles you shouldhave either a hard edge and UV seam or just a chamfer, if this is already true and you are still getting those results you can try to run the 'getnormalsfromface' script with all the large faces selected which will push all the smoothing errors to adjacent polygons.

    Here is the maxscript http://wiki.polycount.com/VertexNormal about 3-4ths down.

    Neither Maya nor XSI nor 3ds or any other 3d package I am aware of has a function to recompute normals based on surface area, which is rather sad. (take note if your reading autodesk). Angle corrected normal weighting is also something neglected...

    If you are curious the Brf editing tool for Mount & Blade OpenBrf can recompute normals and can import/export .obj files in the above mentioned way, but you don't have any real control over smoothing groups other than angle and uv edges.
  • Rick_D
    Options
    Offline / Send Message
    Rick_D polycounter lvl 12
    Bonebrew: you add the support edges after unwrapping. And you either use "swiftloop", "connect" or "cut". or most likely a combination to get results fast.

    swiftloop can be found in the graphite modeling tools, or you can bind it to a hotkey, in the customise options window it is located under the "polytools" sub-option (if i recall correctly).

    it's very fast to add in these loops and you can be pretty rough because it's just being used on a bake model, not the actual low poly.
  • mdeforge
    Options
    Offline / Send Message
    mdeforge polycounter lvl 14
    your website is fucking awesome...that is all

    LOL. Passed that portfolio around the marketing department today. We're not a gaming company. We do medical animations, but still, it produced many lol's.
  • OddlyOrdinary
    Options
    Offline / Send Message
    OddlyOrdinary polycounter lvl 9
    Hey RickD thanks for the suggestion, I created a duplicate of my low poly mesh and added a ton of supporting edge loops, and the bake came out like I was expecting.

    fO94m.png

    That's the left side of the original image, rotated 90degrees CCW. Solid color in the center just like I expected, etc. Apparently I have other issues mostly likely related to the edges and how I did my UV unwrap.

    If someone was really bored and wanted to take a look here are the two meshes I'm using.
    http://dl.dropbox.com/u/7070936/lowAndHigh_normalTest.obj

    I'm working in Maya, and don't have a harden edges as far as I know. I do have the crease tool but I've never used it before. Traditionally I write scripts and rig premodeled assets so this is definately a major refresher.

    I think 00Zero and Scruples suggestions about creasing the lowpoly, and better uv placement would probably be a big factor in the little seams I have left.
  • Rick_D
    Options
    Offline / Send Message
    Rick_D polycounter lvl 12
    also remember that the distance between your support edge loops and the actual edge of your model will have an impact on the bake and the smoothness of the corners, so it could be worth playing with that.

    if you want to play around with normals in maya, just select your object in object mode, hold shift and press and hold right mouse, in the bottom right you'll have a "soften/harden edge" sub-menu. inside there you can either choose "soften/harden" which is like an automatic smoothing and groups planar surfaces with an angle less than (by default) 45 degrees together into a signle smoothing group, or you can choose "harden edge" which will make every single edge hard regardless of angle.

    personally i don't think it's a good idea to have hard edges in an object with a unique normal map such as your prop, unless of course it really really needs it.
    the good thing about a normal map is that it can control the smoothing of a low poly model, so your actual low resolution mesh can be highly optimised; the less breaks in smoothing groups and uv shells you have the more efficient your model is.



    just had a look at the obj.
    firstly, it might just be because i dragged the object into my scene but it seems really really small. it can often cause problems if your object is too small. if you are usign xNormal to bake (which you should) then you can choose to scale the mesh up in there by default which will counteract any possible problems due to small scale.

    secondly, you added support edges but you missed a few (every outer edge corner should have a "square" on all sides, if that makes any sense, it barely makes sense to me and i wrote it). you should also try to make sure the support edges are as even as possible, so that you don't end up with a support edge on one side that is 5cm away from the main outer edge, and a support edge on the other side that is 15cm away. it will create an uneven cage and cause an uneven bake.

    thirdly your low poly bake model didn't have a single smoothing applied, you can do this by opening that menu i mentioned earlier (shift right click, soften/harden edge and then choose "soften edge"). hard edges will cause the cage to break and give you sharp lines in the normal map.

    fourthlylyly, your low poly sides extended past the high poly sides a little, it is best to try and match the two as closely as possible so you don't have rays that don't hit anything, or rays that are fired from another angle and hit an area of the high poly you didn't want them to.

    fifthly, try and make sure when you unwrap that you keep planar surfaces together, and break your edges only where you absolutely need to. also if you have a detail running throughout your model, like the indent you have, it's important that your uv shells are the same scale or you will have a normal map detail that uses different amounts of pixels and the continuity will break because of a jump in texel density.

    other than that everything looks fine and the bake should come out well if you fix those things.

    hope that made sense.
  • Rick_D
    Options
    Offline / Send Message
    Rick_D polycounter lvl 12
    Orgoth02 wrote: »
    @ Rick_D your website is fucking awesome...that is all

    thank you, it took me a long time to code the custom web language it uses.
  • OddlyOrdinary
    Options
    Offline / Send Message
    OddlyOrdinary polycounter lvl 9
    Thanks a lot for your suggestions and time RickD. I plan on reworking the low poly later today.

    The object is about 3inches in width, and 5-7inches deep, with the scene in cm. I'll adjust my lowpoly model to more closely match the high poly and work on smoothing the edges. Do you have any more suggestions for the uvmap of the low poly. For the chamfered edges that meet at 45degrees should I stitch those uv seams together or keep them seperate?

    For reference the item I was using for reference was the middle mixers blue box here.
Sign In or Register to comment.