Search Unity

Normal Maps vs. Hi-res Meshes

Discussion in 'Editor & General Support' started by Maker16, May 16, 2009.

  1. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    Ok. I managed to figure out how to do a normal map to get some really sharp looking textures on my asteroids when you get up close. However, I noticed an issue with normal maps, or maybe I'm doing something wrong. The asteroid rotates, so its lighting across the surface changes constantly. With a normal map in place, the lighting doesn't look right because, even on the dark side of the asteroid, some parts of the craters are lit, and they are lit the wrong way. I'm attaching a screenshot.

    Do normal maps not react to lighting? Are normal maps really the alternative to just putting in hi-res asteroid meshes?
     

    Attached Files:

  2. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    Of course they do!! That's the only thing they do, for games!

    It's not really an "alternative", per se. You use a normal map when using the high-res mesh would negatively affect game performance.

    Are you using a tangent space normal map? There are several ways to bake a normal map, but if you're going to be rotating your object, you need to use the tangent space variety.
     
  3. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    Yeah. I used tangent. I think the problem isn't the normal mapping. I think it's the Indie license. :?
     
  4. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    I highly doubt it. "Actual" shadows shouldn't be that important here, because you don't have any tall spikey things. Personally, I don't think you have applied the normal map correctly, because all of your hills look flat.

    Also, I don't see why you have baked the shadows into the texture, if you are going to be rotating the object. Baking occlusion is a much better solution for that. (But even that may be unnecessary, if the normal map is applied correctly.)
     
  5. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    I didn't realize I had baked shadows in. How do I avoid doing that? All I did was unwrap the lo-res model, create a new UV image, deselected the lo-res, selected the hi-res, shift-selected the lo-res, selected tangent, and hit bake. I followed the tutorial on this. Where have I gone wrong?
     
  6. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    I have no idea what tool you're using, but if you're using Blender, I can give you better advice. If not, can you at least post some screenshots of the textures you are using for diffuse color and normal mapping?
     
  7. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    Yes, I'm using Blender. There are a few different tutorials on how to do it, but I couldn't figure out which one. I think I used the wrong one.
     
  8. WillBellJr

    WillBellJr

    Joined:
    Apr 10, 2009
    Posts:
    394
    I would think for performance, you'd want to try and get the materials working the way you want.

    Granted, depending on their importance your asteroids can be considered "characters" and therefore have a higher polygon budget.

    Posted below is what I achieved with my asteroid texturing - this is that test scene (sans particles) that I mentioned I was working on when I first started learning Unity.

    I was testing last nite texture based cockpits so I swapped out the 3D cockpit model I had in originally and I'm using a cockpit image ripped from the Privateer Gold project - a temporary I used for proof of concept until I peg down the cockpits for my ships.

    I quickly changed the flight model from the xbox controller to the arrow and a,s,d,q,w,e keys - have fun bouncing into the asteroids. :p

    ...And "ignore that planet behind the curtain..." - that was a scaling test cause I'm not sure at all how large I'm supposed to make my planets yet - if I'm to go for "accuracy" or fudge it till it looks right...

    http://www.willbelljr.net/public/unity/Build01.html


    -Will
     
  9. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    Looks, good, Will. I'm getting some help with the normal mapping progress. Aside from the lighting artifacts, and lack of a final texture selection for asteroids, they're looking pretty good. They need to, as players will be getting up close and personal with them.

    I,too, had considered modeling a cockpit, but deceided to go 2D. Not for performance gain. Just because I suck at modeling. :D
     
  10. WillBellJr

    WillBellJr

    Joined:
    Apr 10, 2009
    Posts:
    394
    Glad to hear your materials falling into place for ya!

    Hi, I highly recommend you give MoI (Moment of Inspriation) a try (www.moi3d.com) - it's a NURBS modeler that has a hella excellent polygon exporter.

    It's easy to learn and it's a lot easier getting your concepts realized using MoI over a typical polygon modeler - especially when it comes to hard surface stuff.

    I typically start off my models using MoI and then take them into Lightwave or Cinema 4D for detailing and texturing.

    Unless you're going to walk around your ships, or have a lot of external shots, a model isn't going to do that much more for you anyway.

    Granted with a model however, you can easily render your static views as opposed to creating each of them by hand.


    I just need to pin down what technique I'm going to use to bring those 2d based instruments to life - apparently Unity doesn't have much for drawing 2D graphics at the moment.

    I hope there's some focus on this in the future cause as you can see from the cockpit, I need to be able to draw all kinds of gauges, blinking lights etc.

    I'll have to see what I can accomplish with that SpriteManager that's up on the Wiki for some of this stuff...

    -Will
     
  11. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    As it turns out, what I mistook for "baked shadows" and "flatness" was actually a just a problem with the normal map! Invert the red and green channels in your map, and I think you'll be good to go. It looks great and proper on my end, after doing that. I really think you did everything right except for that part. (However, I think you'd be just fine turning the SubSurf modifier level down to 1, before you save. 2 at most. It's a rock! Doesn't need a particularly smooth silhouette.)

    Also, you may want to try out a parallax shader and see if you like that. I think it helps make the craters look a little easier to "read", but not by much. To make a parallax map, do exactly what you did to bake normals, except choose "Displacement" in the "Bake" tab. (I achieved decent results with "Dist" at .08 and "Normalized" selected.) Add that grayscale render as an alpha channel for the normal map.

    Personally, I think the craters would look better with more roughness on the bottom, because as it is, I sometimes don't know if I'm supposed to be looking at mesas or holes, depending on how much of the screen my eyes are focusing on.

    Keep in mind, you won't ever get as good of results from these maps as you will from actual geometry and self-shadowing, but the normal/parallax results come very close at at fraction of the CPU cycles and cost of Unity Pro. :wink:
     
  12. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    Thanks, once again, Jessy, for coming to my aid. I'll try out your suggestions and see what I can do. Can I invert the normal maps in Blender, or do I just need to use an image editor for that?

    I'm quickly learning that there are plenty of workarounds and "fixes" for the features that Indie lacks compared to Pro, but I am also learning that I'd rather have the real deal. My Pro license savings account has already been established. :)
     
  13. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    You can convert in Blender if you like. You'll have to learn a bit about compositing with nodes, though. I personally use Photoshop, because I haven't had a reason to get good with Blender's nodes, considering I make stuff for video games, not movies, and compositing with nodes is most useful if you are going to be rendering movies.
     
  14. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
  15. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    Well I just inverted the R and G values in Gimp. Worked just fine. I have the procedure down now, thanks to you.