Advertisement
Guest User

Untitled

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