Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Blending 3 normal maps

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

  1. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,695
    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,229
    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,695
    I see ok let me go try this, thanks again for the reply