Search code examples
unity-game-engineshadershader-graphurp

How can I fix these gaps in my outline shader?


My game uses very low-poly models for most of its geometry, and my current outline shader, which inverts normals and "scales up" the material, doesn't really cut it for this. Admittedly I have very little experience with shader graph but I'm trying my best here. These outlines are part of the Render Objects renderer feature in URP.

Here is an example of the issue in question, as well as the shader graph itself.


Solution

  • The shader you made requires smoothed normals for all vertices. If you need to have an edge on one of your outlined objects, you will get the following result with gaps because the cube doesn't have smooth normals.

    enter image description here

    And your models being very low-poly makes it a lot more visible.

    I'd suggest just using a Frensel Node and attach it to a step node to get harsh outlines which you can just connect to emmision or something since it would probably only take 4-5 Nodes