Advertisement
Guest User

AddPass

a guest
Jan 2nd, 2018
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.10 KB | None | 0 0
  1. // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
  2.  
  3. Shader "Hidden/TerrainEngine/Splatmap/Standard-AddPass" {
  4.     Properties {
  5.         // set by terrain engine
  6.         [HideInInspector] _Control ("Control (RGBA)", 2D) = "red" {}
  7.         [HideInInspector] _Splat3 ("Layer 3 (A)", 2D) = "white" {}
  8.         [HideInInspector] _Splat2 ("Layer 2 (B)", 2D) = "white" {}
  9.         [HideInInspector] _Splat1 ("Layer 1 (G)", 2D) = "white" {}
  10.         [HideInInspector] _Splat0 ("Layer 0 (R)", 2D) = "white" {}
  11.         [HideInInspector] _Normal3 ("Normal 3 (A)", 2D) = "bump" {}
  12.         [HideInInspector] _Normal2 ("Normal 2 (B)", 2D) = "bump" {}
  13.         [HideInInspector] _Normal1 ("Normal 1 (G)", 2D) = "bump" {}
  14.         [HideInInspector] _Normal0 ("Normal 0 (R)", 2D) = "bump" {}
  15.         [HideInInspector] [Gamma] _Metallic0 ("Metallic 0", Range(0.0, 1.0)) = 0.0
  16.         [HideInInspector] [Gamma] _Metallic1 ("Metallic 1", Range(0.0, 1.0)) = 0.0
  17.         [HideInInspector] [Gamma] _Metallic2 ("Metallic 2", Range(0.0, 1.0)) = 0.0
  18.         [HideInInspector] [Gamma] _Metallic3 ("Metallic 3", Range(0.0, 1.0)) = 0.0
  19.         [HideInInspector] _Smoothness0 ("Smoothness 0", Range(0.0, 1.0)) = 1.0
  20.         [HideInInspector] _Smoothness1 ("Smoothness 1", Range(0.0, 1.0)) = 1.0
  21.         [HideInInspector] _Smoothness2 ("Smoothness 2", Range(0.0, 1.0)) = 1.0
  22.         [HideInInspector] _Smoothness3 ("Smoothness 3", Range(0.0, 1.0)) = 1.0
  23.     }
  24.  
  25.     SubShader {
  26.         Tags {
  27.             "Queue" = "Geometry-99"
  28.             "IgnoreProjector"="True"
  29.             "RenderType" = "Opaque"
  30.         }
  31.  
  32.         CGPROGRAM
  33.         #pragma surface surf Standard decal:add vertex:SplatmapVert finalcolor:SplatmapFinalColor finalgbuffer:SplatmapFinalGBuffer fullforwardshadows noinstancing
  34.         #pragma multi_compile_fog
  35.         #pragma target 3.0
  36.         // needs more than 8 texcoords
  37.         #pragma exclude_renderers gles psp2
  38.         #include "UnityPBSLighting.cginc"
  39.  
  40.         #pragma multi_compile __ _TERRAIN_NORMAL_MAP
  41.  
  42.         #define TERRAIN_SPLAT_ADDPASS
  43.         #define TERRAIN_STANDARD_SHADER
  44.         #define TERRAIN_SURFACE_OUTPUT SurfaceOutputStandard
  45.         #include "TerrainSplatmapCommon.cginc"
  46.  
  47.         half _Metallic0;
  48.         half _Metallic1;
  49.         half _Metallic2;
  50.         half _Metallic3;
  51.  
  52.         half _Smoothness0;
  53.         half _Smoothness1;
  54.         half _Smoothness2;
  55.         half _Smoothness3;
  56.  
  57.         void surf (Input IN, inout SurfaceOutputStandard o) {
  58.             half4 splat_control;
  59.             half weight;
  60.             fixed4 mixedDiffuse;
  61.             half4 defaultSmoothness = half4(_Smoothness0, _Smoothness1, _Smoothness2, _Smoothness3);
  62.             SplatmapMix(IN, defaultSmoothness, splat_control, weight, mixedDiffuse, o.Normal);
  63.             o.Albedo = mixedDiffuse.rgb;
  64.             o.Alpha = weight;
  65.             o.Smoothness = mixedDiffuse.a;
  66.             o.Metallic = dot(splat_control, half4(_Metallic0, _Metallic1, _Metallic2, _Metallic3));
  67.         }
  68.         ENDCG
  69.     }
  70.  
  71.     Fallback "Hidden/TerrainEngine/Splatmap/Diffuse-AddPass"
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement