Home Unreal Engine

Tilling normal on another normal map

polycounter lvl 9
Offline / Send Message
olivierth polycounter lvl 9
Hi,

I've got a character with normal maps and I want to tile another norm map on it without destroying the base normal.

I've tried a "blend_overlay" to mimic what I would do in photoshop but the result is very bad...

Is this a simple thing?

Thanks.

Replies

  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    "Add" your detail normalmap to the original normalmap in udk, and use the "texture coordinate node on the deteil normalmap to get it tiled.
  • olivierth
    Options
    Offline / Send Message
    olivierth polycounter lvl 9
    I tried with "add" but it reduces the effect of the base normal map. Add is technically not the right operation with normal maps.
  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    Its good.You can use divide on it btw. Or you can give back the "effect" of it with some other solution.
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    Add is the right operation once the normal maps are unpacked to the right range.
    UDK's default normal map settings import them properly and set the values from -1 — +1 like they should be.
    In this case a simple add will give you the same result as an overlay blend in photoshop, though you will need to normalize the result before you plug the chain into the normal map slot of the material.

    If you want to control the contribution of the overlay map more, multiply it by a scalar before you add it to your main map. Values higher than 1 will result in more of the overlay coming through, values from 1-0 will make the overlay contribute less.
  • WarrenM
    Options
    Offline / Send Message
    Multiply the one normal map with 1,1,0 and then add it to the other one. That should eliminate the flattening effect.
  • olivierth
    Options
    Offline / Send Message
    olivierth polycounter lvl 9
    Thanks for helping out! I'm still having problems though.

    Both normal maps have the basic compression (TC_Normal I think...) and I've multiplied the additive normal map I want to blend with a 1,1,0 color and added that to the base norm. The norm I'm blending is mostly flat with a few lines elevated. Even the flat parts (base normal blue color) are reducing the effect of the base norm map.

    What am I doing wrong?

    Thanks for all the help!

    UDK_Norm_Blend_Prob_zpse74e6cb7.jpg~original
  • olivierth
    Options
    Offline / Send Message
    olivierth polycounter lvl 9
    Ha!

    I think I found the solution. It seems to work. Does it look right? I basically added the Reds and Greens together, but I multiplied the blue channels and re-added the whole thing.


    UDK_Norm_Blend_Solved_zpse5e6f573.jpg~original
  • mAlkAv!An
    Options
    Offline / Send Message
    mAlkAv!An polycounter lvl 5
    olivierth wrote: »
    Both normal maps have the basic compression (TC_Normal I think...) and I've multiplied the additive normal map I want to blend with a 1,1,0 color and added that to the base norm. The norm I'm blending is mostly flat with a few lines elevated. Even the flat parts (base normal blue color) are reducing the effect of the base norm map.

    http://i28.photobucket.com/albums/c208/Olivier_Theriault/UDK_Norm_Blend_Prob_zpse74e6cb7.jpg~original

    Those node thumbnails might be misleading, but judging from the screens you did multiply the base normal map by [0,0,1], not the detail texture. Should be the other way around to prevent major flattening.

    However, multiplying blue channels is also working well.
  • olivierth
    Options
    Offline / Send Message
    olivierth polycounter lvl 9
    Hi mAlkAv!An, I acctually did the same multiply to both the base norm and the detail norm. The detail norm is the up most node, and the base norm is 2 nodes lower than the other one. I should have said it earlier.

    I checked with the base norm alone, and with my setup and it looks like it's not destroying the base norm at all.
  • mAlkAv!An
    Options
    Offline / Send Message
    mAlkAv!An polycounter lvl 5
    Sorry for the confusion, that was a typo. I meant [1,1,0] and was referring to your first pic.
  • Farfarer
    Options
    Offline / Send Message
    From here I've found this is the best method to use, giving the best results;
    float3 baseNormal = tex2D(texBase, uv).xyz * float3( 2,  2, 2) + float3(-1, -1,  0);
    float3 detailNormal = tex2D(texDetail, uv).xyz * float3(-2, -2, 2) + float3( 1,  1, -1);
    float3 combinedNormal = normalize(baseNormal * dot(baseNormal, detailNormal) - detailNormal * baseNormal.z)
    
  • olivierth
    Options
    Offline / Send Message
    olivierth polycounter lvl 9
    Thanks.

    About the code you posted, how do I use it?
  • radiancef0rge
    Options
    Offline / Send Message
    radiancef0rge ngon master
    custom hlsl node in mat ed
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    Or you can do it with nodes.
    Note that the first 2 lines are unpacking the normal maps from 0-1 space to their proper range for this procedure, so you'll want to translate that for use with your existing assets.

    So your base normal will need its blue channel doubled. so multiply it with a vector 3 set to (1,1,2)
    The detail normal will need its red and green channels inverted (multiply node with vector 3 (-1,-1, 1)

    The combined normal can be made of nodes also.

    Dot product between the base and detail after they've been multiplied as above. Them multiply that result by the multiplied base normal. Multiply node using the multiplied detail normal and the blue output from the multiplied base normal. (use a component mask)
    Subtract node with the result of the multiplied base normal and dot product on top, and the result of the multiplied detail normal and base normal's blue channel on bottom.

    Then the result of that subtract node into a normalize node.
Sign In or Register to comment.