Skip to content

Instantly share code, notes, and snippets.

@korchoon
Last active July 3, 2020 10:52
Show Gist options
  • Select an option

  • Save korchoon/1ff2581694cb406604bcdb02f0f62fac to your computer and use it in GitHub Desktop.

Select an option

Save korchoon/1ff2581694cb406604bcdb02f0f62fac to your computer and use it in GitHub Desktop.
Shader "Hidden/BoneHandles"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
}
SubShader
{
Tags { "Queue" = "Transparent" "RenderType"="Transparent" "ForceSupported" = "True" }
Lighting Off
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
Cull Back
Fog { Mode Off }
ZTest Always
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_instancing
#pragma multi_compile __ WIRE_ON
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
UNITY_INSTANCING_BUFFER_START(Props)
UNITY_DEFINE_INSTANCED_PROP(float4, _Color)
UNITY_INSTANCING_BUFFER_END(Props)
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
o.vertex = UnityObjectToClipPos(v.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
fixed4 col = UNITY_ACCESS_INSTANCED_PROP(Props, _Color);
#ifdef WIRE_ON
col.a = 1.0f;
#endif
return col;
}
ENDCG
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment