Search Unity

  1. Full schedule for #UniteBerlin is now available! Featuring talks on our roadmap, hands-on labs and much more! Check it out!
    Dismiss Notice
  2. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  3. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

[FREE] [OPEN-SOURCE] Outline Effect

Discussion in 'Assets and Asset Store' started by cakeslice, Mar 28, 2015.

  1. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    3,886
    The renderer is underneath the main avatar on a child game object, You'll need to look for the renderer using GetComponentInChildren<SkinnedMeshRenderer>(), assuming you put your script on the game object with the DCA.
     
  2. unity_e37J3FSssmROgA

    unity_e37J3FSssmROgA

    Joined:
    Feb 28, 2018
    Posts:
    4
    It worked! Thank you, Jaimi.
    Here is the code I've used (not sure if its the best):

    Code (CSharp):
    1.  
    2. private void Update()
    3.     {
    4.        
    5.         if (!isUpdated)
    6.         {
    7.  
    8.             if (transform.childCount > 0)
    9.             {
    10.                 foreach (Transform child in transform)
    11.                 {
    12.                     if (child.GetComponent<SkinnedMeshRenderer>() !=  null)
    13.                     {
    14.                         child.gameObject.AddComponent<cakeslice.Outline>();
    15.                         isUpdated = true;
    16.                     }
    17.                 }
    18.  
    19.             }
    20.         }
    21.        
    22.     }
    23.  
     
    Jaimi likes this.
  3. hublard

    hublard

    Joined:
    Aug 19, 2015
    Posts:
    13
    Is it possible to draw outline only when object is behind an other specific sprite like house/wall?

    for example:

    i got a 2d top down game. all objects are sprites. now when a player is behind a house then it should draw the outline of the player behind the house.

    right now when it put script on player. there is always drawn a outline anyway if player is behind an object or not.
     
  4. jexmatex

    jexmatex

    Joined:
    Jun 23, 2016
    Posts:
    29
    Hello,

    Many thanks for this very useful asset,
    does anyone achieve to make it work with HDR activated ?

    thx by advance
     
  5. brunzero

    brunzero

    Joined:
    Jul 10, 2015
    Posts:
    1
    does anyone have any insight on to how i would go about smoothing these lines?
     
  6. seijik42

    seijik42

    Joined:
    Sep 8, 2013
    Posts:
    5
    Thank you for great plugin!
    Currently I'm facing an issue and not sure where to check.

    When I use this with ARKit on mobile, outline effect doesn't appear.

    - Outline effect + ARKit + run on iMac editor: works!
    - Outline effect + example project + run on iPhone: works!
    - Outline effect + ARKit + run on iPhone: No outline

    Has anybody tried this with ARKit?
    I'm a programmer so I can debug myself but no idea where to start first..
    Even no error log is showing.

    Thanks!
     
  7. Setsuki

    Setsuki

    Joined:
    Aug 21, 2012
    Posts:
    9
    Almost perfect, a few quirks here and there that are easy to fix depending on the situation great work!
     
  8. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    228
    This is a very good outlining asset.

    For reference if anyone wants to use it for VR, it's a bit expensive. In our profiler, it consumes 0.3ms with the effect disabled, and 1.0ms with it enabled on a few objects.
     
  9. m4a44

    m4a44

    Joined:
    Mar 13, 2013
    Posts:
    12
    So, I believe I can help you with supporting single pass stereoscopic rendering (just had the problem where the right eye is offset and had to get it working). And it also looks more performant than the secondary camera technique.

    Instead of using a secondary camera (the "outlineCamera"), I am now using the main camera with an initial CommandBuffer (the one that draws the objects to be outlined).
    mainCam.AddCommandBuffer(CameraEvent.BeforeImageEffects, outlineCommandBuffer);


    That outlineCommandBuffer then draws to a RenderTexture (along side the rest of the main camera's normal rendering) that I then use to apply the rest of the effects in OnRenderImage.

    The only weird thing I saw was that the RenderTexture didn't clear properly, but I fixed that by putting a clear into the buffer at the beginning (after I assigned the RenderTexture).
    outlineCommandBuffer.ClearRenderTarget(true, true, Color.black);


    I hope this helps you and other people.
     
    Last edited: Apr 20, 2018
    goliathmb and ekergraphics like this.
  10. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    228
  11. occurrentarts

    occurrentarts

    Joined:
    Apr 29, 2014
    Posts:
    3
    I'm having this issue also in 2018.2.0b2
    It looks like this asset and ARKit's UnityARVideo.cs both use command buffers, could there be a conflict there?
    Or perhaps there's an issue with Metal?

    I get this error
    A null value was found where an object instance was required.
    in xcode when i try and turn on the object outline script with:
    this.gameObject.GetComponent<cakeslice.Outline>().enabled = true;

    which suggests to me that the component is removed when built on iOS.

    Does anyone know why this might be happening?
     
  12. Zulhalsing

    Zulhalsing

    Joined:
    Feb 25, 2017
    Posts:
    1
    Dear sir,

    May I know the possibility to get the information of object outline volume and position array from this asset? Thanks a lot.
     
  13. olekkus

    olekkus

    Joined:
    Nov 21, 2017
    Posts:
    1
    Hi

    I'm using the enable outline effect (with playmaker) on an asset that has no LOD's and it works fine but on an asset that is having LOD component and than use it on LOD0 (the closest will get outline when selected) and the script doesnt seem to react whan willing to disable the outline. enabling works fine tho but disable doesn't work for me with assets with LOD
     
  14. m4a44

    m4a44

    Joined:
    Mar 13, 2013
    Posts:
    12
    If you're referring to the changes I mentioned, they weren't done to the cakeslice outline effect. So I don't have changes to submit.
    The in house outline effect that I'm currently using is far simpler, but used to use the same technique (a secondary camera).
     
  15. XN4k3dBR

    XN4k3dBR

    Joined:
    Sep 15, 2015
    Posts:
    3
    The outline's seem to be rendered ontop of everything else in my scene, see imagem atached.
    Help-me!.
     

    Attached Files: