Seven is the number.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.2 KiB

4 years ago
  1. Shader "Custom/Planet_Base"
  2. {
  3. Properties{
  4. _MainTex("Base (RGB)", 2D) = "white" {}
  5. _AOalbedo("AO in albedy", Range(0.0, 2)) = 0.0
  6. [NoScaleOffset]_Glossiness("Glossiness", 2D) = "black" {}
  7. _SmoothnessShift("Smoothness shift", Range(-1, 1)) = 0.0
  8. _AOsmoothness("AO in smoothness", Range(-1, 1)) = 0.0
  9. [NoScaleOffset]_BumpMap("Normal Map", 2D) = "bump" {}
  10. _BumpScale("Bump Scale", Range(0.0, 1.0)) = 1.0
  11. [NoScaleOffset]_AOMap("AO Map", 2D) = "white" {}
  12. _AOintensity("AO intensity", Range(0.2, 5)) = 1.0
  13. [NoScaleOffset] _EmissionMap("Emission Map", 2D) = "white" {}
  14. _EmissionScale("Emission Scale", Float) = 0.0
  15. }
  16. CGINCLUDE
  17. //@TODO: should this be pulled into a shader_feature, to be able to turn it off?
  18. #define _GLOSSYENV 1
  19. #define UNITY_SETUP_BRDF_INPUT SpecularSetup
  20. //#define UNITY_SETUP_BRDF_INPUT MetallicSetup
  21. ENDCG
  22. SubShader
  23. {
  24. Tags{ "RenderType" = "Opaque" }
  25. LOD 300
  26. CGPROGRAM
  27. #pragma target 3.0
  28. #include "UnityPBSLighting.cginc"
  29. //#pragma surface surf Standard
  30. #pragma surface surf Standard fullforwardshadows
  31. //#pragma surface surf Lambert
  32. //#define UNITY_PASS_FORWARDBASE
  33. sampler2D _MainTex;
  34. sampler2D _BumpMap;
  35. sampler2D _Glossiness;
  36. sampler2D _AOMap;
  37. sampler2D _EmissionMap;
  38. uniform float _AOalbedo;
  39. uniform float _AOsmoothness;
  40. uniform float _SmoothnessShift;
  41. uniform float _EmissionScale;
  42. uniform float _AOintensity;
  43. uniform half _BumpScale;
  44. struct Input
  45. {
  46. float2 uv_MainTex;
  47. };
  48. void surf(Input IN, inout SurfaceOutputStandard o)
  49. {
  50. float3 albedotex = tex2D(_MainTex, IN.uv_MainTex);
  51. float4 glossinesstex = tex2D(_Glossiness, IN.uv_MainTex);
  52. float4 normaltex = tex2D(_BumpMap, IN.uv_MainTex);
  53. float4 ao = tex2D(_AOMap, IN.uv_MainTex);
  54. float3 emission = tex2D(_EmissionMap, IN.uv_MainTex);
  55. o.Occlusion = pow(ao.g, _AOintensity);
  56. o.Albedo = lerp(albedotex, float3(0.0f, 0.0f, 0.0f), saturate((1.0f-o.Occlusion) * _AOalbedo));
  57. o.Emission = emission.rgb * _EmissionScale;
  58. o.Normal = normalize(UnpackScaleNormal(normaltex, _BumpScale));
  59. o.Metallic = 0.0f;
  60. o.Smoothness = saturate(glossinesstex.g + ((1.0f-o.Occlusion) * _AOsmoothness) + _SmoothnessShift);
  61. }
  62. ENDCG
  63. }
  64. FallBack "Diffuse"
  65. }