Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

Unity Normal map compositing using the surface gradient framework in Shader Graph

Discussion in 'Shader Graph' started by mortenm, Nov 21, 2019.

  1. mortenm


    Unity Technologies

    Nov 6, 2015
    Trying to correctly combine/blend two or more normal maps in a shader has historically been a difficult and frustrating problem. Particularly for bump maps of different forms such as tangent space, object space, triplanar projection, parallel projection (decals) or 3D texture.
    Traditionally real-time graphics has only supported tangent space normal mapping on UV0 since it is customary to compute one tangent space per vertex based on UV0.
    The surface gradient based framework defines a new approach which makes doing correct blends easy/intuitive to both technical artists and graphics engineers even in advanced scenarios where multiple sets of texture coordinates are used (procedural texure coordinates too) and different forms of bump maps as described above.
    Read more in this blog post.

  2. laurentlavigne


    Aug 16, 2012
  3. jbooth


    Jan 6, 2014
    So I have implemented this into a number of large shader frameworks now, and maybe I'm missing something or doing something wrong, but I find the visual difference very hard to spot in most cases.

    For instance, toggling between regular tangent space normal maps and surface gradients on a basic terrain shader with height blending is visually identical. I suspect this is because the blend areas are small between textures due to the height blending. However, even when doing a linear blend it's not noticable.

    Adding triplanar to the mix, the difference is again visually identical, which is surprising to me.

    The one place I do see a difference is when layering normal maps - like detail texturing, or using macro normal maps to break up tiling. Here, the normal direction is a bit more muted and doesn't blow out as easy, but again I find the difference relatively minor.

    In all of these cases, I'm converting from a tangent space normal map into a surface gradient using the interpolated TBN matrix, rather than say storing derivative maps directly, and I'm curious if this is causing my results to be generally the same?