1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
- Shader "Custom/HeadSnapperShader"
- {
- Properties
- {
- _MainTex ("Texture", 2D) = "white" {} //include a texture as a property
- }
- SubShader
- {
- // No culling or depth
- Cull Off ZWrite Off //ZTest Always
- Pass
- {
- CGPROGRAM
- #pragma vertex vertexToFragment
- #pragma fragment giveColor
-
- #include "UnityCG.cginc"
- //info from vertex on the mesh
- struct appdata
- {
- float4 vertex : POSITION;
- float2 uv : TEXCOORD0;
- };
- //info for fragment function
- struct v2f
- {
- float2 uv : TEXCOORD0;
- float4 vertex : SV_POSITION;
- };
- v2f vertexToFragment (appdata v)
- {
- v2f o;
- o.vertex = UnityObjectToClipPos(v.vertex);
- o.uv = v.uv;
- return o;
- }
-
- sampler2D _MainTex;
- float4 _MainTex_TexelSize;
-
- float _darkness;
- //returns color in float 4 variable given our v2f
- float4 giveColor (v2f i) : SV_Target
- {
- float4 col = tex2D(_MainTex,i.uv+float2(_MainTex_TexelSize.x * 0, _MainTex_TexelSize.y * 0));
- return col * (1.0 - _darkness);
- }
- ENDCG
- }
- }
- }
|