Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    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:
    8,684
    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.
unityunity