61 lines
1.4 KiB
Plaintext
61 lines
1.4 KiB
Plaintext
|
|
Shader "AR/GrayCylinder" {
|
|
|
|
Properties {
|
|
_MainTex ("Cylinder Texture", 2D) = "white" {}
|
|
}
|
|
|
|
SubShader{
|
|
Tags { "RenderType" = "Opaque" }
|
|
|
|
Pass {
|
|
|
|
Cull Off
|
|
|
|
|
|
CGPROGRAM
|
|
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
fixed4 _Color;
|
|
|
|
struct Input {
|
|
float4 position : POSITION;
|
|
float4 color : COLOR;
|
|
float2 coord : TEXCOORD0;
|
|
};
|
|
|
|
struct VertexToFragment {
|
|
float4 position : SV_POSITION;
|
|
float4 color : COLOR;
|
|
float2 coord : TEXCOORD0;
|
|
};
|
|
|
|
VertexToFragment vert(Input IN) {
|
|
VertexToFragment OUT;
|
|
OUT.position = UnityObjectToClipPos( IN.position);
|
|
OUT.color = IN.color;
|
|
OUT.coord = IN.coord;
|
|
return OUT;
|
|
}
|
|
|
|
sampler2D _MainTex;
|
|
float2 _NoiseVector;
|
|
|
|
|
|
fixed4 frag(VertexToFragment IN) : SV_Target {
|
|
half4 c = tex2D(_MainTex, IN.coord);
|
|
|
|
float rand = frac(sin(dot(IN.position, _NoiseVector)) * 43758.5453);
|
|
|
|
c.rgb = dot(c.rgb, float3(0.3, 0.59, 0.11));
|
|
|
|
c.rgb -= rand*0.2;
|
|
return c;
|
|
}
|
|
|
|
ENDCG
|
|
}
|
|
}
|
|
} |