SelfIllumBumpedSpecular.shader 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. Shader "PROTOFACTOR/LEGACY/Self-Illumin/Reflective/Bumped Specular" {
  2. Properties {
  3. _Color ("Main Color", Color) = (1,1,1,1)
  4. _SpecColor ("Specular Color", Color) = (0.5,0.5,0.5,1)
  5. _Shininess ("Shininess", Range (0.01, 1)) = 0.078125
  6. _ReflectColor ("Reflection Color", Color) = (1,1,1,0.5)
  7. _MainTex ("Base (RGB) RefStrGloss (A)", 2D) = "white" {}
  8. _Cube ("Reflection Cubemap", Cube) = "" {}
  9. _BumpMap ("Normalmap", 2D) = "bump" {}
  10. _Illum ("IlluminColor (RGB) Intensity (A)", 2D) = "black" {}
  11. }
  12. SubShader {
  13. Tags { "RenderType"="Opaque" }
  14. LOD 400
  15. CGPROGRAM
  16. #pragma surface surf BlinnPhong
  17. #pragma target 3.0
  18. //input limit (8) exceeded, shader uses 9
  19. #pragma exclude_renderers d3d11_9x
  20. sampler2D _MainTex;
  21. sampler2D _BumpMap;
  22. samplerCUBE _Cube;
  23. sampler2D _Illum;
  24. fixed4 _Color;
  25. fixed4 _ReflectColor;
  26. half _Shininess;
  27. struct Input {
  28. float2 uv_MainTex;
  29. float2 uv_BumpMap;
  30. float3 worldRefl;
  31. INTERNAL_DATA
  32. };
  33. void surf (Input IN, inout SurfaceOutput o) {
  34. fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
  35. fixed4 illum = tex2D(_Illum, IN.uv_MainTex);
  36. fixed4 c = tex * _Color;
  37. o.Albedo = c.rgb;
  38. o.Gloss = tex.a;
  39. o.Specular = _Shininess;
  40. o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
  41. float3 worldRefl = WorldReflectionVector (IN, o.Normal);
  42. fixed4 reflcol = texCUBE (_Cube, worldRefl);
  43. reflcol *= tex.a;
  44. o.Emission = reflcol.rgb * _ReflectColor.rgb * (1-illum.a)+ illum.rgb * illum.a;
  45. o.Alpha = reflcol.a * _ReflectColor.a * (1-illum.a)+ illum.a;
  46. }
  47. ENDCG
  48. }
  49. FallBack "Reflective/Bumped Specular"
  50. }