Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Custom/On Off Lighting"
- {
- Properties
- {
- _Color ("Color", Color) = (1,1,1,1)
- _Shadow ("Shadow Color", Color) = (1,1,1,1)
- _ShadowStrength ("Shadow Strength", Range(0,1)) = 0.2
- }
- SubShader
- {
- Tags { "RenderType" = "Opaque" }
- CGPROGRAM
- #pragma surface surf OnOff fullforwardshadows
- half4 _Color;
- half4 _Shadow;
- half _ShadowStrength;
- // just want to know if we're in light or shadow, so simply ON/OFF (thus the SIGN)
- half4 LightingOnOff (SurfaceOutput s, half3 lightDir, half atten)
- {
- half NdotL = dot (s.Normal, lightDir);
- return abs(sign(NdotL * atten));
- }
- // not used but still here, w/e
- struct Input { float2 uv_MainTex; };
- // Want to somehow take the lighting result above, and make the result color be the Color value,
- // shifted towards Shadow value (ex. result = lerp(_Color, _Shadow, LightingResult * _ShadowStrength))
- void surf (Input IN, inout SurfaceOutput o)
- {
- o.Albedo = _Color.rgb;
- o.Gloss = 0;
- o.Specular = 0;
- }
- ENDCG
- }
- Fallback "Diffuse"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement