InTerra_Standard-AddPass.shader 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. Shader "Hidden/InTerra/InTerra-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. [HideInInspector] _TerrainSizeXZPosY("", Vector) = (0,0,0)
  13. [HideInInspector] _NumLayersCount("", Float) = 0
  14. [HideInInspector] _TriplanarOneToAllSteep("", Float) = 0
  15. }
  16. SubShader {
  17. Tags {
  18. "Queue" = "Geometry-100"
  19. "RenderType" = "Opaque"
  20. }
  21. CGPROGRAM
  22. #pragma surface surf Standard decal:add vertex:SplatmapVert finalcolor:SplatmapFinalColor finalgbuffer:SplatmapFinalGBuffer addshadow fullforwardshadows nometa
  23. #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap forwardadd
  24. #pragma multi_compile_fog // needed because finalcolor oppresses fog code generation.
  25. #define _ALPHATEST_ON
  26. #pragma target 3.0
  27. #include "UnityPBSLighting.cginc"
  28. #pragma shader_feature_local _TERRAIN_TRIPLANAR_ONE
  29. #pragma shader_feature_local _TERRAIN_DISTANCEBLEND
  30. #define TERRAIN_INSTANCED_PERPIXEL_NORMAL
  31. #define TERRAIN_SURFACE_OUTPUT SurfaceOutputStandard
  32. #define INTERRA_TERRAIN
  33. #define TERRAIN_SPLAT_ADDPASS
  34. #include "InTerra_DefinedGlobalKeywords.cginc"
  35. #include "InTerra_InputsAndFunctions.cginc"
  36. #include "InTerra_Mixing.cginc"
  37. //============================================================================
  38. //--------------------------------- SURFACE ---------------------------------
  39. //============================================================================
  40. void surf (Input IN, inout SurfaceOutputStandard o) {
  41. half weight = 0;
  42. fixed4 mixedDiffuse = fixed4(0.0f, 0.0f, 0.0f, 0.0f);
  43. #ifndef _LAYERS_EIGHT
  44. SplatmapMix(IN, weight, mixedDiffuse, o.Normal, o.Occlusion, o.Metallic);
  45. #else
  46. o.Normal = float3(0.0f, 0.0f, 1.0f);
  47. o.Occlusion = 1;
  48. o.Metallic = 0;
  49. weight = 0;
  50. #endif
  51. o.Albedo = mixedDiffuse.rgb;
  52. o.Alpha = weight;
  53. o.Smoothness = mixedDiffuse.a;
  54. }
  55. ENDCG
  56. }
  57. Dependency "AddPassShader" = "Hidden/InTerra/InTerra-AddPass"
  58. Fallback "Nature/Terrain/Diffuse"
  59. }