Home Technical Talk

File types and Normal Maps

I_R_Hopo
polycounter lvl 14
Offline / Send Message
I_R_Hopo polycounter lvl 14
Hey, guys. I've been dicking around with normal mapping again and as usual I just can't figure out certain problems I'm having with it. I have a few questions.

1. I know .tga files are commonly used for textures, and .png's are generally unsupported, but why is this? I tried rendering out my textures as .png files and they seem to be of much higher quality and take up less space.

2. I mentioned that the .png's seem to be of higher quality in my first question. When I render out a .tga file (I render in Max's renderer), the normal map appears all grainy (if I use xNormal the graininess is replaced by strange gradients). With .png's I don't get this problem. I assume it's to do with how the file types are compressed or something? Is there a way to fix it so my .tga files don't make the model look like a grainy mess (or in the case of xNormal, a wavy mess)?

3. This one really bugs me. Seams. I can not figure out how the seams work when mirroring an object. Here's where I'm at: Rendered as a .tga with Hammersley Global Supersampler results in absolutely no mirrored seams or seams along any uv island (Viewed in Max anyways. The seams are visible in Marmoset). Rendered as a .tga with either Max 2.5 Star Supersampler or none, or rendered as a .png with any of those three choices results in a visible seam and a minor seam along uv islands. Rendering in xNormal always gives me minor visible seams on uv islands and very visible seams on the mirror line. On this forum I've read both that the seams are inescapable and also that if you get them you're doing something wrong, so I have no idea which to follow. Am I stuck with obvious seams down the center if I choose to mirror an object, or is there a way to avoid it altogether?

Thanks, everyone, and sorry for all the questions. Normal maps are a constant headache to me.

Replies

  • leechdemon
    Offline / Send Message
    leechdemon polycounter lvl 11
    Can't answer all, but here I go...

    1. TGA's are uncompressed, which is good. But they're huge, which is bad. PNG's are available as uncompressed (I believe?), but Photoshop handles them very poorly, so they're frowned upon. I use them and I hate it. But the size is nice.

    2. Not sure what you're referring to; care to upload something?

    3. Post a screenshot and your UV layouts. The biggest problem with seams, from what I've seen, is that there's about 8 causes for them and they all produce similar results. The big ones are that you have to keep the mesh solid across your mirror (otherwise the base normals are wrong, and when you mirror it they become wrong again), and you'll want to make sure your model is a mesh if you're baking in xNormals; if it triangulates your quads differently than Max, the normals will all bake incorrectly.

    Screenshots and I can help more accurately, though.
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    To add to LeechDemon here:

    1- Every software reads and writes PNG's differently, the closest we have to standard is Photoshop, and while that works fine in everyday usage, it's hassle for 3D softwares to read them out clearly. PNG's are the Normals Maps of the formate world if you will, instead of flipping green channels, they flip codes.

    2- 24 bit TGA, Ucompressed? How many rays are you using? 128+ should be the ball bark for quality, also, are you baking with AA and how many samples? Xnormal is the easiest thing to use, so if you're having problem with TGA's, I suggest hitting up the pinned thread up, and post a sample for best input from Joghsy himself. (Or even here, both work).

    3- Delete part of the mesh you don't need which is going to be mirrored and use that one to bake it, OR, simply select the UV's which you don't need, and move them by 1 box-space on the UV grid so that they're outside the UV borders, and don't interfere with the baking. Also, set a padding (edge padding, aka gutter padding/dilation) to atleast 8, and paint the background of your normal map a neutral normal color (127,127,255) or (128,128,255) pending on software (I'm a fan of the latter).
  • m4dcow
    Offline / Send Message
    m4dcow interpolator
    Ace-Angel wrote: »
    3- Delete part of the mesh you don't need which is going to be mirrored and use that one to bake it, OR, simply select the UV's which you don't need, and move them by 1 box-space on the UV grid so that they're outside the UV borders, and don't interfere with the baking.

    Do the latter. It's a No-No to delete any part of the low poly mesh because this tends to throw off the normals along a seam edge and leads to problems. Even if you were talking about deleting half of the high poly mesh if you don't leave enough padding you may get artifacts along the edge (raycast misses etc), and more importantly if you want to bake an AO map from that, you won't have the other half of the model contributing to occlusion.
  • throttlekitty
    It is ok to delete less than half of the mirrored side, so long as you leave ample room for normals along the seam.
  • [HP]
    Offline / Send Message
    [HP] polycounter lvl 13
    Some people I know even use BMP. But TGA uncompressed is what you wanna go for. I always stay away from PNG's.
  • McGreed
    Offline / Send Message
    McGreed polycounter lvl 15
    [HP] wrote: »
    Some people I know even use BMP. But TGA uncompressed is what you wanna go for. I always stay away from PNG's.

    Plus, as far I know, BMP doesn't have an alpha channel.
  • leechdemon
    Offline / Send Message
    leechdemon polycounter lvl 11
    m4dcow wrote: »
    Do the latter. It's a No-No to delete any part of the low poly mesh because this tends to throw off the normals along a seam edge and leads to problems. Even if you were talking about deleting half of the high poly mesh if you don't leave enough padding you may get artifacts along the edge (raycast misses etc), and more importantly if you want to bake an AO map from that, you won't have the other half of the model contributing to occlusion.

    Agreed. If you have to delete something, do it somewhere OTHER than the seam. Reasoning: http://wiki.polycount.com/NormalMap?action=show&redirect=Normal+Map#Smoothing_Groups_.26_Hard_Edges . But if you're offsetting UV's, you shouldn't have to.
  • EarthQuake
    It is ok to delete less than half of the mirrored side, so long as you leave ample room for normals along the seam.

    What? No, never do this. Deleting half of your low is ALWAYS going to cause seams. There just isn't any situation where this is a good thing, its A. more work and B. going to break your bake. There is no benefit to doing it.

    Unless you're talking about deleting the high... In which case....?

    Do
    Not
    Delete
    Anything
    Ever

    Just offset the uvs 1 unit for the mirrored/duplicated/etc parts.


    TGA is the standard for this sort of stuff, if you're getting bad results with TGA your settings are messed up(like using compressed TGA). Does anyone really have a problem with the size of tgas? Jeez guys, 1TB hard drives are like $60.
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Sorry, my bad, I should have specified un conncted mesh (like two pauldrons for example on a warrior) are cases when I delete the mesh, I never delete the mesh for organic, connected models, but in all cases, UV offset works fine.

    Sorry, my bad.
  • leechdemon
    Offline / Send Message
    leechdemon polycounter lvl 11
    Yeah, I've done that before; deleting mirrored geometry, but not geometry that has a seam down the mirror line. I've modeled cars and deleted passenger side doors, body panels, mirrors, etc. You can do the same thing with Offsetting, though, so it's sort of unnecessary anyways.
  • EarthQuake
    Even then, its simply a waste of time for you to do this. You can simply offset the uvs, then you dont have to deal with saving multiple copies of the mesh etc etc.
  • Mark Dygert
    Offsetting has its pitfalls, if you want to move the UV's around you have to take care to make sure the offset pieces are moved also. Which could mean moving the pieces back so they are stacked, then after adjusting them offset it again. Or like Ace said delete the mirrored mesh, arrange the UV's and offset it again.

    In max you can push pieces forward of back in the W space, this will have one render on top of the other while not running into the issues you have in other apps when UV shells share the same space. It also gets rid of the need to offset. It also introduces problems with the weld feature in older versions of max where you can weld two verts that should never be welded (this is fixed in 2011 and newer).

    Personally I wrote scripts that quickly offset the selected pieces 1 unit to the right and -1 unit to the left so its a simple operation and only 1 click instead of 2 clicks and some typing.
  • EarthQuake
    Yeah in max offsetting in W is the best, then you can still edit the layout easily, but that doesn't work in every app. Really any app with numeric input for UVs offseting/unoffsetting should be a very very quick task. As you said, scripts make it even easier.

    So, there are a few things you need to think about yeah, but its still quite a bit faster than deleting meshes or keeping multiple copies of your mesh and all that.

    A really fast workflow:

    Use two materials:
    1 assigned to the "normal" faces
    1 assigned to the "mirrored" faces
    Then just select via material the mirrored faces, and use a script to offset -1 or +1, should be just a couple seconds work. =)
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Is there anyway to offset correctly in the W space for Max using the UV editor? I always had to use scripts such as Mesh 2 UV 2 Mesh inorder to push them via polygons into the space, but usually folding them back scaled them in size.
  • EarthQuake
    You can just use the numeric input in the max uv editor AFIAK and type in 1 to the W input box.
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Thanks, I guess I need to try that again, last time I used it, the results weren't too hot, although that was in 2010.
  • Mark Dygert
    Yep, you can also set your UV editor to display in UW space in the upper right corner next to "show map list". Like EQ said this W mode isn't supported by a lot of other apps besides max, so baking in xNormal, zBrush, mudbox or Maya will smash the shells flat so they share the same space.

    Switching to UW space can be a quick way to grab all of the pieces that need to be offset, which is a good step if you are going to one of those other apps.
  • I_R_Hopo
    Offline / Send Message
    I_R_Hopo polycounter lvl 14
    Sorry I've taken a bit to respond.

    So, my baking process is this: I have the full low poly, and I offset the mirrored UV's 1 space over. I make sure that I have no inverted faces in the UV (aside from the mirrored ones obviously), and I've reset all xForms. I then set up my cage (With export and import cage in Max), and I set up the projection options to bake out a normal map (I don't use light tracer for the normal map usually, but I set it up for a test after Ace-Angel said about the ray number. It was at 250 and I got identical results. Also, I always render a 32 bit TGA because I don't know the difference between the different ones, but I get the same results with a 24 bit one)
    Anyways, here is some pictures so you guys can see what I mean:
    My Uv's (I know there's a lot of wasted space. There's a chunk of UV's that are to be rendered in xNormal that I haven't included here, and this isn't the final UV's yet. I was rendering part in Max and part in xNormal because I have some sculpted pieces that I couldn't do in Max):
    JEHMc.png
    My Normals rendered out:
    XSdOK.jpg

    Here is the .tga bake (As I said before, the graininess isn't there when rendered to .tga in xNormal. It is replaced by odd 'waves.' I didn't show this though):
    R5Ji4.png
    Here is the .png bake:
    MxA5W.png
    Interestingly enough, when I save the .png as a .tga in photoshop I get the graininess AND visible seams on mirrors and uv islands:
    SlsHw.png

    Am I just doing something wrong with the saving of the .tga files? I'm not clicking the compression box when I save them out.
    Thanks for the help!
  • throttlekitty
    Sounds a little bit similar to this banding issue when using a targa.

    If you take the .png and .tga bakes into photoshop layers, the top set to Difference, does the noise show up there?

    If not, try updating your video card drivers, or previewing in another application.
    edit: maybe check the alpha channel on the .tga if your shader is using it in any way?
  • I_R_Hopo
    Offline / Send Message
    I_R_Hopo polycounter lvl 14
    So, after reading the post there, I assume that the graininess is unavoidable and a result of image format limits. Makes sense. I adjusted the levels to Jocose's numbers, and the noise and banding became very apparent (Taking the .png and .tga and setting one to difference didn't do anything though). However, it is odd that noise is even being generated on the empty background color. Also, in a few places on the model there is very little or no noise at all. This makes me think that there might still be something going on that I'm missing.
    I also took a look at another model I made, and the noise was a lot less apparent and completely non-existent in many places. The only thing I did different on that one that I can think of was make a bigger cage. On this one the cage is pretty close-fitting, so I'll try pushing it out and seeing if that helps at all.

    Now, I am still completely lost on why some image formats and ways of rendering cause visible seams while others don't.
  • lloyd
    I_R_Hopo wrote: »
    R5Ji4.png


    a 3d studio max bake if ever i dun seen one :)
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    I couldn't avoid any of those issues in Max, I just gave up on it and went to Xnormal.
  • Harkonnen604
    This is probably because png can use 16 bit per component. 8-bit per component normals are always grainy especially when kept normalized within texture, CryTek wrote about that. TGA cannot handle 16-bit-per-component, only TIFF and PNG can (and DDS of course).
Sign In or Register to comment.