Home Technical Talk

Seemless normal map on a cube?

wysiwyg
polycounter lvl 3
Offline / Send Message
wysiwyg polycounter lvl 3
Hey guys,

I got a problem regarding the creation of a basic normal map. I'm trying to acheive a perfect result projecting a chamfered box onto a 6 sided box.

Here you can see the low poly and the high poly:
Cubes.jpg

Results:

Cube01.jpg
Cube02.jpg
Cube03.jpg
Cube04.jpg

Here is the normal map baked in 3ds max (before flipped the green channel for Marmoset):
Normals.jpg

Then, this is the flipped version used in Marmoset:
Normals_Correct.jpg


Neither of those results seems perfect. The best one is the second one in my opinion. Although, we still can see seems even if I added padding on my render.

Any thoughts on how to create a seemless version with proper shading results? Without addind an edge loop around the corners (chamfer). Or maybe thats not possible since the cube is too drastic compared to the chamfered box?

Thanks for your input,

Replies

  • MELKIY
    Marmoset has inverted green channel so try to flip Y on your normal map in case with Cube 02 and it will probably work.
  • wysiwyg
    Offline / Send Message
    wysiwyg polycounter lvl 3
    Hi,
    My normal are setup correctly. I already flipped the green channel (since it was baked in 3ds max). The reason why you don't see it on my normal map is because I flipped it in marmoset directly. Maybe I should flip it on the normal directly to avoid confusion in this thread.

    See how it looks when the channel is not setup properly.. even worst:
    Cubes_FlippedY.jpg

    Thanks!
  • Neox
    Offline / Send Message
    Neox godlike master sticky
    are you exporting tangents wirh your fbx and is marmoset set to 3dsmax tangents?
  • EarthQuake
    Yeah, you can set your tangent space to max in TB2, go to the object properties and change the tangent space. When you do this, you don't have to invert green either, it happens automatically.

    You can also change the default tangent space, edit-> prefs, this will apply to all newly imported meshes.
  • wysiwyg
    Offline / Send Message
    wysiwyg polycounter lvl 3
    Hi guys,
    Thanks for your answer Neox and EarthQuake.

    Since I baked in max, I had to invert the Y in Marmoset. The results can be seen in the first post on top.

    As far as I understand, my tangent are set properly since the bevels are on the proper side. The other post afterwards was to show how it looks with the wrong tangent.

    So, setting up Marmoset to read the Y channel correctly for the next time is helpful (in the preferences), although it does not resolve my issue discussed in my initial post. Unless I didnt understand your comment EarthQuake?

    Thanks for your input! :-)
  • Scruples
    Offline / Send Message
    Scruples polycounter lvl 10
    I think Earthquake might have addressed this exact problem in the past on this thread/post here
    http://www.polycount.com/forum/showpost.php?p=1421221&postcount=191
  • Busterizer
  • wysiwyg
    Offline / Send Message
    wysiwyg polycounter lvl 3
    Thanks guys! I'll watch this video and do another test. I'll reply tomorrow with the results.
  • Neox
    Offline / Send Message
    Neox godlike master sticky
    you baked in max, so all you have to do is click your mesh in marmo and tell it its from max on the left side

    you do not need to invert green

    better believe earthquake, he works at marmoset

    besides that, scruples might beright as well, did you bake with a projection modifier?
  • wysiwyg
    Offline / Send Message
    wysiwyg polycounter lvl 3
    Thanks Neox,

    I beleive earthquake for sure ! I'm going to test this right away. I think I misundertood the post of EarthQuake at first. I didnt see the mesh setup he was talking about so I though he was talking about the Y invert in the normal map settings.

    I also watch the tutorial that busterizer posted. Very interesting! Although, I think I did the exact same thing in my test 02 (hard edges + 6 islands + cage). In the video, he works in maya and create a cage manually. In max, Its called a projection and its a modifier that you stack on top of your mesh. I think it does the same thing? I'll try to bake in xNormal to compare as well.

    Let me know if you think that the projection process in max differs from the video above (Maya + manual cage + xNormal).

    Thanks again guys, your input is much appreciated :-)
  • wysiwyg
    Offline / Send Message
    wysiwyg polycounter lvl 3
    Hey guys,

    Here is my final result in Marmoset. I feel we still see a small edge connection on the corners but I guess thats the best it can get:

    Marmoset Viewer:
    https://dl.dropboxusercontent.com/u/33632100/Marmoset/CubeTest.html

    I Baked with xNormal (although, I got pretty much the same result testing with max):
    - Smoothing group are all hard edges on my low poly;
    - Uvs have 6 islands with padding;
    - Cage was exported using the low poly cube with a push on it (which I didnt average the normals before exporting. It's still all hard edges).

    EarthQuake:
    My last point bring me to a last question (cage normals). I read your answer to a question about projection and cage normals in an old thread (http://www.polycount.com/forum/showpost.php?p=1421221&postcount=191) and I'm not quite sure to understand how you average the normal of your cage.

    I don't know if you are familiar with 3ds max but, when you set a projection on a low poly mesh (through the projection modifier), the only controller you have is a ''push'' button which allows you to push out the projection cage. I don't think you can change the normal of that cage. Is that possible that it averages the normals automaticly?

    Also, when I did the bake in xNormal, I tried too different cage export settings (one with 1 smoothing group and another one with all hard edges). The resulting normal maps were the same. Is that possible that in xNormal, it will automaticly average the normal on the cage?

    Thanks for clarifying this with me. Thats pretty much the only part I'm missing right now to understand the full process :D
  • Scruples
    Offline / Send Message
    Scruples polycounter lvl 10
    I tried to figure out what might be going wrong here and came away more confused, that seam shouldn't be there in Xnormal when using a gapless cage, and yet I get the exact same result as you, baked in 3ds it looks fine.

    httpiimgurcomXO5kmMXpng

  • wysiwyg
    Offline / Send Message
    wysiwyg polycounter lvl 3
    Hey SCRUPLES ,
    Thanks for checking this. The 3ds max result is previewed in max or in marmoset? Can you share your scene? I was not able to make it perfect in Marmoset. Thanks again!
  • Scruples
  • Antut
    Offline / Send Message
    Antut polycounter lvl 3
    Don't forget to put a soft edge when your UV is sewed and Hard Edge when it's cut :
    I have a script for maya if you want:

    string $objList[] = `ls -sl -o`;
    string $uvBorder[];
    string $edgeUVs[];
    string $finalBorder[];
    for ($subObj in $objList) {
    select -r $subObj;
    polyNormalPerVertex -ufn true;
    polySoftEdge -a 180 -ch 1 $subObj;
    select -r $subObj.map["*"];
    polySelectBorderShell 1;
    $uvBorder = `polyListComponentConversion -te -in`;
    $uvBorder = `ls -fl $uvBorder`;
    clear( $finalBorder );
    for( $curEdge in $uvBorder ) {
    $edgeUVs = `polyListComponentConversion -tuv $curEdge`;
    $edgeUVs = `ls -fl $edgeUVs`;
    if( size( $edgeUVs ) > 2 ) {
    $finalBorder[ size( $finalBorder ) ] = $curEdge;
    }
    }
    polySoftEdge -a 0 -ch 1 $finalBorder;
    }
    select -r $objList;


    If you have something like this,you need to cut your UV and make hard edge because normal map can't offset so much angle:






  • wysiwyg
    Offline / Send Message
    wysiwyg polycounter lvl 3
    Thanks ANTUT, I'm already doing this though (6 islands + hard edges with bleeding).

    SCRUPLES
    I took your files and did a max scene with it. Still getting that little shading problem. Maybe I'm doing something wrong with my cage? This is my scene:
    https://dl.dropboxusercontent.com/u/33632100/Cube.zip

    Thanks again!
  • Scruples
    Offline / Send Message
    Scruples polycounter lvl 10
    Everything looks normal, If you render the normal map @ 2k you should be fine.
    The problem with the 512x512 map is the edges of the uv's aren't aligning perfectly with any pixel grid so when marmoset filters the texture there is a very small gradient error.

    So you could conceivably fix this by moving the uv's around without having to increase the texture size.

    Oh and about Xnormal's slightly less accurate normals it might be explained in this thread here http://polycount.com/discussion/148303/of-bit-depths-banding-and-normal-maps/p1

  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    But you can use edge padding too, and then you should not get edge issues even on lower resolution. 2k for a simple cube wouldn't make any sense...Also you don't need hard edges on every UV borders. Actually its the reverse. You need UV splits everywhere, where you have hard edges, but you can have an UV split without a hard edge too. So:
    hard edge= you need an uv split there
    uv split= you not must have to have a hard edge there
  • Scruples
    Offline / Send Message
    Scruples polycounter lvl 10
    Just to be clear, all of this is just a learning exercise (I hope) since it would be much easier to just chamfer the edges.
  • wysiwyg
    Offline / Send Message
    wysiwyg polycounter lvl 3
    SCRUPLES
    Off course it is  :-) The cube is the most simple example we can get I guess but after that, it can relates to a more complex mesh. I was only trying to get a perfect result and then, I could apply this technique on a real bake. Thanks for testing this. I think its pretty clear now.

    OBSCURA
    You're absolutely right (put a UV seem where there is a hard edge). Although, what you just said was clear for me for a while now. If you look at my first posts, the cube #2 had 6 islands, hard edges and padding (the normal map was uploaded too). We can still notice the edge in Marmoset. Like SCRUPLES said, its pretty much because of the  texture resolution. You wont get a 100% perfect seamless bake when zoomed in at 500% I guess. Even with padding, witch I added in all my tests.

    Cheers :smiley: 
Sign In or Register to comment.