You know, I have no idea what the best way to do this is hahah. The use case is, I want to render a specific submesh of a mesh (readonly) with 3 submeshes. As far as I can tell the only way to do this with MeshRenderer is to put in dummy shaders in the material slots that I don't want. Is there an optimal "Don't render anything" method for a shader?
EDIT: Ignore my post, for it is dumb. Couldn't you just uncheck the "Mesh Renderer" component in the Unity Editor?
Have you tried an empty sub shader? Disabling the MeshRenderer would prevent anything from being rendered, including the sub mesh that Fenrisul is trying to isolate.
I use this shader to render just nothing when I have a case like yours: Code (CSharp): Shader "Custom/Invisible" { SubShader { Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag struct v2f { float4 pos : SV_POSITION; }; v2f vert () { v2f o; o.pos = fixed4(0,0,0,0); return o; } fixed4 frag (v2f i) : COLOR0 { return fixed4(0,0,0,0); } ENDCG } } }
That should be pretty good. You might want to throw ZWrite Off and ColorMask 0 in there for good measure. Completely null shader option would be nice, though.
Code (csharp): Shader "Spine/HiddenPass" { SubShader { Tags {"Queue" = "Geometry-1" } Lighting Off Pass { ZWrite Off ColorMask 0 } } } Yea, thats basically what I ended up doing. I would love it so much if leaving a material channel blank resulted in nothing being called but yea. Thanks
Yea I wanted to avoid doing full submesh copies every single frame times say... 10... per object heh. I'm working on refactoring the renderer itself to pump directly into independent meshes with support for double buffering now... joy.
If you just want to render a specific submesh, look at graphics.drawmesh. you can specify which submesh, which material, etc.
Yeeeaaa I was trying to avoid that heh. Mostly because I don't think you can set Sorting Order/Layer with Graphics.
It accepts a layer value, and works like everything else in my experience (sorting, etc). Thought...to be honest, it's been a while since I used it for true transparent objects, so I honestly may be mistaken here.
It accepts a Layer value yea, but not Sorting Layer or Sorting Order if I remember / am reading right.