Search Unity

Question Merging normal maps with alpha information (FIXED)

Discussion in 'Shader Graph' started by Lyralei1, Mar 17, 2023.

  1. Lyralei1

    Lyralei1

    Joined:
    Feb 16, 2019
    Posts:
    2
    Hey everyone!

    Firstly, i'm quite the beginner when it comes to Unity's shader graph (or shader coding even), so if there are ways to improve this, please let me know.

    Now to the issue at hand:

    I'm currently working on a feature where the player can "pick and choose" what kind of eyelids, noses and chins their character should have, to make it easier to create certain ethnicities.

    I figured, it would be less time-consuming to just make 30+ different normal maps, and instead, just creating them as, let's say, puzzle pieces.

    However, by adding them together, I keep getting these weird "white-ish" lines added on the face, where the alpha channels end eventually. Causing some odd glitchy lines on the actual mesh as well.

    How I had this in mind is as followed:

    • We'd have a base normal map of the face, where the eyes, nose, chin are no longer there. (See images)
    • Each eyes/chin/nose normal map has a corresponding alpha file for it (this is a separate file, just for experimenting for now)
    • Eventually, blend both the "base" normal map with the user chosen eyes/chin/nose.

    What I've tried so far:

    • Making sure that the alpha's don't have soft edges, but hard edges. This 'minifies' the issue, but now it's a thin, hard line that we're seeing, rather than a soft thick line.
    • Making sure that the normal itself doesn't have "Empty data", and simply having a background, rather than it's being transparent (Which unity then converts into yellow as we change the image from default > Normal map, understandable as normal maps don't have alpha channels normally).
    • Checked out the "mixing" shader from the Unity project, which is explained here: https://blog.unity.com/technology/n...he-surface-gradient-framework-in-shader-graph
    • Instead of using "Blend", I also tried using "BlendNormals", but this kept making the normals lighter and lighter, thus loosing their "intensity".

    Currently, the project is on URP, using the LIT material for the shader, in case this is necessary info.

    Thanks!
     

    Attached Files:

  2. Lyralei1

    Lyralei1

    Joined:
    Feb 16, 2019
    Posts:
    2
    Fixed it! Turns out it was an issue with the alpha mapping (and simplified the graph as well by only using multiply and add)

    In case someone else finds themselves with something similar, make sure to first check if your alpha maps are:
    - Not overlapping other alpha maps. This seems to add those lines too
    - Where possible, make sure to not have really soft edges, but also not too harsh.