I’m told that Unity overhauled the shader compile system in version 4.5. I am unable to get any examples of a shader that sets the size of vertices to work in Unity 4.5.
I am trying to build a point cloud editor that will allow me to scale the visible point size as the user scales a model. I have seen several posts claiming this approach works but they are all a couple years old…
Here is the shader I have been trying:
Shader "Custom/VertexColor" {
SubShader {
Pass {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 200
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct VertexInput {
float4 v : POSITION;
float4 color: COLOR;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float4 col : COLOR;
float4 size : PSIZE;
};
VertexOutput vert(VertexInput v) {
VertexOutput o;
o.pos = mul(UNITY_MATRIX_MVP, v.v);
o.col = v.color;
o.size = 10.0;
return o;
}
float4 frag(VertexOutput o) : COLOR {
return o.col;
}
ENDCG
}
}
}