Created
February 6, 2013 03:14
-
-
Save anonymous/4719937 to your computer and use it in GitHub Desktop.
A simple attempt at a Specular "Conductivity" shader for Unity3D.
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 "Rog/SpecConduct" { | |
Properties { | |
_Color ("Main Color", Color) = (1,1,1,1) | |
_FakeLight ("Fake Light", Color) = (1, 1, 1, 1) | |
_SpecIntensity ("Specular Intensity", Range (1.0, 4.0 )) = 1.0 | |
_SpecPower ("Specular Power", Range (0.01, 1.0 )) = 0.078125 | |
_Conduct ("Specular Conductivity", Range (3.0, 0.0 )) = 0.01 | |
_MainTex ("Diffuse (RGB) SpecMap (A)", 2D) = "white" {} | |
} | |
SubShader { | |
Tags { "RenderType"="Opaque" } | |
LOD 300 | |
CGPROGRAM | |
#pragma surface surf BlinnPhong | |
#pragma target 3.0 | |
fixed4 _Color; | |
fixed4 _FakeLight; | |
half _SpecIntensity; | |
half _SpecPower; | |
half _Conduct; | |
sampler2D _MainTex; | |
struct Input { | |
float2 uv_MainTex; | |
}; | |
void surf (Input IN, inout SurfaceOutput o) { | |
half4 tex = tex2D(_MainTex, IN.uv_MainTex); | |
o.Albedo = tex.rgb * _Color.rgb; | |
_SpecColor = (_Color * _SpecIntensity) + (_FakeLight * _Conduct); | |
o.Gloss = 1; | |
o.Specular = _SpecPower; | |
} | |
ENDCG | |
} | |
FallBack "Diffuse" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment