InTerra_Diffuse-AddPass.shader 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. Shader "Hidden/InTerra/InTerra-Diffuse-AddPass"
  2. {
  3. Properties{
  4. [HideInInspector] _MainTex("BaseMap (RGB)", 2D) = "white" {}
  5. [HideInInspector] _Color("Main Color", Color) = (1,1,1,1)
  6. [HideInInspector] _TerrainHolesTexture("Holes Map (RGB)", 2D) = "white" {}
  7. _HT_distance("Distance", vector) = (3,10,0,25)
  8. _HT_distance_scale("Scale", Range(0,0.5)) = 0.25
  9. _HT_cover("Cover strenght", Range(0,1)) = 0.6
  10. _HeightTransition("Height blending Sharpness", Range(0,60)) = 50
  11. _Distance_HeightTransition("Distance Height blending Sharpness ", Range(0,60)) = 10
  12. _TriplanarSharpness("Triplanar Sharpness", Range(4,10)) = 9
  13. [HideInInspector] _TerrainSizeXZPosY("", Vector) = (0,0,0)
  14. [HideInInspector] _NumLayersCount("", Float) = 0
  15. [HideInInspector] _TriplanarOneToAllSteep("", Float) = 0
  16. }
  17. SubShader{
  18. Tags {
  19. "Queue" = "Geometry-100"
  20. "RenderType" = "Opaque"
  21. }
  22. CGPROGRAM
  23. #pragma surface surf Lambert decal:add vertex:SplatmapVert finalcolor:SplatmapFinalColor finalprepass:SplatmapFinalPrepass finalgbuffer:SplatmapFinalGBuffer fullforwardshadows nometa
  24. #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap forwardadd
  25. #pragma multi_compile_fog
  26. #define _ALPHATEST_ON
  27. #pragma target 3.0
  28. #include "UnityPBSLighting.cginc"
  29. #pragma shader_feature_local _TERRAIN_TRIPLANAR_ONE
  30. #pragma shader_feature_local _TERRAIN_DISTANCEBLEND
  31. #define INTERRA_TERRAIN
  32. #define TERRAIN_SPLAT_ADDPASS
  33. #define DIFFUSE
  34. #define TERRAIN_INSTANCED_PERPIXEL_NORMAL
  35. #include "InTerra_DefinedGlobalKeywords.cginc"
  36. #include "InTerra_InputsAndFunctions.cginc"
  37. #include "InTerra_Mixing.cginc"
  38. //============================================================================
  39. //--------------------------------- SURFACE ---------------------------------
  40. //============================================================================
  41. void surf(Input IN, inout SurfaceOutput o) {
  42. half weight;
  43. fixed4 mixedDiffuse = fixed4(0.0f, 0.0f, 0.0f, 0.0f);
  44. #ifndef _LAYERS_EIGHT
  45. SplatmapMix(IN, weight, mixedDiffuse, o.Normal);
  46. #else
  47. o.Normal = float3(0.0f, 0.0f, 1.0f);
  48. weight = 0;
  49. #endif
  50. o.Albedo = mixedDiffuse.rgb;
  51. o.Alpha = weight;
  52. }
  53. ENDCG
  54. }
  55. Fallback "Diffuse"
  56. }