Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

[Shadergraph] How to make outline effect?

Discussion in 'Graphics Experimental Previews' started by Bitfabrikken, Aug 9, 2018.

  1. Bitfabrikken

    Bitfabrikken

    Joined:
    Mar 24, 2013
    Posts:
    34
    Can anyone point me in the right direction for making a shader that renders the object with an outline, just like in the Unity Editor Scene View?`

    I've played around quite a bit with the ShaderGraph, but haven't been able to reproduce it. I'm starting to think it might not even be possible via a ShaderGraph shader.. Hope someone can prove me wrong!

    Just like this (how to make the green outline?):

    upload_2018-8-9_14-7-46.png
     
  2. nmad

    nmad

    Joined:
    Jul 28, 2013
    Posts:
    8
    up :(
    I´m looking for the same effect.
     
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,383
    It is not possible. This style of outline requires the use of render textures, custom scripting, and multiple shader passes at different times and used in different ways, and most of the time not rendering the model in question.

    Unity's Shader Graph makes one pass shaders that can be used on a model placed in the scene, and that's it. There's a lot you can do with that one pass, but this specific effect is not one of them.

    Options for doing outlines in Shader Graph are currently limited to fresnel style effects.
     
    matthewpoletin likes this.
  4. sandeepsmartest

    sandeepsmartest

    Joined:
    Nov 7, 2012
    Posts:
    139
    We are in 2019.Still is this not possible???Thanks
     
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,383
    Still not possible.

    More to the point it will never be something possible with Shader Graph alone, even if they do eventually add support for writing post processing shaders using it. This kind of effect will always require some amount of scripting to accomplish.
     
    sandeepsmartest likes this.
  6. dhaminitinCbre

    dhaminitinCbre

    Joined:
    Apr 24, 2019
    Posts:
    6
    Has any one found out a solution for this yet?
     
  7. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    700
    I don't think this kind of effect would necessarily never need scripting to accomplish- It can be done easily enough in Unreal without Blueprint scripting for example. https://www.parallelcube.com/2017/12/05/outline-effect-part-1/

    I know that wouldn't be possible in Unity right now, but my point is that what's possible without scripting is largely a matter of what nice features Unity includes in their tools and/or render pipelines.
     
  8. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,383
    Unreal has a lot of abstraction and data oriented systems. In effect you're still doing a form of programming by creating objects and assigning values that is generating code behind the scenes. That tutorial also seems to gloss over a ton of stuff that is absolutely being done in blueprints in the example videos that they're not covering at all.

    Just looking over the first page, that's creating a new render texture, rendering to said render texture using a stencil value, extracting that stencil value to an R8 render texture, then passing that texture onto the shader. Most of that is being done "automagically", but you are in effect still doing some scripting to get it.

    Also my point stands that this is not something you can do with Shader Graph alone. You'll need to do some scripting, whether it's in the form of actual C# code as it is now, or some sort of future node based scripting system ala blueprints, or via automagical systems like that custom pass system Unreal has. It'll still take more steps. Indeed, Unity's own Custom Render Pass feature might be able to accomplish something pretty close to the workflow of that Unreal tutorial.
     
    nvillanueva likes this.