Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Need help with finding/creating a "silhouette offset" shader

Discussion in 'Shaders' started by Jomester, Jul 11, 2019.

  1. Jomester

    Jomester

    Joined:
    Jul 11, 2019
    Posts:
    1
    Hey there. I'm currently trying to create a mod for an existing game using unity, but I'm having trouble finding the shader I need. I have no idea how to create shaders, so that's why I'm asking here. The mod I am trying to make is about Persona 5, so I need a shader which adds a red silhouette with a slight offset to the side. An example of this is at the bottom of this post. If anyone can point me in the right direction (or is even generous enough to create one), it would be a huge help.

    (Also sorry if this is posted in the wrong place. If it is, just let me know and I'll quickly fix it)

    download.png
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    6,970
    There are plenty of outline or silhouette shaders out there you can find for Unity which uses a two pass approach; render the object once scaled up or puffed up, then the main pass afterward. Find one of the examples that pushes the normals out in screen space, and hard code the normal to a direction down and right.

    For example:
    http://wiki.unity3d.com/index.php?title=Silhouette-Outlined_Diffuse&oldid=17519

    Take the "OUTLINE" pass from one of these examples and replace:
    float3 norm = mul ((float3x3)UNITY_MATRIX_IT_MV, v.normal);
    with:
    float3 norm = normalized(float3(1,-1,0));
     
    neoshaman likes this.