Skip to content

Instantly share code, notes, and snippets.

@ciwolsey
Last active June 17, 2016 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ciwolsey/711e808bfe841df98c12e5e581f15355 to your computer and use it in GitHub Desktop.
Save ciwolsey/711e808bfe841df98c12e5e581f15355 to your computer and use it in GitHub Desktop.
Shader "Custom/board_shader" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_penX("Pen X", Range(0,1)) = 0.0
_penY("Pen Y", Range(0,1)) = 0.0
// This is a single render texture
_MainTex("Albedo (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
};
fixed4 _Color;
float _penX;
float _penY;
void surf (Input IN, inout SurfaceOutputStandard o) {
float x = IN.uv_MainTex.x;
float y = IN.uv_MainTex.y;
float penSize = 0.01f;
if (x > _penX && x < _penX + penSize && y > _penY && y < _penY + penSize) {
o.Albedo = float4(1.0f, 1.0f, 1.0f, 1.0f);
}
}
ENDCG
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment