Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "GameboyRamp"
- {
- Properties
- {
- _LightinRamp("_LightinRamp", 2D) = "white" {}
- _MainTexture("_MainTexture", 2D) = "gray" {}
- _TexInfluence("_TexInfluence", Range(0,1) ) = 1
- _TextureDarkness("_TextureDarkness", Range(0,1) ) = 0.5
- }
- SubShader
- {
- Tags
- {
- "Queue"="Geometry"
- "IgnoreProjector"="False"
- "RenderType"="Opaque"
- }
- Cull Back
- ZWrite On
- ZTest LEqual
- ColorMask RGBA
- Fog{
- }
- CGPROGRAM
- #pragma surface surf BlinnPhongEditor vertex:vert
- #pragma target 2.0
- sampler2D _LightinRamp;
- sampler2D _MainTexture;
- float _TexInfluence;
- float _TextureDarkness;
- struct EditorSurfaceOutput {
- half3 Albedo;
- half3 Normal;
- half3 Emission;
- half3 Gloss;
- half Specular;
- half Alpha;
- half4 Custom;
- };
- inline half4 LightingBlinnPhongEditor_PrePass (EditorSurfaceOutput s, half4 light)
- {
- float4 Luminance0= Luminance( light.xyz ).xxxx;
- float4 Subtract0=float4( s.Albedo.x, s.Albedo.y, s.Albedo.z, 1.0 ) - _TextureDarkness.xxxx;
- float4 Multiply0=Subtract0 * _TexInfluence.xxxx;
- float4 Add1=Luminance0 + Multiply0;
- float4 Assemble0=float4(Add1.x, float4( 0.0, 0.0, 0.0, 0.0 ).y, float4( 0.0, 0.0, 0.0, 0.0 ).z, float4( 0.0, 0.0, 0.0, 0.0 ).w);
- float4 Tex2D0=tex2D(_LightinRamp,Assemble0.xy);
- return Tex2D0;
- }
- inline half4 LightingBlinnPhongEditor (EditorSurfaceOutput s, half3 lightDir, half3 viewDir, half atten)
- {
- half3 h = normalize (lightDir + viewDir);
- half diff = max (0, dot ( lightDir, s.Normal ));
- float nh = max (0, dot (s.Normal, h));
- float spec = pow (nh, s.Specular*128.0);
- half4 res;
- res.rgb = _LightColor0.rgb * diff;
- res.w = spec * Luminance (_LightColor0.rgb);
- res *= atten * 2.0;
- return LightingBlinnPhongEditor_PrePass( s, res );
- }
- struct Input {
- float2 uv_MainTexture;
- };
- void vert (inout appdata_full v, out Input o) {
- float4 VertexOutputMaster0_0_NoInput = float4(0,0,0,0);
- float4 VertexOutputMaster0_1_NoInput = float4(0,0,0,0);
- float4 VertexOutputMaster0_2_NoInput = float4(0,0,0,0);
- float4 VertexOutputMaster0_3_NoInput = float4(0,0,0,0);
- }
- void surf (Input IN, inout EditorSurfaceOutput o) {
- o.Normal = float3(0.0,0.0,1.0);
- o.Alpha = 1.0;
- o.Albedo = 0.0;
- o.Emission = 0.0;
- o.Gloss = 0.0;
- o.Specular = 0.0;
- o.Custom = 0.0;
- float4 Sampled2D0=tex2D(_MainTexture,IN.uv_MainTexture.xy);
- float4 Master0_1_NoInput = float4(0,0,1,1);
- float4 Master0_2_NoInput = float4(0,0,0,0);
- float4 Master0_3_NoInput = float4(0,0,0,0);
- float4 Master0_4_NoInput = float4(0,0,0,0);
- float4 Master0_5_NoInput = float4(1,1,1,1);
- float4 Master0_7_NoInput = float4(0,0,0,0);
- float4 Master0_6_NoInput = float4(1,1,1,1);
- o.Albedo = Sampled2D0;
- o.Normal = normalize(o.Normal);
- }
- ENDCG
- }
- Fallback "Diffuse"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement