Hazkin

Untitled

Sep 14th, 2021
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. Shader "Nature/Terrain/OrthoLineTerrain"
  2. {
  3. Properties
  4. {
  5. // used in fallback on old cards & base map
  6. _DrawOrthoMap ("Ortho Lines", int) = 1
  7. [HideInInspector] _MainTex ("BaseMap (RGB)", 2D) = "white" {}
  8. [HideInInspector] _Color ("Main Color", Color) = (1,1,1,1)
  9. [HideInInspector] _TerrainHolesTexture("Holes Map (RGB)", 2D) = "white" {}
  10. }
  11.  
  12. SubShader
  13. {
  14. Tags
  15. {
  16. "Queue" = "Geometry-100"
  17. "RenderType" = "Opaque"
  18. }
  19.  
  20. CGPROGRAM
  21. #pragma surface surf Standard vertex:SplatmapVert finalcolor:SplatmapFinalColor finalgbuffer:SplatmapFinalGBuffer addshadow fullforwardshadows
  22. #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap forwardadd
  23. #pragma multi_compile_fog // needed because finalcolor oppresses fog code generation.
  24. #pragma target 3.0
  25. #include "UnityPBSLighting.cginc"
  26.  
  27. #pragma multi_compile_local_fragment __ _ALPHATEST_ON
  28. #pragma multi_compile_local __ _NORMALMAP
  29.  
  30. #define TERRAIN_STANDARD_SHADER
  31. #define TERRAIN_INSTANCED_PERPIXEL_NORMAL
  32. #define TERRAIN_SURFACE_OUTPUT SurfaceOutputStandard
  33. #include "TerrainSplatmapCommon.cginc"
  34.  
  35. half _Metallic0;
  36. half _Metallic1;
  37. half _Metallic2;
  38. half _Metallic3;
  39.  
  40. half _Smoothness0;
  41. half _Smoothness1;
  42. half _Smoothness2;
  43. half _Smoothness3;
  44. int _DrawOrthoMap;
  45.  
  46. void surf(Input IN, inout SurfaceOutputStandard o)
  47. {
  48. half4 splat_control;
  49. half weight;
  50. fixed4 mixedDiffuse;
  51. half4 defaultSmoothness = half4(_Smoothness0, _Smoothness1, _Smoothness2, _Smoothness3);
  52. SplatmapMix(IN, defaultSmoothness, splat_control, weight, mixedDiffuse, o.Normal);
  53. // based on worldPos.y and mod by height value get new Albedo color
  54. o.Albedo = mixedDiffuse.rgb;
  55. o.Alpha = weight;
  56. o.Smoothness = mixedDiffuse.a;
  57. o.Metallic = dot(splat_control, half4(_Metallic0, _Metallic1, _Metallic2, _Metallic3));
  58. }
  59. ENDCG
  60.  
  61. UsePass "Hidden/Nature/Terrain/Utilities/PICKING"
  62. UsePass "Hidden/Nature/Terrain/Utilities/SELECTION"
  63. }
  64.  
  65. Dependency "AddPassShader" = "Hidden/TerrainEngine/Splatmap/Standard-AddPass"
  66. Dependency "BaseMapShader" = "Hidden/TerrainEngine/Splatmap/Standard-Base"
  67. Dependency "BaseMapGenShader" = "Hidden/TerrainEngine/Splatmap/Standard-BaseGen"
  68.  
  69. Fallback "Nature/Terrain/Diffuse"
  70. }
Advertisement
Add Comment
Please, Sign In to add comment