Home Technical Talk

How do I fix mirrored UV seams in a normal map?

Junkie_XL
polycounter lvl 14
Offline / Send Message
Junkie_XL polycounter lvl 14
Sorry, I'm looking through the sticky and it is giving me a headache. Too much info.

I'm very frustrated. This is setting me back and interrupting my workflow...I just want to figure out a solution and move on. I've browsed and googled. I've come across warby's photoshop trick but I really don't want to monkey around in photoshop that much on just one UV shell, let alone many different UV shells.

I was told xNormal handled UV seams better, but I've had no luck.

Some people talk about a "double baked method" and "move off your UV's". I guess I don't understand this at all and I can't picture in my head what people are talking about? I was wondering if someone could help explain better?

I sure wish someone would be awesome enough to make a video tutorial for the community showing the exact procedure and steps needed to be taken to solve this problem.

Replies

  • Eric Chadwick
    Options
    Offline / Send Message
    Can't help you if we can't see exactly what your problems look like. Can you post an image of your UV layout, and what your lit model looks like? Also what 3d software(s) are you using, for which steps of the process (modeling, UVing, baking, displaying).
  • Eric Chadwick
    Options
    Offline / Send Message
  • Junkie_XL
    Options
    Offline / Send Message
    Junkie_XL polycounter lvl 14
    Hi thanks for the replies. okay here is just one shell...hiding everything else.

    http://forbrook.com/allparts.jpg

    Moving from left to right...my high poly and half of my low poly cage. Modifier shows my stack before I export to xNormal. The result is my low poly with that annoying "hill-to-valley" seam right down the middle. Then my uv layout of this particular shell.
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Try selecting one shell (in Unwrap UVW, face mode) then collapse the stack to get that face selection into EPoly, and apply a different Smoothing Group to the selected faces. This should create a "hard edge" down the middle along the mirror seam.
    Then render out your normal map again.

    Also I'm wondering why you have an Edit Mesh modifier on top of an Editable Poly object? It seems fairly unnecessary, in fact it would be better not to have it at all. What's it for?

    Edit: This might be a 3dsmax display bug. What does the mesh and normal map look like in the XNormal viewer? I am guessing it might look correct. So you may not need to edit your mesh or normals at all, just try a different viewport shader.

    Also, I'm editing your post to make the giant image into a link, it's making the "edit reply" field really hard to edit :)
  • pior
    Options
    Offline / Send Message
    pior grand marshal polycounter
    Something else(might be the cause, but can also pile up with what has already been told):

    I notice that your cage is just on one side of the object. That means that if you imagine another cage symetrical to the one you already have, you'll 'see' rays being shot in two different directions where the cages 'meet' - hence, a raycast seam is bound to appear at the mirror line.

    I believe some engines can conpensate this in realtime, but it's obviously better to have things right from the start - simply duplicate your lowpoly half to recreate the whole shape, move the duplicate's UVs out of the 0-1 range, merge the to halves together, weld the middle verts and bake.

    Once you have the bake you can either move the second halfs UVs back in range, or delete this half and recreate it from the first one.

    You can also edit the normalmap by hand, but this works better in the 'bake both halves' scenario anyways.

    Good luck, keep us updated
  • Junkie_XL
    Options
    Offline / Send Message
    Junkie_XL polycounter lvl 14
    MoP wrote: »
    Try selecting one shell (in Unwrap UVW, face mode) then collapse the stack to get that face selection into EPoly, and apply a different Smoothing Group to the selected faces. This should create a "hard edge" down the middle along the mirror seam.
    Then render out your normal map again.

    Also I'm wondering why you have an Edit Mesh modifier on top of an Editable Poly object? It seems fairly unnecessary, in fact it would be better not to have it at all. What's it for?

    Edit: This might be a 3dsmax display bug. What does the mesh and normal map look like in the XNormal viewer? I am guessing it might look correct. So you may not need to edit your mesh or normals at all, just try a different viewport shader.

    Also, I'm editing your post to make the giant image into a link, it's making the "edit reply" field really hard to edit :)

    xNormal gives me an error when trying to export to its' .SBM format saying that it wants triangles, not quads, hence the reason for snuggling an "Edit Mesh" into there.

    Anywho to answer your question, in the xNormal viewport it still shows that seam.

    Your suggestion about applying a different smoothing group confuses me a bit. Won't that create a bunch of hard edged angles/quads in my normal map?
    pior wrote: »
    Something else(might be the cause, but can also pile up with what has already been told):

    I notice that your cage is just on one side of the object. That means that if you imagine another cage symetrical to the one you already have, you'll 'see' rays being shot in two different directions where the cages 'meet' - hence, a raycast seam is bound to appear at the mirror line.

    I believe some engines can conpensate this in realtime, but it's obviously better to have things right from the start - simply duplicate your lowpoly half to recreate the whole shape, move the duplicate's UVs out of the 1-1 range, merge the to halves together, weld the middle verts and bake.

    Once you have the bake you can either move the second halfs UVs back in range, or delete this half and recreate it from the first one.

    You can also edit the normalmap by hand, but this works better in the 'bake both halves' scenario anyways.

    Good luck, keep us updated

    I think what you are describing is the "double-half bake solution" I was refering to in my first post. I feel mentally handicapped here because everytime I read that suggestion I just can't visualize what people are trying to say. I want to give this solution a try but I'm lost.

    Moving out of 1-1 range? Can you mark up on my UV layout where the 2nd half should go?

    I apologize...this should probably be a simple technical term any 3D artist should know but I am just not familiar with it.
  • rooster
    Options
    Offline / Send Message
    rooster mod
    'double half bake' is a silly way of saying dont just bake with half the geometry. mirror your half and merge the verts along the seam before you bake instead of afterwards, and move the uvs of the mirrored part out of the normal 0-1 range (out of the square)
  • Eric Chadwick
    Options
    Offline / Send Message
    Try one of these shaders first, see if it solves your problem.
    http://wiki.polycount.net/Normal_Map#ShadersAndSeams

    If it doesn't, then rebake using some of the suggestions here.
  • jogshy
    Options
    Offline / Send Message
    jogshy polycounter lvl 17
    @Junkie, I received your SBM files but I also need the 3DS/FBX/ASE to play with them in 3dsmax, pls

    I assume you didn't generate the SBM files using the buggy 3dsmax2obj OBJ exporter that comes with 3dsmax... because that could bug a lot the vertex normals...

    I suspect the problem is that 3dsmax tangent basis computation is sightly different than the xNormal default tangent basis calculator one... which could be probably solved using the D3DX tangent basis calculator instead... but try the shaders Eric mentioned before.
    xNormal gives me an error when trying to export to its' .SBM format saying that it wants triangles, not quads, hence the reason for snuggling an "Edit Mesh" into there.
    Yep, that's normal. The SBM exporter requires the projection modifier to be applied over a triangulated mesh. However, you should be able to export a quad/poly mesh if the "Export cage" is not checked ( but you'll loose the cage's data obviously ).
  • Junkie_XL
    Options
    Offline / Send Message
    Junkie_XL polycounter lvl 14
    rooster wrote: »
    'double half bake' is a silly way of saying dont just bake with half the geometry. mirror your half and merge the verts along the seam before you bake instead of afterwards, and move the uvs of the mirrored part out of the normal 0-1 range (out of the square)

    Thank you very much now I understand.

    I tried generating the normal map quickly in 3ds max and while still not perfect, it looks A LOT better now moving that 2nd half out of that 0-1 space. I'm going to give xNormal a try now because it seems to generate a darker shade of blue along the edges in the tangent space normal map.

    StandardFX.fx sure sucks. It still shows the crappy seam. But the DirectX material looks much better with the 'hardware map' enabled in viewport when combined with this new "double bake method" I finally understand.

    Ben Cloward's shaders don't work well for me...I want specular so when I grab that one, I'm always seeing just black. I'd also like to see him add an option for ambient occlusion.

    In a perfect world I would love if someone rewrote the StandardFX.fx (because I like its' setup and it has ambient occlusion) and apply Ben Cloward's code to it if it really helps with seams well. Then give people the option to flip the red/green channels like the DirectX material bump slot > Normal Bump options.

    Also StandardFX.fx only displays a very low res map for some reason. The DirectX material matches your map res.

    Combine all those elements and we'd have the perfect .fx file to use in my mind.
  • Eric Chadwick
    Options
    Offline / Send Message
    Ben does have an ambient occlusion shader.
  • Junkie_XL
    Options
    Offline / Send Message
    Junkie_XL polycounter lvl 14
    Ben does have an ambient occlusion shader.

    Are you refering to the global illumination shader? I can't get that to work. Just appears black. Maybe it's not meant to work with max2008?
  • Eric Chadwick
    Options
    Offline / Send Message
    Yes, it has both, bitmapped GI and bitmapped AO. It works for me if I make sure to fill every slot with a bitmap. Send him an email if it still doesn't work for you, he's been very supportive for my requests (and others too).
  • Junkie_XL
    Options
    Offline / Send Message
    Junkie_XL polycounter lvl 14
    okay I'm having much more success with the "double-half bake" solution now that I understand it.

    http://forbrook.com/doubleHalfBake.jpg

    StandardFX.fx still looks like ass. Everything else looks pretty good though. You get far enough away and now I can see the edge but maybe I should just take my "padding" up higher.

    I really like the Ambient Occlusion in StandardFX.fx, I wish I could pull off the same effect with Ben Cloward. I can't find a Cloward AO shader, only GI?
  • Eric Chadwick
    Options
    Offline / Send Message
    Junkie_XL wrote: »
    get far enough away and now I can see the edge but maybe I should just take my "padding" up higher.
    More padding helps, should be at least 4 pixels for 1024x. Also helps to fill the empty in-between areas with 128,128,255 instead of black, so there's never a bleed problem. Don't use JPG because it's lossy, use TGA instead.
    Junkie_XL wrote: »
    I can't find a Cloward AO shader, only GI?
    You've got the right shader on the end of your image there.

    Ambient Texture slot is for the "diffusely convolved" cubemap. Easy to make with this tool:
    http://ati.amd.com/developer/cubemapgen/index.html
    Probably needs to be in DDS cubemap format. I can make a quick one for you if you want.

    Lightmap Texture slot is for your AO bitmap.

    Here's a really old example of a diffusely convolved cubemap in action. Bottom left is lighting alone, bottom right is cubemap alone, top left is both together, top right is the diffusely convolved cubemap in the OpenGL-cubecross layout format. DDS uses a different layout, but end result is the same.

    rabbit.jpg
  • Junkie_XL
    Options
    Offline / Send Message
    Junkie_XL polycounter lvl 14
    okay now I see the AO with that GI shader but the normal map with specular won't appear. Man this is frustrating.

    I wish I could write and understand these .fx files. StandardFX is perfect except it is too low res and the mirror seam in the normal map is visible.
  • Eric Chadwick
    Options
    Offline / Send Message
    Check out Shader FX, the demo is quite fun to play with.

    Seriously, don't mess with the fx shaders that ship with Max. They don't use the tangent basis. Why, I don't know. Use Ben's or Joel's.

    You could also try mixing the ao into your normalmap, then using that map in a good normalmap/specular shader. If the shader doesn't re-normalize the map, then the ao that you add to the map will essentially shorten the normals in the creases/cracks, which then causes the lighting contribution to be reduced there. If going that route, try multiplying it only on the Blue channel, not Red or Green.
  • jogshy
    Options
    Offline / Send Message
    jogshy polycounter lvl 17
    A stupid question... have you inverted the green channel of the normal map?
    I tell you this because if you generated the normal map using xNormal ( which uses an OpenGL coordinate system ) but you wanna preview it in 3dsmax ( which uses Z up ) probably need to generate the normal map in xNormal using a swizzling of "X+Y-Z+".

    Also try to change the default tangent basis calculator in xNormal from the "Default tangent basis calculator" to the D3DX one ( which is the one that 3dsmax uses ).
  • Junkie_XL
    Options
    Offline / Send Message
    Junkie_XL polycounter lvl 14
    Yeah I've tried swizzling the Y channel with xNormal and doing the same in max and all possible combinations. It doesn't seem to really help much with the seam. But just baking the normal map in xNormal alone I can tell is much better than 3ds max baking.

    At any rate, thanks guys, I think I've got mostly everything figured out now. xNormal combined with the "double-half bake" method seems to work the best.

    So I guess if the rule of thumb for padding = 4 on a 1024x1024 image, then the padding should = 16 for 4096x4096?

    The Cloward GI shader I'm still a bit stumped on. Cloward's NormalMap_Specular seems to be working the best for right now. I just dumped the AO map into the diffuse slot and I'm getting the result I want for the most part. I guess I'll just have to combine the AO with my main color dirt map in photoshop when the time comes and just deal with that for now.

    Like I've said before, StandardFX really has the options I want...the normal map code just sucks for that seam and the resolution seems somewhat shoddy. I tried a new StandardFX.fx that came with max2009 but it still looks the same. Great options, poor code. If StandardFX had Cloward's touch it would be perfect.

    I suppose I should just use xNormal's viewport but I'm still getting this weird result in the 3D viewport over there. It makes it look like the welding is breaking apart when I know everything is welded in max. Maybe I should try something other than the .SBM format?

    Lumonix ShaderFX is on a whole other level of confusing...I hate nodes and linking. Reminds me why I hate texturing in Maya and why I stuck with Max. ;-) I'll try and mess around with it when I get time. I've tried e-mailing Ben a couple days ago regarding some of his .fx, I'm sure he is fairly busy. Joel seems to only work with skin/hair shaders but I suppose I could drop him a line too.

    If anyone knows of any other resources/talk on the web where a person could grab some .fx shaders I'd appreciate it.
  • Eric Chadwick
    Options
    Offline / Send Message
    Lots here, I haven't tried loading them in Max though.
    http://developer.download.nvidia.com/shaderlibrary/webpages/shader_library.html

    The "generic image based lighting" shader is pretty cool.
    http://www.luxinia.de/index.php/ArtTools/3dsmaxFX

    ATI also has their free shader editor, probably has examples.
    http://ati.amd.com/developer/rendermonkey/index.html

    As for the padding, that should be fine. Try resizing your bitmap (with padding) down to 256x256, and see what happens on the model. Also down to 64x64 or lower. If you see seams, increase the padding on the high-res bitmap. Also always make sure to fill empty areas with an average color (never just black). Whenever the bitmap pixels on the model (called texels, short for texture-pixels) are smaller than the screen pixels, the bitmap gets resized down by the engine.
Sign In or Register to comment.