Home Technical Talk

UDK Anoying Normal Map Seam Doesn't Make Any Sense.

polycounter lvl 11
Offline / Send Message
jocose polycounter lvl 11
I have a 1 meter x 1 meter polygon I made in max. I duplicated it, moved the duplicate 1 meter to the left and then attached and merged the verts. So now I have a 2m x 1m plane.

I then broke and rotated the UVs so my UV texture was mirrored down the middle.

  • Everything is a single smoothing group
  • I Imported the normal map using normal map compression in unreal.
  • This seam is still visible on my mesh even if I flood fill my material with the neutral normal map color
  • My verts are welded.
  • I tried flipping the red and green channels, but really that's not even relevant because as I stated earlier this seam appears if I flood fill the entire normal map with the neutral color.
If I leave the normal map slot in the material empty this issue does not occur. Yet it does occur with any normal map even one flood filled with R:128 G:128 B:255 What gives?

You can download the FBX (I also tried this with ASE and the exact same thing happens) here: http://dl.dropbox.com/u/2997790/UDKSeammodel.zip

seam.jpg

shader.jpg

normalmapw.jpg

Replies

  • Ben Apuna
    Options
    Offline / Send Message
    I think you're mirroring in the wrong direction. Rotate your texture and UVs 90° clockwise or counter clockwise and you should be good.

    Also make sure that when you make your light map UVs that the two sides are welded together.

    And this isn't directed specifically at you jocose, but what's with the trend lately of people posting UDK questions outside of the UDK sub forum?
  • jocose
    Options
    Offline / Send Message
    jocose polycounter lvl 11
    I actually just re-did the mesh right now and instead of even messing with the UVs I just used a mirror modifier in max (which duplicated and flipped the polygon, and then merged the verts, and cleared and replied the smoothing groups, and then ontop of that used edit normal to just make sure all the normals were aligned to the face/averaged. Also deleted xforms prior to all of that.


    That didn't fix the issue. I get the exact same results.

    That said i'm pretty sure its not related to anything in max specifically since the exact same thing happens out of Maya and modo in both the ASE and FBX file formats.

    Also I neglected to mention I am using a TGA for my texture so its lossless. I'm hosting the TGA here in case anyone wants to try to use it with the model I posted: http://dl.dropbox.com/u/2997790/floor.tga


    I also just noticed that this appears to happen even on the stock checkered material. The seam is so subtle its hard to notice, and really probably wont be an issue when I apply a diffuse color, but I don't get why its happening in the first place. Is unreal broken when it comes to normal map mirroring?

    stocku.png
  • Ben Apuna
    Options
    Offline / Send Message
    I took a look at your TGA.

    Yes, Unreal is broken when it comes to normal map mirroring. You must mirror your textures horizontally NOT vertically.

    Your texture doesn't tile with itself so you are also getting a seam along the mirror edge because it is mip mapping with the opposite side.

    EDIT:

    It looks like you can get rid of the second problem by changing the Address X and Address Y properties of your texture from TA_Wrap to TA_Mirror.
  • Ben Apuna
    Options
    Offline / Send Message
    It looks like you will also have to change the Indirect Normal Influence Boost setting from 0.3 to 0 in order to reduce the lighting seams between sides as well.

    View -> World Properties -> Lightmass -> Lightmass Settings -> Indirect Normal Influence Boost

    UDK_mirrored_plane_01.jpg

    Unfortunately it's not a perfect fix :(

    UDK_mirrored_plane_02.jpg

    Heres a copy of what I've done:

    http://dl.dropbox.com/u/1447878/mirroring_UVs_UDK.zip
  • jocose
    Options
    Offline / Send Message
    jocose polycounter lvl 11
    Thanks guys, sucks that its broken but at least that's good to know. Ben, also, thanks for that information about the mirror vs wrap setting.
  • jocose
    Options
    Offline / Send Message
    jocose polycounter lvl 11
    Update, Ben I actually tried mirror left to right instead of top to bottom and it made it worse? Anyways it appears as those using mirrored normal maps will always have this issue. If anyone has a solution or work around please let me know.

    BTW Ben, it looks like Modo FBX files dont save out normals correct, and collada files don't re-import correctly? I have only gotten re-importing to work on fbx files from maya and max and ASE files from max

    Also changing the lighting boost doesn't appear to have any effect as far as I can tell both sides look the same. :(

    After testing this for several hours I am starting to come to the conclusion that Unreal just screws up the binormal and tangent calculations because it isn't expecting any of the UVs to be flipped. This causes the shading to get screwed on the other side.

    What this basically means is that I can't have any normal maps that are where the UVs are flipped. This seams nuts to me but every test I try confirms it.

    Has anyone else confirmed this, or has anyone successfully flipped the uvs of a model and not gotten at least a subtle seam? Non-flipped uvs tile PERFECTLY :(
  • jocose
    Options
    Offline / Send Message
    jocose polycounter lvl 11
    Sorry for posting 3 times in a row, but I wanted to bump this just to point this out. http://utforums.epicgames.com/showthread.php?p=26161072

    If you read the last post there it appears as though unreal just plane out does not support mirrored normal maps (either vertically or horizontally) if you have specular. However, I was able to even notice the issue without spec its just more subtle.

    Also, I went through every single static mesh in the UDK library and did not find a single one that was mirrored. (Please let me know if you can find one)

    I ran some additional tests using a simpler texture and also tried to hide the seam with detail normals.

    hmirror.jpg

    vmirror.jpg

    meshoverview.jpg


    • I tried the lightmap trick that Ben suggested and got nothing, it appeared to make no difference.
    • I tried messing with any setting I could find in the texture and was unable to get any better results.
    • Dynamic lights don't make a difference
    • My UVs are all in the 0-1 space, but I also tried them outside the 0-1 range and this did not make a difference.
    • I tried both those tests with another model that had the geometry completely split (the polygons were separate), and another test where the verts were merged but the smoothing groups were separate (hard edges), and a final test where the verts were merged and averaged. As one might expect, since it is a flat plane, it looked exactly the same in all cases, it doesn't make a bit of difference.

    Here is my conclusion so far:


    The total lack of any mirrored assets from the UDK library suggest that mirrored normal maps is not a priority for Epic and so this will probably not get fixed any time soon.

    It appears as though the cause of this is that Unreals tangent space calculation does not take into account flipped UVs especially along the V axis.

    If you don't use a normal map in your shader this issue does not exist. Straight up per-pixel lighting with a high spec does not produce this issue.

    If the engine just isn't calculating things correctly then there is very little that can be done to resolve this.



    You have two options:

    1. Use mirrored UVs and try to hide the resulting seam. Which in my case was damn near impossible given how huge the error was.
    2. Don't mirror any of your UVs.

    The second option is the one I'm going to have to go with especially since this is for the PC. You have plenty of texture memory to spare on the PC and if you look at the UVs for the assets in UDK they are completely unoptimized in most cases. Hardly any of the "UV tricks" that I see employed are used at all. Its just about getting things to look good.

    If anyone has an opinion to the contrary or thinks they can do better please post back here. All of my files I posted earlier should still work just fine.
  • Bal
    Options
    Offline / Send Message
    Bal polycounter lvl 17
    Yeah I've noticed this too, even if you do hide the seam, in many cases it'll still be noticeable that your shading is a bit off (depending on the lighting etc).

    I really hope they fix this sometime.
  • eld
    Options
    Offline / Send Message
    eld polycounter lvl 18
    Not sure if someone asked or if it was brought up already; did you try having each mirrored segment on its own smoothinggroup?

    There's something in the graphical programming world that I can't remember that'll mess up if a normalmap is mirrored but still sharing the same set of vertices.
  • jocose
    Options
    Offline / Send Message
    jocose polycounter lvl 11
    @Eld

    Thanks a bunch for the response.

    Yes, in the above example I tried both those tests with another model that had the geometry completely split (the polygons were seprate), and another test where the verts were merged but the smoothing groups were seprate (hard edges), and a final test where the verts were merged and averaged. As one might expect, since it is a flat plane, it looked exactly the same in all cases, it doesn't make a bit of difference.
  • sprunghunt
    Options
    Offline / Send Message
    sprunghunt polycounter
    in my experience avoiding/hiding seams is something you just have to do most of the time.

    but here's a UDN page that might help:
    http://udn.epicgames.com/Three/LightMapUnwrapping.html
  • jocose
    Options
    Offline / Send Message
    jocose polycounter lvl 11
    Thanks for posting the link, but I'm not using any lightmapping. This is all just dynamic lights right now.
  • Ben Apuna
    Options
    Offline / Send Message
    From what I can tell and what I've read, you'll get better results by mirroring horizontally.

    I don't think you should attempt to mirror both horizontally and vertically at the same time like in your latest examples because vertically just does not work well at all. If you look at your new examples the horizontal mirroring is much more successful than your vertical mirroring.

    I think you should mirror your mesh triangulation as well as your UVs for best results, though this really only applies to non-flat meshes.

    Testing with dynamic lights is a bad idea IMHO because the baked lighting in Unreal will be drastically different from the dynamic lighting.

    From my own experience how you lay out your lightmap UVs will have a huge impact on how drastic the mirrored and/or stacked UV seams will be, but only once the lighting is built. I don't think they have any effect when using dynamic lights.

    Whenever possible it's a good idea to design your assets with a mirror seam in mind so that you can get away with them with less trouble.

    Also as you said, hide them as much as possible as well.

    I know what you posted is just for simple example purposes but, just in case: Don't forget you need to recalculate your normal map channels a bit when rotating them, check out these Normal Map Actions for Photoshop by Will "sinistergfx" Fuller for quick normal map 90° rotating.

    With all of that said, I've never seen a "perfect" mirror without a "any" seam in Unreal. At best you can only minimize them to being less visible.

    EDIT:

    For the sake of completeness, here's a post on how I mirror cylindrical forms in Unreal (model and the rest of the UVs by oXYnary).
  • jocose
    Options
    Offline / Send Message
    jocose polycounter lvl 11
    Thanks for all the help Ben, and also the reminder about rotating normal maps. Of course that wouldn't matter on this flat plane. You get a lot more freedom to muck about if your on a planar surface. Your normal map may not be accurate but it usually looks right.

    The issue with Unreal, even if you mirror horizontal, is that something is off in the way its calculating the binormal and the tangent. You can see this in my test model the highlight on one side is on the bottom of the bevel and on the other its in the top. Its effectivly flipping somthing. I'm not sure what exactly without understanding how its all coded, but as far as I can tell there is no fix.

    Also, unless your using 100% unique art assets for your mod you will probably want to use some of the UDK assets, and non of those will be mirrored. So optimizing your props will give them a higher texel density than everything else in the game.

    So my thought was just to avoid the issue entirely and just build everything like they do in unreal and don't fight it.

    UDK is design for the PC, and most modern PCs have NO shortage of video memory.

    Every other game engine I have worked with handles mirrored UVs just fine, Unreal is the first I have seen to have this problem. I guess you can either try to hide the problems/limitations of an engine, or work with in them.
  • jocose
    Options
    Offline / Send Message
    jocose polycounter lvl 11
    I just wanted to update this thread for the record. Epic DOES mirror their normal maps, and quite often at that. My problem was that I was looking at the lightmap UVs and not the UVs in the 0 channel. Was an honest mistake, sorry for the tirade about them not mirroring things.
Sign In or Register to comment.