Search Unity

How to render SKinned Mesh By Graphics.DrawMeshNow

Discussion in 'Shaders' started by Lulucifer, Jul 29, 2014.

  1. Lulucifer

    Lulucifer

    Joined:
    Jul 8, 2012
    Posts:
    358
    I want to outline a charactor, But I dont want to change it's Shader, I Just want to use Graphics.DrawMeshNow() in OnPostRender,but it always seems something wrong here is the code
    Code (CSharp):
    1. void OnPostRender()
    2.     {
    3.  
    4.         Mesh ms = new Mesh ();
    5.         skin.BakeMesh (ms);//bake mesh
    6.         mat.SetPass (0);//MyOut Line Pass
    7.         Graphics.DrawMeshNow (ms, skin.transform.localToWorldMatrix);
    8.     }
    9. }
    Anyone knows how to fix this?