Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Cg shader using discard" {
- Properties {
- _MainTex ("Texture", 2D) = "white" {}
- _TargetTex("Texture", 2D) = "white" {}
- }
- SubShader {
- Pass {
- // Cull Off // turn off triangle culling, alternatives are:
- // Cull Back (or nothing): cull only back faces
- // Cull Front : cull only front faces
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- // uniform float _DistanceNear;
- uniform texture2D _MainTex;
- uniform texture2D _TargetTex;
- struct vertexInput {
- float4 vertex : POSITION;
- float2 uv_Maintex:TEXCOORD0 ;
- float2 uv_TargetTex: TEXCOORD1;;
- };
- struct vertexOutput {
- float4 pos : SV_POSITION;
- half4 maintex_alpha : TEXCOORD0;
- half4 targettex_alpha : TEXCOORD1;
- };
- vertexOutput vert(vertexInput input)
- {
- vertexOutput output;
- output.pos = mul(UNITY_MATRIX_MVP, input.vertex);
- //output.posInObjectCoords = input.vertex;
- //output.
- return output;
- }
- float4 frag(vertexOutput input) : COLOR
- {
- float2 uv_Maintex;
- float2 uv_TargetTex;
- input.maintex_alpha = tex2D (sampler2D, IN.uv_MainTex );
- //maintex_alpha = tex2D (_MainTex, IN.uv_MainTex);
- input.targettex_alpha = tex2D (sampler2D, IN.uv_TargetTex );
- if (maintex_alpha.a < 0.2)
- {
- targettex_alpha.a = 0;
- }
- return targettex_alpha;
- }
- ENDCG
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement