Search Unity

Skinned mesh renderer and masking

Discussion in '2D' started by 11tomi12, Jun 14, 2019.

  1. 11tomi12

    11tomi12

    Joined:
    Feb 25, 2016
    Posts:
    17
    I am using Anima2D to create characters and I need to attach a sprite mask to their renderers (SkinnedMeshRenderer). Would this be possible and if so how could I achieve this?
     
  2. 11tomi12

    11tomi12

    Joined:
    Feb 25, 2016
    Posts:
    17
    I had some success by adding a StencilMask material besides the SpritesDefault, but it caused the texture to be white on start. If I did this during play mode it works perfectly. Any suggestions?
     
  3. zORg_alex

    zORg_alex

    Joined:
    Mar 12, 2014
    Posts:
    20
    Anima2D/Examples/Shaders/VisibleInsideMask.shader and its material is what you need.
    Assign it to SpriteMeshInstance Material. Renderer script overwrites it's material with Instance's material every frame, so don't even try assigning things there.
    That's it.

    I wish somebody wrote this here before I dug all those hours. How many nerve cells did I lose today?
     
    Last edited: Mar 13, 2020