SHARE
TWEET

Untitled

a guest May 20th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/StandardClippable" {
  2.     Properties
  3.     {
  4.         _Color("Color", Color) = (1,1,1,1)
  5.         _MainTex("Albedo", 2D) = "white" {}
  6.        
  7.         _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
  8.  
  9.         _Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
  10.         [Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0
  11.         _MetallicGlossMap("Metallic", 2D) = "white" {}
  12.  
  13.         _BumpScale("Scale", Float) = 1.0
  14.         _BumpMap("Normal Map", 2D) = "bump" {}
  15.  
  16.         _Parallax ("Height Scale", Range (0.005, 0.08)) = 0.02
  17.         _ParallaxMap ("Height Map", 2D) = "black" {}
  18.  
  19.         _OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0
  20.         _OcclusionMap("Occlusion", 2D) = "white" {}
  21.  
  22.         _EmissionColor("Color", Color) = (0,0,0)
  23.         _EmissionMap("Emission", 2D) = "white" {}
  24.        
  25.         _DetailMask("Detail Mask", 2D) = "white" {}
  26.  
  27.         _DetailAlbedoMap("Detail Albedo x2", 2D) = "grey" {}
  28.         _DetailNormalMapScale("Scale", Float) = 1.0
  29.         _DetailNormalMap("Normal Map", 2D) = "bump" {}
  30.  
  31.         [Enum(UV0,0,UV1,1)] _UVSec ("UV Set for secondary textures", Float) = 0
  32.  
  33.         // UI-only data
  34.         [HideInInspector] _EmissionScaleUI("Scale", Float) = 0.0
  35.         [HideInInspector] _EmissionColorUI("Color", Color) = (1,1,1)
  36.  
  37.         // Blending state
  38.         [HideInInspector] _Mode ("__mode", Float) = 0.0
  39.         [HideInInspector] _SrcBlend ("__src", Float) = 1.0
  40.         [HideInInspector] _DstBlend ("__dst", Float) = 0.0
  41.         [HideInInspector] _ZWrite ("__zw", Float) = 1.0
  42.  
  43.         _planePos   ("Clipping Plane Position", Vector) = ( 0, 0, 0, 1 )
  44.         _planePos2  ("Clipping Plane Position 2",   Vector) = ( 0, 0, 0, 1 )
  45.         _planePos3  ("Clipping Plane Position 3",   Vector) = ( 0, 0, 0, 1 )
  46.         _planePos4  ("Clipping Plane Position 4",   Vector) = ( 0, 0, 0, 1 )
  47.  
  48.         _planeNorm  ("Clipping Plane Normal",   Vector) = ( 0, 1, 0, 1 )
  49.         _planeNorm2 ("Clipping Plane Normal 2", Vector) = ( 0, 1, 0, 1 )
  50.         _planeNorm3 ("Clipping Plane Normal 3", Vector) = ( 0, 1, 0, 1 )
  51.         _planeNorm4 ("Clipping Plane Normal 4", Vector) = ( 0, 1, 0, 1 )
  52.     }
  53.  
  54.     CGINCLUDE
  55.         #define UNITY_SETUP_BRDF_INPUT MetallicSetup
  56.     ENDCG
  57.  
  58.     SubShader
  59.     {
  60.         Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
  61.         LOD 300
  62.    
  63.  
  64.         // ------------------------------------------------------------------
  65.         //  Base forward pass (directional light, emission, lightmaps, ...)
  66.         Pass
  67.         {
  68.             Name "FORWARD"
  69.             Tags { "LightMode" = "ForwardBase" }
  70.  
  71.             Blend [_SrcBlend] [_DstBlend]
  72.             ZWrite [_ZWrite]
  73.  
  74.             CGPROGRAM
  75.             #pragma target 3.0
  76.             // TEMPORARY: GLES2.0 temporarily disabled to prevent errors spam on devices without textureCubeLodEXT
  77.             #pragma exclude_renderers gles
  78.            
  79.             // -------------------------------------
  80.                    
  81.             #pragma shader_feature _NORMALMAP
  82.             #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
  83.             #pragma shader_feature _EMISSION
  84.             #pragma shader_feature _METALLICGLOSSMAP
  85.             #pragma shader_feature ___ _DETAIL_MULX2
  86.             #pragma shader_feature _PARALLAXMAP
  87.            
  88.             #pragma multi_compile_fwdbase
  89.             #pragma multi_compile_fog
  90.                
  91.             #pragma vertex vertForwardBase
  92.             #pragma fragment fragForwardBase
  93.  
  94.             #pragma multi_compile __ CLIP_ONE CLIP_TWO CLIP_THREE CLIP_FOUR
  95.  
  96.             #include "standard_clipped.cginc"
  97.  
  98.             ENDCG
  99.         }
  100.         // ------------------------------------------------------------------
  101.         //  Additive forward pass (one light per pass)
  102.         Pass
  103.         {
  104.             Name "FORWARD_DELTA"
  105.             Tags { "LightMode" = "ForwardAdd" }
  106.             Blend [_SrcBlend] One
  107.             Fog { Color (0,0,0,0) } // in additive pass fog should be black
  108.             ZWrite Off
  109.             ZTest LEqual
  110.  
  111.             CGPROGRAM
  112.             #pragma target 3.0
  113.             // GLES2.0 temporarily disabled to prevent errors spam on devices without textureCubeLodEXT
  114.             #pragma exclude_renderers gles
  115.  
  116.             // -------------------------------------
  117.  
  118.            
  119.             #pragma shader_feature _NORMALMAP
  120.             #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
  121.             #pragma shader_feature _METALLICGLOSSMAP
  122.             #pragma shader_feature ___ _DETAIL_MULX2
  123.             #pragma shader_feature _PARALLAXMAP
  124.            
  125.             #pragma multi_compile_fwdadd_fullshadows
  126.             #pragma multi_compile_fog
  127.            
  128.             #pragma vertex vertForwardAdd
  129.             #pragma fragment fragForwardAdd
  130.  
  131.             #pragma multi_compile __ CLIP_ONE CLIP_TWO CLIP_THREE CLIP_FOUR
  132.  
  133.             #include "standard_clipped.cginc"
  134.  
  135.             ENDCG
  136.         }
  137.         // ------------------------------------------------------------------
  138.         //  Shadow rendering pass
  139.         Pass {
  140.             Name "ShadowCaster"
  141.             Tags { "LightMode" = "ShadowCaster" }
  142.            
  143.             ZWrite On ZTest LEqual
  144.  
  145.             CGPROGRAM
  146.             #pragma target 3.0
  147.             // TEMPORARY: GLES2.0 temporarily disabled to prevent errors spam on devices without textureCubeLodEXT
  148.             #pragma exclude_renderers gles
  149.            
  150.             // -------------------------------------
  151.  
  152.  
  153.             #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
  154.             #pragma multi_compile_shadowcaster
  155.  
  156.             #pragma vertex vertShadowCaster
  157.             #pragma fragment fragShadowCaster
  158.  
  159.             #pragma multi_compile __ CLIP_ONE CLIP_TWO CLIP_THREE CLIP_FOUR
  160.  
  161.             #include "standard_shadow_clipped.cginc"
  162.  
  163.             ENDCG
  164.         }
  165.         // ------------------------------------------------------------------
  166.         //  Deferred pass
  167.         Pass
  168.         {
  169.             Name "DEFERRED"
  170.             Tags { "LightMode" = "Deferred" }
  171.  
  172.             CGPROGRAM
  173.             #pragma target 3.0
  174.             // TEMPORARY: GLES2.0 temporarily disabled to prevent errors spam on devices without textureCubeLodEXT
  175.             #pragma exclude_renderers nomrt gles
  176.            
  177.  
  178.             // -------------------------------------
  179.  
  180.             #pragma shader_feature _NORMALMAP
  181.             #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
  182.             #pragma shader_feature _EMISSION
  183.             #pragma shader_feature _METALLICGLOSSMAP
  184.             #pragma shader_feature ___ _DETAIL_MULX2
  185.             #pragma shader_feature _PARALLAXMAP
  186.  
  187.             #pragma multi_compile ___ UNITY_HDR_ON
  188.             #pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON
  189.             #pragma multi_compile DIRLIGHTMAP_OFF DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE
  190.             #pragma multi_compile DYNAMICLIGHTMAP_OFF DYNAMICLIGHTMAP_ON
  191.            
  192.             #pragma vertex vertDeferred
  193.             #pragma fragment fragDeferred
  194.  
  195.             #pragma multi_compile __ CLIP_ONE CLIP_TWO CLIP_THREE CLIP_FOUR
  196.  
  197.             #include "standard_clipped.cginc"
  198.  
  199.             ENDCG
  200.         }
  201.  
  202.         // ------------------------------------------------------------------
  203.         // Extracts information for lightmapping, GI (emission, albedo, ...)
  204.         // This pass it not used during regular rendering.
  205.         Pass
  206.         {
  207.             Name "META"
  208.             Tags { "LightMode"="Meta" }
  209.  
  210.             Cull Off
  211.  
  212.             CGPROGRAM
  213.             #pragma vertex vert_meta
  214.             #pragma fragment frag_meta
  215.  
  216.             #pragma shader_feature _EMISSION
  217.             #pragma shader_feature _METALLICGLOSSMAP
  218.             #pragma shader_feature ___ _DETAIL_MULX2
  219.  
  220.             #include "UnityStandardMeta.cginc"
  221.             ENDCG
  222.         }
  223.     }
  224.  
  225.     SubShader
  226.     {
  227.         Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
  228.         LOD 150
  229.  
  230.         // ------------------------------------------------------------------
  231.         //  Base forward pass (directional light, emission, lightmaps, ...)
  232.         Pass
  233.         {
  234.             Name "FORWARD"
  235.             Tags { "LightMode" = "ForwardBase" }
  236.  
  237.             Blend [_SrcBlend] [_DstBlend]
  238.             ZWrite [_ZWrite]
  239.  
  240.             CGPROGRAM
  241.             #pragma target 2.0
  242.            
  243.             #pragma shader_feature _NORMALMAP
  244.             #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
  245.             #pragma shader_feature _EMISSION
  246.             #pragma shader_feature _METALLICGLOSSMAP
  247.             #pragma shader_feature ___ _DETAIL_MULX2
  248.             // SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP
  249.  
  250.             #pragma skip_variants SHADOWS_SOFT DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE
  251.  
  252.             #pragma multi_compile_fwdbase
  253.             #pragma multi_compile_fog
  254.    
  255.             #pragma vertex vertForwardBase
  256.             #pragma fragment fragForwardBase
  257.  
  258.             #pragma multi_compile __ CLIP_ONE CLIP_TWO CLIP_THREE CLIP_FOUR
  259.  
  260.             #include "standard_clipped.cginc"
  261.  
  262.             ENDCG
  263.         }
  264.         // ------------------------------------------------------------------
  265.         //  Additive forward pass (one light per pass)
  266.         Pass
  267.         {
  268.             Name "FORWARD_DELTA"
  269.             Tags { "LightMode" = "ForwardAdd" }
  270.             Blend [_SrcBlend] One
  271.             Fog { Color (0,0,0,0) } // in additive pass fog should be black
  272.             ZWrite Off
  273.             ZTest LEqual
  274.            
  275.             CGPROGRAM
  276.             #pragma target 2.0
  277.  
  278.             #pragma shader_feature _NORMALMAP
  279.             #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
  280.             #pragma shader_feature _METALLICGLOSSMAP
  281.             #pragma shader_feature ___ _DETAIL_MULX2
  282.             // SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP
  283.             #pragma skip_variants SHADOWS_SOFT
  284.            
  285.             #pragma multi_compile_fwdadd_fullshadows
  286.             #pragma multi_compile_fog
  287.            
  288.             #pragma vertex vertForwardAdd
  289.             #pragma fragment fragForwardAdd
  290.  
  291.             #pragma multi_compile __ CLIP_ONE CLIP_TWO CLIP_THREE CLIP_FOUR
  292.  
  293.             #include "standard_clipped.cginc"
  294.  
  295.             ENDCG
  296.         }
  297.         // ------------------------------------------------------------------
  298.         //  Shadow rendering pass
  299.         Pass {
  300.             Name "ShadowCaster"
  301.             Tags { "LightMode" = "ShadowCaster" }
  302.            
  303.             ZWrite On ZTest LEqual
  304.  
  305.             CGPROGRAM
  306.             #pragma target 2.0
  307.  
  308.             #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
  309.             #pragma skip_variants SHADOWS_SOFT
  310.             #pragma multi_compile_shadowcaster
  311.  
  312.             #pragma vertex vertShadowCaster
  313.             #pragma fragment fragShadowCaster
  314.  
  315.             #pragma multi_compile __ CLIP_ONE CLIP_TWO CLIP_THREE CLIP_FOUR
  316.  
  317.             #include "standard_shadow_clipped.cginc"
  318.  
  319.             ENDCG
  320.         }
  321.  
  322.         // ------------------------------------------------------------------
  323.         // Extracts information for lightmapping, GI (emission, albedo, ...)
  324.         // This pass it not used during regular rendering.
  325.         Pass
  326.         {
  327.             Name "META"
  328.             Tags { "LightMode"="Meta" }
  329.  
  330.             Cull Off
  331.  
  332.             CGPROGRAM
  333.             #pragma vertex vert_meta
  334.             #pragma fragment frag_meta
  335.  
  336.             #pragma shader_feature _EMISSION
  337.             #pragma shader_feature _METALLICGLOSSMAP
  338.             #pragma shader_feature ___ _DETAIL_MULX2
  339.  
  340.             #include "UnityStandardMeta.cginc"
  341.             ENDCG
  342.         }
  343.     }
  344.  
  345.     FallBack "VertexLit"
  346.     CustomEditor "StandardShaderGUI"
  347. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top