Created
February 5, 2019 14:42
-
-
Save ninpl/f99c5c1957a9a7b6467108a5a1b5dcb5 to your computer and use it in GitHub Desktop.
Shader simple - Ley de Lambert
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 "Moon Antonio/SoftLambert" | |
{ | |
Properties | |
{ | |
_MainTex("Albedo (RGB)", 2D) = "white" {} | |
} | |
SubShader | |
{ | |
Tags { "RenderType" = "Opaque" } | |
LOD 200 | |
CGPROGRAM | |
// En lugar de standart, use un modelo de iluminacion custom | |
#pragma surface surf SimpleLambert | |
#pragma target 3.0 | |
sampler2D _MainTex; | |
struct Input | |
{ | |
float2 uv_MainTex; | |
}; | |
void surf(Input IN, inout SurfaceOutput o) | |
{ | |
o.Albedo = tex2D(_MainTex, IN.uv_MainTex).rgb; | |
} | |
half4 LightingSimpleLambert(SurfaceOutput s, half3 lightDir, half atten) | |
{ | |
half NdotL = dot(s.Normal, lightDir); | |
half4 c; | |
// _LightColor0 variable que contiene el color de la luz que se calcula. | |
c.rgb = s.Albedo * _LightColor0.rgb * (NdotL * atten * 1); | |
c.a = s.Alpha; | |
return c; | |
} | |
ENDCG | |
} | |
FallBack "Diffuse" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment