Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Unlit/StripeShader"
- {
- Properties
- {
- // Color property for material inspector, default to white
- // _Color is the color of the grid lines, actually (need to flip these
- // at some point)
- _Color ("Main Color", Color) = (1,1,1,0.5)
- // _Color2 is actually the main body color
- _Color2 ("Other Color", Color) = (1,1,1,0.5)
- // Offset the grid pattern
- _OffsetX ("X Offset", Float) = 0
- _OffsetY ("Y Offset", Float) = 0
- }
- SubShader
- {
- // TODO: Figure out why transparency doesn't actually work right now
- Tags { "Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True" }
- Pass
- {
- ZWrite Off
- Blend DstAlpha OneMinusDstAlpha
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- float4 vert (float4 vertex : POSITION) : SV_POSITION
- {
- // Basically just pass through the vertex coordinates in scale
- return mul(UNITY_MATRIX_MVP, vertex);
- }
- // color from the material
- fixed4 _Color;
- fixed4 _Color2;
- float _OffsetX;
- float _OffsetY;
- // pixel shader, no inputs needed
- fixed4 frag (float4 i : POSITION) : COLOR
- {
- // First two out of 10 pixel along either access, return hash color
- if((i.x + _OffsetX) % 10.0f < 2.0f || (i.y + _OffsetY) % 10.0f < 2.0f) {
- return _Color;
- } else {
- // Return main body color
- return _Color2;
- }
- }
- ENDCG
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement