Created
March 17, 2017 04:16
-
-
Save thelucre/40561b2708b641f475ff7491cefadb48 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Custom/ModulusDiscardSizing" { | |
Properties { | |
_Color ("Color", Color) = (1,1,1,1) | |
} | |
SubShader { | |
Pass { | |
CGPROGRAM | |
#pragma vertex vert | |
#pragma fragment frag | |
#include "UnityCG.cginc" | |
// vertex input: position, second UV | |
struct appdata { | |
float4 vertex : POSITION; | |
float4 texcoord1 : TEXCOORD1; | |
}; | |
struct v2f { | |
float4 pos : SV_POSITION; | |
float4 uv : TEXCOORD0; | |
}; | |
v2f vert (appdata v) { | |
v2f o; | |
o.pos = UnityObjectToClipPos(v.vertex ); | |
o.uv = float4( v.texcoord1.xy, 0, 0 ); | |
return o; | |
} | |
half4 frag( v2f i ) : SV_Target { | |
half4 c = frac( i.uv ); | |
float4 n = i.uv * (100.0 + (1.0+_SinTime[3])*10.0); | |
if(any(n%20 > (1.0+_SinTime[3]) * 10.0)) { discard; } | |
return c; | |
} | |
ENDCG | |
} | |
} | |
FallBack "Diffuse" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment