Search Unity

Blending 3 normal maps

Discussion in 'Shaders' started by RoughSpaghetti3211, Oct 22, 2018.

  1. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,709
    hello,

    I have 3 normal maps that I want to bend into a single map using a specified % for each map

    Normal maps A, B, C
    w float(.2,.3,.5)
    BlendedNormal = normalize( float3( A.xy*w.x + B.xy*w.y + C.xy*w.z , A.z*B.z*C.z )

    This this correct ?
     
    Last edited: Oct 22, 2018
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    There's no such thing as "correct" here. It's whatever looks good to you. However if you want to replicate the so called "whiteout" style normal blend, the z components need to be lerped toward 1 based on their blend weight.

    Something like this:

    (A.z * w.x - w.x + 1.0) * (B.z * w.y - w.y + 1.0) * (C.z * w.z - w.z + 1.0)
     
  3. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,709
    I see ok let me go try this, thanks again for the reply