diff options
Diffstat (limited to 'Assets/MaterializeFX/Shaders/Standart')
14 files changed, 0 insertions, 2185 deletions
diff --git a/Assets/MaterializeFX/Shaders/Standart/MFX_Uber_Standard.shader b/Assets/MaterializeFX/Shaders/Standart/MFX_Uber_Standard.shader deleted file mode 100644 index d0e35318..00000000 --- a/Assets/MaterializeFX/Shaders/Standart/MFX_Uber_Standard.shader +++ /dev/null @@ -1,396 +0,0 @@ -// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) - -Shader "QFX/MFX/Uber/Standart" -{ - Properties - { - _Color("Color", Color) = (1,1,1,1) - _MainTex("Albedo", 2D) = "white" {} - - _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5 - - _Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5 - _GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0 - [Enum(Metallic Alpha,0,Albedo Alpha,1)] _SmoothnessTextureChannel ("Smoothness texture channel", Float) = 0 - - [Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0 - _MetallicGlossMap("Metallic", 2D) = "white" {} - - [ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0 - [ToggleOff] _GlossyReflections("Glossy Reflections", Float) = 1.0 - - _BumpScale("Scale", Float) = 1.0 - _BumpMap("Normal Map", 2D) = "bump" {} - - _Parallax ("Height Scale", Range (0.005, 0.08)) = 0.02 - _ParallaxMap ("Height Map", 2D) = "black" {} - - _OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0 - _OcclusionMap("Occlusion", 2D) = "white" {} - - _EmissionColor("Color", Color) = (0,0,0) - _EmissionMap("Emission", 2D) = "white" {} - - _DetailMask("Detail Mask", 2D) = "white" {} - - _DetailAlbedoMap("Detail Albedo x2", 2D) = "grey" {} - _DetailNormalMapScale("Scale", Float) = 1.0 - _DetailNormalMap("Normal Map", 2D) = "bump" {} - - [Enum(UV0,0,UV1,1)] _UVSec ("UV Set for secondary textures", Float) = 0 - - // Blending state - [HideInInspector] _Mode ("__mode", Float) = 0.0 - [HideInInspector] _SrcBlend ("__src", Float) = 1.0 - [HideInInspector] _DstBlend ("__dst", Float) = 0.0 - [HideInInspector] _ZWrite ("__zw", Float) = 1.0 - - //MFX - [HDR]_Color2("Color 2", Color) = (1,1,1,1) - _MainTex2("Albedo 2", 2D) = "white" {} - - _BumpMap2("Normal Map 2", 2D) = "bump" {} - - [HDR]_EmissionColor2("Color 2", Color) = (0,0,0) - _EmissionMap2("Emission 2", 2D) = "white" {} - _EmissionSize2("Emission 2 Size", Range(0.0, 1)) = 0 - - [HDR] _EdgeColor("Edge Color", Color) = (1,1,1,1) - _EdgeSize("Edge Size", Range(0.0, 1)) = 0.0 - _EdgeStrength("Edge Strength", Range( 0 , 1)) = 0.1 - - _EdgeRampMap1("Edge RampMap", 2D) = "white"{} - _EdgeRampMap1_Scroll("Edge RampMap Scroll", Vector) = (0,0,0,0) - - _DissolveMap1("Dissolve Map", 2D) = "white"{} - _DissolveMap1_Scroll("Dissolve Map Scroll", Vector) = (0,0,0,0) - - _DissolveSize("Dissolve Size", Range(0.0, 3.0)) = 1 - [HDR]_DissolveEdgeColor("Dissolve Edge Color", Color) = (0,0,0,0) - _DissolveEdgeSize("Dissolve Edge Size", Range( 0 , 1)) = 0.1 - - [KeywordEnum(None, Axis Local, Axis Global, Global)] _MaskType("Mask Type", Float) = 0 - [Enum(X,0,Y,1,Z,2)] _CutoffAxis("Axis", int) = 0 - _MaskOffset("Mask Offset", Float) = 0.5 - //if MaskType is Global - _MaskWorldPosition("Mask World Position", Vector) = (0,0,0,0) - } - - CGINCLUDE - #define UNITY_SETUP_BRDF_INPUT MetallicSetup - ENDCG - - SubShader - { - Tags { "RenderType"="TransparentCutout" "Queue" = "Geometry+0" "IsEmissive" = "true" "PerformanceChecks"="False" "DisableBatching"="True"} - LOD 300 - - // ------------------------------------------------------------------ - // Base forward pass (directional light, emission, lightmaps, ...) - Pass - { - Name "FORWARD" - Tags { "LightMode" = "ForwardBase" } - - Blend [_SrcBlend] [_DstBlend] - ZWrite [_ZWrite] - - CGPROGRAM - #pragma target 3.0 - - // ------------------------------------- - - //MFX - #pragma shader_feature _MASKTYPE_NONE _MASKTYPE_AXIS_LOCAL _MASKTYPE_AXIS_GLOBAL _MASKTYPE_GLOBAL - - #pragma shader_feature _NORMALMAP - #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON - #pragma shader_feature _EMISSION - #pragma shader_feature _METALLICGLOSSMAP - #pragma shader_feature ___ _DETAIL_MULX2 - #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A - #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF - #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF - #pragma shader_feature _PARALLAXMAP - - #pragma multi_compile_fwdbase - #pragma multi_compile_fog - #pragma multi_compile_instancing - // Uncomment the following line to enable dithering LOD crossfade. Note: there are more in the file to uncomment for other passes. - //#pragma multi_compile _ LOD_FADE_CROSSFADE - - #pragma vertex vertBase - #pragma fragment fragBase - #include "UnityStandardCoreForward.cginc" - - ENDCG - } - // ------------------------------------------------------------------ - // Additive forward pass (one light per pass) - Pass - { - Name "FORWARD_DELTA" - Tags { "LightMode" = "ForwardAdd" } - Blend [_SrcBlend] One - Fog { Color (0,0,0,0) } // in additive pass fog should be black - ZWrite Off - ZTest LEqual - - CGPROGRAM - #pragma target 3.0 - - // ------------------------------------- - - //MFX - #pragma shader_feature _MASKTYPE_NONE _MASKTYPE_AXIS_LOCAL _MASKTYPE_AXIS_GLOBAL _MASKTYPE_GLOBAL - - #pragma shader_feature _NORMALMAP - #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON - #pragma shader_feature _METALLICGLOSSMAP - #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A - #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF - #pragma shader_feature ___ _DETAIL_MULX2 - #pragma shader_feature _PARALLAXMAP - - #pragma multi_compile_fwdadd_fullshadows - #pragma multi_compile_fog - // Uncomment the following line to enable dithering LOD crossfade. Note: there are more in the file to uncomment for other passes. - //#pragma multi_compile _ LOD_FADE_CROSSFADE - - #pragma vertex vertAdd - #pragma fragment fragAdd - #include "UnityStandardCoreForward.cginc" - - ENDCG - } - // ------------------------------------------------------------------ - // Shadow rendering pass - Pass { - Name "ShadowCaster" - Tags { "LightMode" = "ShadowCaster" } - - ZWrite On ZTest LEqual - - CGPROGRAM - #pragma target 3.0 - - // ------------------------------------- - - //MFX - #pragma shader_feature _MASKTYPE_NONE _MASKTYPE_AXIS_LOCAL _MASKTYPE_AXIS_GLOBAL _MASKTYPE_GLOBAL - //#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON - #define _ALPHATEST_ON - - #pragma shader_feature _METALLICGLOSSMAP - #pragma shader_feature _PARALLAXMAP - #pragma multi_compile_shadowcaster - #pragma multi_compile_instancing - // Uncomment the following line to enable dithering LOD crossfade. Note: there are more in the file to uncomment for other passes. - //#pragma multi_compile _ LOD_FADE_CROSSFADE - - #pragma vertex vertShadowCaster - #pragma fragment fragShadowCaster - - #include "UnityStandardShadow.cginc" - - ENDCG - } - // ------------------------------------------------------------------ - // Deferred pass - Pass - { - Name "DEFERRED" - Tags { "LightMode" = "Deferred" } - - CGPROGRAM - #pragma target 3.0 - #pragma exclude_renderers nomrt - - - // ------------------------------------- - - //MFX - #pragma shader_feature _MASKTYPE_NONE _MASKTYPE_AXIS_LOCAL _MASKTYPE_AXIS_GLOBAL _MASKTYPE_GLOBAL - - #pragma shader_feature _NORMALMAP - #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON - #pragma shader_feature _EMISSION - #pragma shader_feature _METALLICGLOSSMAP - #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A - #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF - #pragma shader_feature ___ _DETAIL_MULX2 - #pragma shader_feature _PARALLAXMAP - - #pragma multi_compile_prepassfinal - #pragma multi_compile_instancing - // Uncomment the following line to enable dithering LOD crossfade. Note: there are more in the file to uncomment for other passes. - //#pragma multi_compile _ LOD_FADE_CROSSFADE - - #pragma vertex vertDeferred - #pragma fragment fragDeferred - - #include "UnityStandardCore.cginc" - - ENDCG - } - - // ------------------------------------------------------------------ - // Extracts information for lightmapping, GI (emission, albedo, ...) - // This pass it not used during regular rendering. - Pass - { - Name "META" - Tags { "LightMode"="Meta" } - - Cull Off - - CGPROGRAM - #pragma vertex vert_meta - #pragma fragment frag_meta - - #pragma shader_feature _EMISSION - #pragma shader_feature _METALLICGLOSSMAP - #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A - #pragma shader_feature ___ _DETAIL_MULX2 - #pragma shader_feature EDITOR_VISUALIZATION - - #include "UnityStandardMeta.cginc" - ENDCG - } - } - - SubShader - { - Tags { "RenderType"="Opaque" "PerformanceChecks"="False" } - LOD 150 - - // ------------------------------------------------------------------ - // Base forward pass (directional light, emission, lightmaps, ...) - Pass - { - Name "FORWARD" - Tags { "LightMode" = "ForwardBase" } - - Blend [_SrcBlend] [_DstBlend] - ZWrite [_ZWrite] - - CGPROGRAM - #pragma target 3.0 - - //MFX - #pragma shader_feature _MASKTYPE_NONE _MASKTYPE_AXIS_LOCAL _MASKTYPE_AXIS_GLOBAL _MASKTYPE_GLOBAL - //#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON - #define _ALPHATEST_ON - - #pragma shader_feature _NORMALMAP - #pragma shader_feature _EMISSION - #pragma shader_feature _METALLICGLOSSMAP - #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A - #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF - #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF - // SM2.0: NOT SUPPORTED shader_feature ___ _DETAIL_MULX2 - // SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP - - #pragma skip_variants SHADOWS_SOFT DIRLIGHTMAP_COMBINED - - #pragma multi_compile_fwdbase - #pragma multi_compile_fog - - #pragma vertex vertBase - #pragma fragment fragBase - #include "UnityStandardCoreForward.cginc" - - ENDCG - } - // ------------------------------------------------------------------ - // Additive forward pass (one light per pass) - Pass - { - Name "FORWARD_DELTA" - Tags { "LightMode" = "ForwardAdd" } - Blend [_SrcBlend] One - Fog { Color (0,0,0,0) } // in additive pass fog should be black - ZWrite Off - ZTest LEqual - - CGPROGRAM - #pragma target 3.0 - - //MFX - #pragma shader_feature _MASKTYPE_NONE _MASKTYPE_AXIS_LOCAL _MASKTYPE_AXIS_GLOBAL _MASKTYPE_GLOBAL - //#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON - #define _ALPHATEST_ON - - #pragma shader_feature _NORMALMAP - #pragma shader_feature _METALLICGLOSSMAP - #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A - #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF - #pragma shader_feature ___ _DETAIL_MULX2 - // SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP - #pragma skip_variants SHADOWS_SOFT - - #pragma multi_compile_fwdadd_fullshadows - #pragma multi_compile_fog - - #pragma vertex vertAdd - #pragma fragment fragAdd - #include "UnityStandardCoreForward.cginc" - - ENDCG - } - // ------------------------------------------------------------------ - // Shadow rendering pass - Pass { - Name "ShadowCaster" - Tags { "LightMode" = "ShadowCaster" } - - ZWrite On ZTest LEqual - - CGPROGRAM - #pragma target 3.0 - - //MFX - #pragma shader_feature _MASKTYPE_NONE _MASKTYPE_AXIS_LOCAL _MASKTYPE_AXIS_GLOBAL _MASKTYPE_GLOBAL - //#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON - #define _ALPHATEST_ON - - #pragma shader_feature _METALLICGLOSSMAP - #pragma skip_variants SHADOWS_SOFT - #pragma multi_compile_shadowcaster - - #pragma vertex vertShadowCaster - #pragma fragment fragShadowCaster - - #include "UnityStandardShadow.cginc" - - ENDCG - } - - // ------------------------------------------------------------------ - // Extracts information for lightmapping, GI (emission, albedo, ...) - // This pass it not used during regular rendering. - Pass - { - Name "META" - Tags { "LightMode"="Meta" } - - Cull Off - - CGPROGRAM - #pragma vertex vert_meta - #pragma fragment frag_meta - - #pragma shader_feature _EMISSION - #pragma shader_feature _METALLICGLOSSMAP - #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A - #pragma shader_feature ___ _DETAIL_MULX2 - #pragma shader_feature EDITOR_VISUALIZATION - - #include "UnityStandardMeta.cginc" - ENDCG - } - } - - FallBack "VertexLit" - //CustomEditor "StandardShaderGUI" -} diff --git a/Assets/MaterializeFX/Shaders/Standart/MFX_Uber_Standard.shader.meta b/Assets/MaterializeFX/Shaders/Standart/MFX_Uber_Standard.shader.meta deleted file mode 100644 index 40bd2df3..00000000 --- a/Assets/MaterializeFX/Shaders/Standart/MFX_Uber_Standard.shader.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 9e35c66820c9df547a3b14aafe70ae96 -timeCreated: 1522477183 -licenseType: Store -ShaderImporter: - externalObjects: {} - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MaterializeFX/Shaders/Standart/UnityStandardCore.cginc b/Assets/MaterializeFX/Shaders/Standart/UnityStandardCore.cginc deleted file mode 100644 index 1db6fa6c..00000000 --- a/Assets/MaterializeFX/Shaders/Standart/UnityStandardCore.cginc +++ /dev/null @@ -1,780 +0,0 @@ -// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
-
-#ifndef UNITY_STANDARD_CORE_INCLUDED
-#define UNITY_STANDARD_CORE_INCLUDED
-
-#include "UnityCG.cginc"
-#include "UnityShaderVariables.cginc"
-#include "UnityInstancing.cginc"
-#include "UnityStandardConfig.cginc"
-#include "UnityStandardInput.cginc"
-#include "UnityPBSLighting.cginc"
-#include "UnityStandardUtils.cginc"
-#include "UnityGBuffer.cginc"
-#include "UnityStandardBRDF.cginc"
-#include "AutoLight.cginc"
-
-//MFX
-#include "Assets/MaterializeFX/Shaders/cginc/MFX.cginc"
-
-//-------------------------------------------------------------------------------------
-// counterpart for NormalizePerPixelNormal
-// skips normalization per-vertex and expects normalization to happen per-pixel
-half3 NormalizePerVertexNormal (float3 n) // takes float to avoid overflow
-{
- #if (SHADER_TARGET < 30) || UNITY_STANDARD_SIMPLE
- return normalize(n);
- #else
- return n; // will normalize per-pixel instead
- #endif
-}
-
-half3 NormalizePerPixelNormal (half3 n)
-{
- #if (SHADER_TARGET < 30) || UNITY_STANDARD_SIMPLE
- return n;
- #else
- return normalize(n);
- #endif
-}
-
-//-------------------------------------------------------------------------------------
-UnityLight MainLight ()
-{
- UnityLight l;
-
- l.color = _LightColor0.rgb;
- l.dir = _WorldSpaceLightPos0.xyz;
- return l;
-}
-
-UnityLight AdditiveLight (half3 lightDir, half atten)
-{
- UnityLight l;
-
- l.color = _LightColor0.rgb;
- l.dir = lightDir;
- #ifndef USING_DIRECTIONAL_LIGHT
- l.dir = NormalizePerPixelNormal(l.dir);
- #endif
-
- // shadow the light
- l.color *= atten;
- return l;
-}
-
-UnityLight DummyLight ()
-{
- UnityLight l;
- l.color = 0;
- l.dir = half3 (0,1,0);
- return l;
-}
-
-UnityIndirect ZeroIndirect ()
-{
- UnityIndirect ind;
- ind.diffuse = 0;
- ind.specular = 0;
- return ind;
-}
-
-//-------------------------------------------------------------------------------------
-// Common fragment setup
-
-// deprecated
-half3 WorldNormal(half4 tan2world[3])
-{
- return normalize(tan2world[2].xyz);
-}
-
-// deprecated
-#ifdef _TANGENT_TO_WORLD
- half3x3 ExtractTangentToWorldPerPixel(half4 tan2world[3])
- {
- half3 t = tan2world[0].xyz;
- half3 b = tan2world[1].xyz;
- half3 n = tan2world[2].xyz;
-
- #if UNITY_TANGENT_ORTHONORMALIZE
- n = NormalizePerPixelNormal(n);
-
- // ortho-normalize Tangent
- t = normalize (t - n * dot(t, n));
-
- // recalculate Binormal
- half3 newB = cross(n, t);
- b = newB * sign (dot (newB, b));
- #endif
-
- return half3x3(t, b, n);
- }
-#else
- half3x3 ExtractTangentToWorldPerPixel(half4 tan2world[3])
- {
- return half3x3(0,0,0,0,0,0,0,0,0);
- }
-#endif
-
-half3 PerPixelWorldNormal(float4 i_tex, float4 mfxUv, half4 tangentToWorld[3], float3 mfxVertexPos)
-{
-#ifdef _NORMALMAP
- half3 tangent = tangentToWorld[0].xyz;
- half3 binormal = tangentToWorld[1].xyz;
- half3 normal = tangentToWorld[2].xyz;
-
- #if UNITY_TANGENT_ORTHONORMALIZE
- normal = NormalizePerPixelNormal(normal);
-
- // ortho-normalize Tangent
- tangent = normalize (tangent - normal * dot(tangent, normal));
-
- // recalculate Binormal
- half3 newB = cross(normal, tangent);
- binormal = newB * sign (dot (newB, binormal));
- #endif
-
- half3 normalTangent = NormalInTangentSpace(i_tex);
- normalTangent = GetMfxNormal(i_tex.xy, mfxUv, mfxVertexPos, normalTangent);
- half3 normalWorld = NormalizePerPixelNormal(tangent * normalTangent.x + binormal * normalTangent.y + normal * normalTangent.z); // @TODO: see if we can squeeze this normalize on SM2.0 as well
-#else
- half3 normalWorld = normalize(tangentToWorld[2].xyz);
-#endif
- return normalWorld;
-}
-
-#ifdef _PARALLAXMAP
- #define IN_VIEWDIR4PARALLAX(i) NormalizePerPixelNormal(half3(i.tangentToWorldAndPackedData[0].w,i.tangentToWorldAndPackedData[1].w,i.tangentToWorldAndPackedData[2].w))
- #define IN_VIEWDIR4PARALLAX_FWDADD(i) NormalizePerPixelNormal(i.viewDirForParallax.xyz)
-#else
- #define IN_VIEWDIR4PARALLAX(i) half3(0,0,0)
- #define IN_VIEWDIR4PARALLAX_FWDADD(i) half3(0,0,0)
-#endif
-
-#if UNITY_REQUIRE_FRAG_WORLDPOS
- #if UNITY_PACK_WORLDPOS_WITH_TANGENT
- #define IN_WORLDPOS(i) half3(i.tangentToWorldAndPackedData[0].w,i.tangentToWorldAndPackedData[1].w,i.tangentToWorldAndPackedData[2].w)
- #else
- #define IN_WORLDPOS(i) i.posWorld
- #endif
- #define IN_WORLDPOS_FWDADD(i) i.posWorld
-#else
- #define IN_WORLDPOS(i) half3(0,0,0)
- #define IN_WORLDPOS_FWDADD(i) half3(0,0,0)
-#endif
-
-#define IN_LIGHTDIR_FWDADD(i) half3(i.tangentToWorldAndLightDir[0].w, i.tangentToWorldAndLightDir[1].w, i.tangentToWorldAndLightDir[2].w)
-
-#define FRAGMENT_SETUP(x, worldPos) FragmentCommonData x = \
- FragmentSetup(i.tex, i.eyeVec, IN_VIEWDIR4PARALLAX(i), i.tangentToWorldAndPackedData, IN_WORLDPOS(i), i.mfxUv, worldPos);
-
-#define FRAGMENT_SETUP_FWDADD(x, worldPos) FragmentCommonData x = \
- FragmentSetup(i.tex, i.eyeVec, IN_VIEWDIR4PARALLAX_FWDADD(i), i.tangentToWorldAndLightDir, IN_WORLDPOS_FWDADD(i), i.mfxUv, worldPos);
-
-struct FragmentCommonData
-{
- half3 diffColor, specColor;
- // Note: smoothness & oneMinusReflectivity for optimization purposes, mostly for DX9 SM2.0 level.
- // Most of the math is being done on these (1-x) values, and that saves a few precious ALU slots.
- half oneMinusReflectivity, smoothness;
- half3 normalWorld, eyeVec;
- half alpha;
- float3 posWorld;
-
-#if UNITY_STANDARD_SIMPLE
- half3 reflUVW;
-#endif
-
-#if UNITY_STANDARD_SIMPLE
- half3 tangentSpaceNormal;
-#endif
-};
-
-#ifndef UNITY_SETUP_BRDF_INPUT
- #define UNITY_SETUP_BRDF_INPUT SpecularSetup
-#endif
-
-inline FragmentCommonData SpecularSetup (float4 i_tex, float4 mfxUv, float3 mfxVertexPos)
-{
- half4 specGloss = SpecularGloss(i_tex.xy);
- half3 specColor = specGloss.rgb;
- half smoothness = specGloss.a;
-
- half oneMinusReflectivity;
- half3 diffColor = EnergyConservationBetweenDiffuseAndSpecular (Albedo(i_tex), specColor, /*out*/ oneMinusReflectivity);
-
- FragmentCommonData o = (FragmentCommonData)0;
- //MFX
- o.diffColor = GetMfxAlbedo(i_tex.xy, mfxUv, mfxVertexPos, diffColor);
- o.specColor = specColor;
- o.oneMinusReflectivity = oneMinusReflectivity;
- o.smoothness = smoothness;
-
- //MFX
- o.alpha = GetMfxDissolve(mfxUv, mfxVertexPos);
-
- return o;
-}
-
-
-inline FragmentCommonData RoughnessSetup(float4 i_tex, float4 mfxUv, float3 mfxVertexPos)
-{
- half2 metallicGloss = MetallicRough(i_tex.xy);
- half metallic = metallicGloss.x;
- half smoothness = metallicGloss.y; // this is 1 minus the square root of real roughness m.
-
- half oneMinusReflectivity;
- half3 specColor;
- half3 diffColor = DiffuseAndSpecularFromMetallic(Albedo(i_tex), metallic, /*out*/ specColor, /*out*/ oneMinusReflectivity);
-
- FragmentCommonData o = (FragmentCommonData)0;
- //MFX
- o.diffColor = GetMfxAlbedo(i_tex.xy, mfxUv, mfxVertexPos, diffColor);
- o.specColor = specColor;
- o.oneMinusReflectivity = oneMinusReflectivity;
- o.smoothness = smoothness;
-
- //MFX
- o.alpha = GetMfxDissolve(mfxUv, mfxVertexPos);
-
- return o;
-}
-
-inline FragmentCommonData MetallicSetup (float4 i_tex, float4 mfxUv, float3 mfxVertexPos)
-{
- half2 metallicGloss = MetallicGloss(i_tex.xy);
- half metallic = metallicGloss.x;
- half smoothness = metallicGloss.y; // this is 1 minus the square root of real roughness m.
-
- half oneMinusReflectivity;
- half3 specColor;
- half3 diffColor = DiffuseAndSpecularFromMetallic (Albedo(i_tex), metallic, /*out*/ specColor, /*out*/ oneMinusReflectivity);
-
- FragmentCommonData o = (FragmentCommonData)0;
- //MFX
- o.diffColor = GetMfxAlbedo(i_tex.xy, mfxUv, mfxVertexPos, diffColor);
- o.specColor = specColor;
- o.oneMinusReflectivity = oneMinusReflectivity;
- o.smoothness = smoothness;
-
- //MFX
- o.alpha = GetMfxDissolve(mfxUv, mfxVertexPos);
-
- return o;
-}
-
-// parallax transformed texcoord is used to sample occlusion
-inline FragmentCommonData FragmentSetup (inout float4 i_tex, half3 i_eyeVec, half3 i_viewDirForParallax, half4 tangentToWorld[3], float3 i_posWorld, float4 mfxUv, float3 mfxVertexPos)
-{
- i_tex = Parallax(i_tex, i_viewDirForParallax);
-
- //MFX
- half alpha = GetMfxDissolve(mfxUv, mfxVertexPos);
- MfxClip(alpha);
-
- //half alpha = Alpha(i_tex.xy);
- //#if defined(_ALPHATEST_ON)
- // clip (alpha - _Cutoff);
- //#endif
-
- FragmentCommonData o = UNITY_SETUP_BRDF_INPUT (i_tex, mfxUv, mfxVertexPos);
- o.normalWorld = PerPixelWorldNormal(i_tex, mfxUv, tangentToWorld, mfxVertexPos);
- o.eyeVec = NormalizePerPixelNormal(i_eyeVec);
- o.posWorld = i_posWorld;
-
- // NOTE: shader relies on pre-multiply alpha-blend (_SrcBlend = One, _DstBlend = OneMinusSrcAlpha)
- //MFX
- half3 diffColor = PreMultiplyAlpha (o.diffColor, alpha, o.oneMinusReflectivity, /*out*/ o.alpha);
- o.diffColor = GetMfxAlbedo(i_tex.xy, mfxUv, mfxVertexPos, diffColor);
-
- o.alpha = alpha;
-
- return o;
-}
-
-inline UnityGI FragmentGI (FragmentCommonData s, half occlusion, half4 i_ambientOrLightmapUV, half atten, UnityLight light, bool reflections)
-{
- UnityGIInput d;
- d.light = light;
- d.worldPos = s.posWorld;
- d.worldViewDir = -s.eyeVec;
- d.atten = atten;
- #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
- d.ambient = 0;
- d.lightmapUV = i_ambientOrLightmapUV;
- #else
- d.ambient = i_ambientOrLightmapUV.rgb;
- d.lightmapUV = 0;
- #endif
-
- d.probeHDR[0] = unity_SpecCube0_HDR;
- d.probeHDR[1] = unity_SpecCube1_HDR;
- #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION)
- d.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending
- #endif
- #ifdef UNITY_SPECCUBE_BOX_PROJECTION
- d.boxMax[0] = unity_SpecCube0_BoxMax;
- d.probePosition[0] = unity_SpecCube0_ProbePosition;
- d.boxMax[1] = unity_SpecCube1_BoxMax;
- d.boxMin[1] = unity_SpecCube1_BoxMin;
- d.probePosition[1] = unity_SpecCube1_ProbePosition;
- #endif
-
- if(reflections)
- {
- Unity_GlossyEnvironmentData g = UnityGlossyEnvironmentSetup(s.smoothness, -s.eyeVec, s.normalWorld, s.specColor);
- // Replace the reflUVW if it has been compute in Vertex shader. Note: the compiler will optimize the calcul in UnityGlossyEnvironmentSetup itself
- #if UNITY_STANDARD_SIMPLE
- g.reflUVW = s.reflUVW;
- #endif
-
- return UnityGlobalIllumination (d, occlusion, s.normalWorld, g);
- }
- else
- {
- return UnityGlobalIllumination (d, occlusion, s.normalWorld);
- }
-}
-
-inline UnityGI FragmentGI (FragmentCommonData s, half occlusion, half4 i_ambientOrLightmapUV, half atten, UnityLight light)
-{
- return FragmentGI(s, occlusion, i_ambientOrLightmapUV, atten, light, true);
-}
-
-
-//-------------------------------------------------------------------------------------
-half4 OutputForward (half4 output, half alphaFromSurface)
-{
- #if defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON)
- output.a = alphaFromSurface;
- #else
- UNITY_OPAQUE_ALPHA(output.a);
- #endif
- return output;
-}
-
-inline half4 VertexGIForward(VertexInput v, float3 posWorld, half3 normalWorld)
-{
- half4 ambientOrLightmapUV = 0;
- // Static lightmaps
- #ifdef LIGHTMAP_ON
- ambientOrLightmapUV.xy = v.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
- ambientOrLightmapUV.zw = 0;
- // Sample light probe for Dynamic objects only (no static or dynamic lightmaps)
- #elif UNITY_SHOULD_SAMPLE_SH
- #ifdef VERTEXLIGHT_ON
- // Approximated illumination from non-important point lights
- ambientOrLightmapUV.rgb = Shade4PointLights (
- unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0,
- unity_LightColor[0].rgb, unity_LightColor[1].rgb, unity_LightColor[2].rgb, unity_LightColor[3].rgb,
- unity_4LightAtten0, posWorld, normalWorld);
- #endif
-
- ambientOrLightmapUV.rgb = ShadeSHPerVertex (normalWorld, ambientOrLightmapUV.rgb);
- #endif
-
- #ifdef DYNAMICLIGHTMAP_ON
- ambientOrLightmapUV.zw = v.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
- #endif
-
- return ambientOrLightmapUV;
-}
-
-// ------------------------------------------------------------------
-// Base forward pass (directional light, emission, lightmaps, ...)
-
-struct VertexOutputForwardBase
-{
- UNITY_POSITION(pos);
- float4 tex : TEXCOORD0;
- half3 eyeVec : TEXCOORD1;
- half4 tangentToWorldAndPackedData[3] : TEXCOORD2; // [3x3:tangentToWorld | 1x3:viewDirForParallax or worldPos]
- half4 ambientOrLightmapUV : TEXCOORD5; // SH or Lightmap UV
- UNITY_SHADOW_COORDS(6)
- UNITY_FOG_COORDS(7)
-
- // next ones would not fit into SM2.0 limits, but they are always for SM3.0+
- //#if UNITY_REQUIRE_FRAG_WORLDPOS && !UNITY_PACK_WORLDPOS_WITH_TANGENT
- float3 posWorld : TEXCOORD8;
- //#endif
-
- UNITY_VERTEX_INPUT_INSTANCE_ID
- UNITY_VERTEX_OUTPUT_STEREO
-
- //MFX
- float4 mfxUv : TEXCOORD9;
-};
-
-VertexOutputForwardBase vertForwardBase (VertexInput v)
-{
- UNITY_SETUP_INSTANCE_ID(v);
- VertexOutputForwardBase o;
- UNITY_INITIALIZE_OUTPUT(VertexOutputForwardBase, o);
- UNITY_TRANSFER_INSTANCE_ID(v, o);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
-
- float4 posWorld = mul(unity_ObjectToWorld, v.vertex);
- //#if UNITY_REQUIRE_FRAG_WORLDPOS
- #if UNITY_PACK_WORLDPOS_WITH_TANGENT
- o.tangentToWorldAndPackedData[0].w = posWorld.x;
- o.tangentToWorldAndPackedData[1].w = posWorld.y;
- o.tangentToWorldAndPackedData[2].w = posWorld.z;
- #else
- o.posWorld = posWorld.xyz;
- #endif
- //#endif
- o.pos = UnityObjectToClipPos(v.vertex);
-
- o.tex = TexCoords(v);
- o.eyeVec = NormalizePerVertexNormal(posWorld.xyz - _WorldSpaceCameraPos);
- float3 normalWorld = UnityObjectToWorldNormal(v.normal);
- #ifdef _TANGENT_TO_WORLD
- float4 tangentWorld = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w);
-
- float3x3 tangentToWorld = CreateTangentToWorldPerVertex(normalWorld, tangentWorld.xyz, tangentWorld.w);
- o.tangentToWorldAndPackedData[0].xyz = tangentToWorld[0];
- o.tangentToWorldAndPackedData[1].xyz = tangentToWorld[1];
- o.tangentToWorldAndPackedData[2].xyz = tangentToWorld[2];
- #else
- o.tangentToWorldAndPackedData[0].xyz = 0;
- o.tangentToWorldAndPackedData[1].xyz = 0;
- o.tangentToWorldAndPackedData[2].xyz = normalWorld;
- #endif
-
- //We need this for shadow receving
- UNITY_TRANSFER_SHADOW(o, v.uv1);
-
- o.ambientOrLightmapUV = VertexGIForward(v, posWorld, normalWorld);
-
- #ifdef _PARALLAXMAP
- TANGENT_SPACE_ROTATION;
- half3 viewDirForParallax = mul (rotation, ObjSpaceViewDir(v.vertex));
- o.tangentToWorldAndPackedData[0].w = viewDirForParallax.x;
- o.tangentToWorldAndPackedData[1].w = viewDirForParallax.y;
- o.tangentToWorldAndPackedData[2].w = viewDirForParallax.z;
- #endif
-
- //MFX
- PassMfxVertex2Fragment(v.uv0.xy, o.mfxUv);
-
- UNITY_TRANSFER_FOG(o,o.pos);
- return o;
-}
-
-half4 fragForwardBaseInternal (VertexOutputForwardBase i)
-{
- UNITY_APPLY_DITHER_CROSSFADE(i.pos.xy);
-
-#if UNITY_PACK_WORLDPOS_WITH_TANGENT
- float3 posWorld = float3(i.tangentToWorldAndPackedData[0].w, i.tangentToWorldAndPackedData[1].w, i.tangentToWorldAndPackedData[2].w);
-#else
- float3 posWorld = i.posWorld;
-#endif
-
- FRAGMENT_SETUP(s, posWorld)
-
- UNITY_SETUP_INSTANCE_ID(i);
- UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
-
- UnityLight mainLight = MainLight ();
- UNITY_LIGHT_ATTENUATION(atten, i, s.posWorld);
-
- half occlusion = Occlusion(i.tex.xy);
- UnityGI gi = FragmentGI (s, occlusion, i.ambientOrLightmapUV, atten, mainLight);
-
- half4 c = UNITY_BRDF_PBS (s.diffColor, s.specColor, s.oneMinusReflectivity, s.smoothness, s.normalWorld, -s.eyeVec, gi.light, gi.indirect);
- //c.rgb += Emission(i.tex.xy);
-
- //MFX
- c.rgb += GetMfxEmission(i.tex.xy, i.mfxUv, posWorld, Emission(i.tex.xy), s.alpha);
-
- UNITY_APPLY_FOG(i.fogCoord, c.rgb);
- return OutputForward (c, s.alpha);
-}
-
-half4 fragForwardBase (VertexOutputForwardBase i) : SV_Target // backward compatibility (this used to be the fragment entry function)
-{
- return fragForwardBaseInternal(i);
-}
-
-// ------------------------------------------------------------------
-// Additive forward pass (one light per pass)
-
-struct VertexOutputForwardAdd
-{
- UNITY_POSITION(pos);
- float4 tex : TEXCOORD0;
- half3 eyeVec : TEXCOORD1;
- half4 tangentToWorldAndLightDir[3] : TEXCOORD2; // [3x3:tangentToWorld | 1x3:lightDir]
- float3 posWorld : TEXCOORD5;
- UNITY_SHADOW_COORDS(6)
- UNITY_FOG_COORDS(7)
-
- // next ones would not fit into SM2.0 limits, but they are always for SM3.0+
-#if defined(_PARALLAXMAP)
- half3 viewDirForParallax : TEXCOORD8;
-#endif
-
- UNITY_VERTEX_OUTPUT_STEREO
-
- //MFX
- float4 mfxUv : TEXCOORD9;
-};
-
-VertexOutputForwardAdd vertForwardAdd (VertexInput v)
-{
- UNITY_SETUP_INSTANCE_ID(v);
- VertexOutputForwardAdd o;
- UNITY_INITIALIZE_OUTPUT(VertexOutputForwardAdd, o);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
-
- float4 posWorld = mul(unity_ObjectToWorld, v.vertex);
- o.pos = UnityObjectToClipPos(v.vertex);
-
- o.tex = TexCoords(v);
- o.eyeVec = NormalizePerVertexNormal(posWorld.xyz - _WorldSpaceCameraPos);
- o.posWorld = posWorld.xyz;
- float3 normalWorld = UnityObjectToWorldNormal(v.normal);
- #ifdef _TANGENT_TO_WORLD
- float4 tangentWorld = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w);
-
- float3x3 tangentToWorld = CreateTangentToWorldPerVertex(normalWorld, tangentWorld.xyz, tangentWorld.w);
- o.tangentToWorldAndLightDir[0].xyz = tangentToWorld[0];
- o.tangentToWorldAndLightDir[1].xyz = tangentToWorld[1];
- o.tangentToWorldAndLightDir[2].xyz = tangentToWorld[2];
- #else
- o.tangentToWorldAndLightDir[0].xyz = 0;
- o.tangentToWorldAndLightDir[1].xyz = 0;
- o.tangentToWorldAndLightDir[2].xyz = normalWorld;
- #endif
- //We need this for shadow receiving
- UNITY_TRANSFER_SHADOW(o, v.uv1);
-
- float3 lightDir = _WorldSpaceLightPos0.xyz - posWorld.xyz * _WorldSpaceLightPos0.w;
- #ifndef USING_DIRECTIONAL_LIGHT
- lightDir = NormalizePerVertexNormal(lightDir);
- #endif
- o.tangentToWorldAndLightDir[0].w = lightDir.x;
- o.tangentToWorldAndLightDir[1].w = lightDir.y;
- o.tangentToWorldAndLightDir[2].w = lightDir.z;
-
- #ifdef _PARALLAXMAP
- TANGENT_SPACE_ROTATION;
- o.viewDirForParallax = mul (rotation, ObjSpaceViewDir(v.vertex));
- #endif
-
- //MFX
- PassMfxVertex2Fragment(v.uv0.xy, o.mfxUv);
-
- UNITY_TRANSFER_FOG(o,o.pos);
- return o;
-}
-
-half4 fragForwardAddInternal (VertexOutputForwardAdd i)
-{
- UNITY_APPLY_DITHER_CROSSFADE(i.pos.xy);
-
- FRAGMENT_SETUP_FWDADD(s, i.posWorld)
-
- UNITY_LIGHT_ATTENUATION(atten, i, s.posWorld)
- UnityLight light = AdditiveLight (IN_LIGHTDIR_FWDADD(i), atten);
- UnityIndirect noIndirect = ZeroIndirect ();
-
- half4 c = UNITY_BRDF_PBS (s.diffColor, s.specColor, s.oneMinusReflectivity, s.smoothness, s.normalWorld, -s.eyeVec, light, noIndirect);
-
- UNITY_APPLY_FOG_COLOR(i.fogCoord, c.rgb, half4(0,0,0,0)); // fog towards black in additive pass
- return OutputForward (c, s.alpha);
-}
-
-half4 fragForwardAdd (VertexOutputForwardAdd i) : SV_Target // backward compatibility (this used to be the fragment entry function)
-{
- return fragForwardAddInternal(i);
-}
-
-// ------------------------------------------------------------------
-// Deferred pass
-
-struct VertexOutputDeferred
-{
- UNITY_POSITION(pos);
- float4 tex : TEXCOORD0;
- half3 eyeVec : TEXCOORD1;
- half4 tangentToWorldAndPackedData[3]: TEXCOORD2; // [3x3:tangentToWorld | 1x3:viewDirForParallax or worldPos]
- half4 ambientOrLightmapUV : TEXCOORD5; // SH or Lightmap UVs
-
- //#if UNITY_REQUIRE_FRAG_WORLDPOS && !UNITY_PACK_WORLDPOS_WITH_TANGENT
- float3 posWorld : TEXCOORD6;
- //#endif
-
- UNITY_VERTEX_OUTPUT_STEREO
-
- //MFX
- float4 mfxUv : TEXCOORD7;
-};
-
-
-VertexOutputDeferred vertDeferred (VertexInput v)
-{
- UNITY_SETUP_INSTANCE_ID(v);
- VertexOutputDeferred o;
- UNITY_INITIALIZE_OUTPUT(VertexOutputDeferred, o);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
-
- float4 posWorld = mul(unity_ObjectToWorld, v.vertex);
- //#if UNITY_REQUIRE_FRAG_WORLDPOS
- #if UNITY_PACK_WORLDPOS_WITH_TANGENT
- o.tangentToWorldAndPackedData[0].w = posWorld.x;
- o.tangentToWorldAndPackedData[1].w = posWorld.y;
- o.tangentToWorldAndPackedData[2].w = posWorld.z;
- #else
- o.posWorld = posWorld.xyz;
- #endif
- //#endif
- o.pos = UnityObjectToClipPos(v.vertex);
-
- o.tex = TexCoords(v);
- o.eyeVec = NormalizePerVertexNormal(posWorld.xyz - _WorldSpaceCameraPos);
- float3 normalWorld = UnityObjectToWorldNormal(v.normal);
- #ifdef _TANGENT_TO_WORLD
- float4 tangentWorld = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w);
-
- float3x3 tangentToWorld = CreateTangentToWorldPerVertex(normalWorld, tangentWorld.xyz, tangentWorld.w);
- o.tangentToWorldAndPackedData[0].xyz = tangentToWorld[0];
- o.tangentToWorldAndPackedData[1].xyz = tangentToWorld[1];
- o.tangentToWorldAndPackedData[2].xyz = tangentToWorld[2];
- #else
- o.tangentToWorldAndPackedData[0].xyz = 0;
- o.tangentToWorldAndPackedData[1].xyz = 0;
- o.tangentToWorldAndPackedData[2].xyz = normalWorld;
- #endif
-
- o.ambientOrLightmapUV = 0;
- #ifdef LIGHTMAP_ON
- o.ambientOrLightmapUV.xy = v.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
- #elif UNITY_SHOULD_SAMPLE_SH
- o.ambientOrLightmapUV.rgb = ShadeSHPerVertex (normalWorld, o.ambientOrLightmapUV.rgb);
- #endif
- #ifdef DYNAMICLIGHTMAP_ON
- o.ambientOrLightmapUV.zw = v.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
- #endif
-
- #ifdef _PARALLAXMAP
- TANGENT_SPACE_ROTATION;
- half3 viewDirForParallax = mul (rotation, ObjSpaceViewDir(v.vertex));
- o.tangentToWorldAndPackedData[0].w = viewDirForParallax.x;
- o.tangentToWorldAndPackedData[1].w = viewDirForParallax.y;
- o.tangentToWorldAndPackedData[2].w = viewDirForParallax.z;
- #endif
-
- //MFX
- PassMfxVertex2Fragment(v.uv0.xy, o.mfxUv);
-
- return o;
-}
-
-void fragDeferred (
- VertexOutputDeferred i,
- out half4 outGBuffer0 : SV_Target0,
- out half4 outGBuffer1 : SV_Target1,
- out half4 outGBuffer2 : SV_Target2,
- out half4 outEmission : SV_Target3 // RT3: emission (rgb), --unused-- (a)
-#if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4)
- ,out half4 outShadowMask : SV_Target4 // RT4: shadowmask (rgba)
-#endif
-)
-{
- #if (SHADER_TARGET < 30)
- outGBuffer0 = 1;
- outGBuffer1 = 1;
- outGBuffer2 = 0;
- outEmission = 0;
- #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4)
- outShadowMask = 1;
- #endif
- return;
- #endif
-
- UNITY_APPLY_DITHER_CROSSFADE(i.pos.xy);
-
-#if UNITY_PACK_WORLDPOS_WITH_TANGENT
- float3 posWorld = float3(i.tangentToWorldAndPackedData[0].w, i.tangentToWorldAndPackedData[1].w, i.tangentToWorldAndPackedData[2].w);
-#else
- float3 posWorld = i.posWorld;
-#endif
-
- //MFX
- FRAGMENT_SETUP(s, posWorld)
-
- // no analytic lights in this pass
- UnityLight dummyLight = DummyLight ();
- half atten = 1;
-
- // only GI
- half occlusion = Occlusion(i.tex.xy);
-#if UNITY_ENABLE_REFLECTION_BUFFERS
- bool sampleReflectionsInDeferred = false;
-#else
- bool sampleReflectionsInDeferred = true;
-#endif
-
- UnityGI gi = FragmentGI (s, occlusion, i.ambientOrLightmapUV, atten, dummyLight, sampleReflectionsInDeferred);
-
- half3 emissiveColor = UNITY_BRDF_PBS (s.diffColor, s.specColor, s.oneMinusReflectivity, s.smoothness, s.normalWorld, -s.eyeVec, gi.light, gi.indirect).rgb;
-
- #ifdef _EMISSION
- //emissiveColor += Emission (i.tex.xy);
-
- //MFX
- emissiveColor += GetMfxEmission(i.tex.xy, i.mfxUv, posWorld, Emission(i.tex.xy), s.alpha);
- #endif
-
- #ifndef UNITY_HDR_ON
- emissiveColor.rgb = exp2(-emissiveColor.rgb);
- #endif
-
- UnityStandardData data;
- data.diffuseColor = s.diffColor;
- data.occlusion = occlusion;
- data.specularColor = s.specColor;
- data.smoothness = s.smoothness;
- data.normalWorld = s.normalWorld;
-
- UnityStandardDataToGbuffer(data, outGBuffer0, outGBuffer1, outGBuffer2);
-
- // Emissive lighting buffer
- outEmission = half4(emissiveColor, 1);
-
- // Baked direct lighting occlusion if any
- #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4)
- outShadowMask = UnityGetRawBakedOcclusions(i.ambientOrLightmapUV.xy, IN_WORLDPOS(i));
- #endif
-}
-
-
-//
-// Old FragmentGI signature. Kept only for backward compatibility and will be removed soon
-//
-
-inline UnityGI FragmentGI(
- float3 posWorld,
- half occlusion, half4 i_ambientOrLightmapUV, half atten, half smoothness, half3 normalWorld, half3 eyeVec,
- UnityLight light,
- bool reflections)
-{
- // we init only fields actually used
- FragmentCommonData s = (FragmentCommonData)0;
- s.smoothness = smoothness;
- s.normalWorld = normalWorld;
- s.eyeVec = eyeVec;
- s.posWorld = posWorld;
- return FragmentGI(s, occlusion, i_ambientOrLightmapUV, atten, light, reflections);
-}
-inline UnityGI FragmentGI (
- float3 posWorld,
- half occlusion, half4 i_ambientOrLightmapUV, half atten, half smoothness, half3 normalWorld, half3 eyeVec,
- UnityLight light)
-{
- return FragmentGI (posWorld, occlusion, i_ambientOrLightmapUV, atten, smoothness, normalWorld, eyeVec, light, true);
-}
-
-#endif // UNITY_STANDARD_CORE_INCLUDED
diff --git a/Assets/MaterializeFX/Shaders/Standart/UnityStandardCore.cginc.meta b/Assets/MaterializeFX/Shaders/Standart/UnityStandardCore.cginc.meta deleted file mode 100644 index bbc1fb55..00000000 --- a/Assets/MaterializeFX/Shaders/Standart/UnityStandardCore.cginc.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2
-guid: 6f77e6a5b35179a4ca0efe7b05e0cef1
-timeCreated: 1522477140
-licenseType: Store
-ShaderImporter:
- externalObjects: {}
- defaultTextures: []
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/MaterializeFX/Shaders/Standart/UnityStandardCoreForward.cginc b/Assets/MaterializeFX/Shaders/Standart/UnityStandardCoreForward.cginc deleted file mode 100644 index 23af035c..00000000 --- a/Assets/MaterializeFX/Shaders/Standart/UnityStandardCoreForward.cginc +++ /dev/null @@ -1,26 +0,0 @@ -// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) - -#ifndef UNITY_STANDARD_CORE_FORWARD_INCLUDED -#define UNITY_STANDARD_CORE_FORWARD_INCLUDED - -#if defined(UNITY_NO_FULL_STANDARD_SHADER) -# define UNITY_STANDARD_SIMPLE 1 -#endif - -#include "UnityStandardConfig.cginc" - -#if UNITY_STANDARD_SIMPLE - #include "UnityStandardCoreForwardSimple.cginc" - VertexOutputBaseSimple vertBase (VertexInput v) { return vertForwardBaseSimple(v); } - VertexOutputForwardAddSimple vertAdd (VertexInput v) { return vertForwardAddSimple(v); } - half4 fragBase (VertexOutputBaseSimple i) : SV_Target { return fragForwardBaseSimpleInternal(i); } - half4 fragAdd (VertexOutputForwardAddSimple i) : SV_Target { return fragForwardAddSimpleInternal(i); } -#else - #include "UnityStandardCore.cginc" - VertexOutputForwardBase vertBase (VertexInput v) { return vertForwardBase(v); } - VertexOutputForwardAdd vertAdd (VertexInput v) { return vertForwardAdd(v); } - half4 fragBase (VertexOutputForwardBase i) : SV_Target { return fragForwardBaseInternal(i); } - half4 fragAdd (VertexOutputForwardAdd i) : SV_Target { return fragForwardAddInternal(i); } -#endif - -#endif // UNITY_STANDARD_CORE_FORWARD_INCLUDED diff --git a/Assets/MaterializeFX/Shaders/Standart/UnityStandardCoreForward.cginc.meta b/Assets/MaterializeFX/Shaders/Standart/UnityStandardCoreForward.cginc.meta deleted file mode 100644 index f8ede908..00000000 --- a/Assets/MaterializeFX/Shaders/Standart/UnityStandardCoreForward.cginc.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 36a2c581e9fc42f418df7c3257a57ba3 -timeCreated: 1522477140 -licenseType: Store -ShaderImporter: - externalObjects: {} - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MaterializeFX/Shaders/Standart/UnityStandardCoreForwardSimple.cginc b/Assets/MaterializeFX/Shaders/Standart/UnityStandardCoreForwardSimple.cginc deleted file mode 100644 index 66751d27..00000000 --- a/Assets/MaterializeFX/Shaders/Standart/UnityStandardCoreForwardSimple.cginc +++ /dev/null @@ -1,376 +0,0 @@ -// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) - -#ifndef UNITY_STANDARD_CORE_FORWARD_SIMPLE_INCLUDED -#define UNITY_STANDARD_CORE_FORWARD_SIMPLE_INCLUDED - -#include "UnityStandardCore.cginc" - -// Does not support: _PARALLAXMAP, DIRLIGHTMAP_COMBINED -#define GLOSSMAP (defined(_SPECGLOSSMAP) || defined(_METALLICGLOSSMAP)) - -#ifndef SPECULAR_HIGHLIGHTS - #define SPECULAR_HIGHLIGHTS (!defined(_SPECULAR_HIGHLIGHTS_OFF)) -#endif - -struct VertexOutputBaseSimple -{ - UNITY_POSITION(pos); - float4 tex : TEXCOORD0; - half4 eyeVec : TEXCOORD1; // w: grazingTerm - - half4 ambientOrLightmapUV : TEXCOORD2; // SH or Lightmap UV - SHADOW_COORDS(3) - UNITY_FOG_COORDS_PACKED(4, half4) // x: fogCoord, yzw: reflectVec - - half4 normalWorld : TEXCOORD5; // w: fresnelTerm - -#ifdef _NORMALMAP - half3 tangentSpaceLightDir : TEXCOORD6; - #if SPECULAR_HIGHLIGHTS - half3 tangentSpaceEyeVec : TEXCOORD7; - #endif -#endif -#if UNITY_REQUIRE_FRAG_WORLDPOS - float3 posWorld : TEXCOORD8; -#endif - - UNITY_VERTEX_OUTPUT_STEREO -}; - -// UNIFORM_REFLECTIVITY(): workaround to get (uniform) reflecivity based on UNITY_SETUP_BRDF_INPUT -half MetallicSetup_Reflectivity() -{ - return 1.0h - OneMinusReflectivityFromMetallic(_Metallic); -} - -half SpecularSetup_Reflectivity() -{ - return SpecularStrength(_SpecColor.rgb); -} - -#define JOIN2(a, b) a##b -#define JOIN(a, b) JOIN2(a,b) -#define UNIFORM_REFLECTIVITY JOIN(UNITY_SETUP_BRDF_INPUT, _Reflectivity) - - -#ifdef _NORMALMAP - -half3 TransformToTangentSpace(half3 tangent, half3 binormal, half3 normal, half3 v) -{ - // Mali400 shader compiler prefers explicit dot product over using a half3x3 matrix - return half3(dot(tangent, v), dot(binormal, v), dot(normal, v)); -} - -void TangentSpaceLightingInput(half3 normalWorld, half4 vTangent, half3 lightDirWorld, half3 eyeVecWorld, out half3 tangentSpaceLightDir, out half3 tangentSpaceEyeVec) -{ - half3 tangentWorld = UnityObjectToWorldDir(vTangent.xyz); - half sign = half(vTangent.w) * half(unity_WorldTransformParams.w); - half3 binormalWorld = cross(normalWorld, tangentWorld) * sign; - tangentSpaceLightDir = TransformToTangentSpace(tangentWorld, binormalWorld, normalWorld, lightDirWorld); - #if SPECULAR_HIGHLIGHTS - tangentSpaceEyeVec = normalize(TransformToTangentSpace(tangentWorld, binormalWorld, normalWorld, eyeVecWorld)); - #else - tangentSpaceEyeVec = 0; - #endif -} - -#endif // _NORMALMAP - -VertexOutputBaseSimple vertForwardBaseSimple (VertexInput v) -{ - UNITY_SETUP_INSTANCE_ID(v); - VertexOutputBaseSimple o; - UNITY_INITIALIZE_OUTPUT(VertexOutputBaseSimple, o); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - - float4 posWorld = mul(unity_ObjectToWorld, v.vertex); - o.pos = UnityObjectToClipPos(v.vertex); - o.tex = TexCoords(v); - - half3 eyeVec = normalize(posWorld.xyz - _WorldSpaceCameraPos); - half3 normalWorld = UnityObjectToWorldNormal(v.normal); - - o.normalWorld.xyz = normalWorld; - o.eyeVec.xyz = eyeVec; - - #ifdef _NORMALMAP - half3 tangentSpaceEyeVec; - TangentSpaceLightingInput(normalWorld, v.tangent, _WorldSpaceLightPos0.xyz, eyeVec, o.tangentSpaceLightDir, tangentSpaceEyeVec); - #if SPECULAR_HIGHLIGHTS - o.tangentSpaceEyeVec = tangentSpaceEyeVec; - #endif - #endif - - //We need this for shadow receiving - TRANSFER_SHADOW(o); - - o.ambientOrLightmapUV = VertexGIForward(v, posWorld, normalWorld); - - o.fogCoord.yzw = reflect(eyeVec, normalWorld); - - o.normalWorld.w = Pow4(1 - saturate(dot(normalWorld, -eyeVec))); // fresnel term - #if !GLOSSMAP - o.eyeVec.w = saturate(_Glossiness + UNIFORM_REFLECTIVITY()); // grazing term - #endif - - UNITY_TRANSFER_FOG(o, o.pos); - return o; -} - - -FragmentCommonData FragmentSetupSimple(VertexOutputBaseSimple i, float4 mfxUv, float3 mfxVertexPos)
-{ - //half alpha = Alpha(i.tex.xy); - //#if defined(_ALPHATEST_ON) - // clip (alpha - _Cutoff); - //#endif - - //MFX - half alpha = GetMfxDissolve(i.mfxUv, i.worldPos); - MfxClip(alpha); - - FragmentCommonData s = UNITY_SETUP_BRDF_INPUT (i.tex); - - // NOTE: shader relies on pre-multiply alpha-blend (_SrcBlend = One, _DstBlend = OneMinusSrcAlpha) - s.diffColor = PreMultiplyAlpha (s.diffColor, alpha, s.oneMinusReflectivity, /*out*/ s.alpha); - s.alpha = alpha; - s.normalWorld = i.normalWorld.xyz; - s.eyeVec = i.eyeVec.xyz; - s.posWorld = IN_WORLDPOS(i); - s.reflUVW = i.fogCoord.yzw; - - #ifdef _NORMALMAP - s.tangentSpaceNormal = NormalInTangentSpace(i.tex); - #else - s.tangentSpaceNormal = 0; - #endif - - return s; -} - -UnityLight MainLightSimple(VertexOutputBaseSimple i, FragmentCommonData s) -{ - UnityLight mainLight = MainLight(); - return mainLight; -} - -half PerVertexGrazingTerm(VertexOutputBaseSimple i, FragmentCommonData s) -{ - #if GLOSSMAP - return saturate(s.smoothness + (1-s.oneMinusReflectivity)); - #else - return i.eyeVec.w; - #endif -} - -half PerVertexFresnelTerm(VertexOutputBaseSimple i) -{ - return i.normalWorld.w; -} - -#if !SPECULAR_HIGHLIGHTS -# define REFLECTVEC_FOR_SPECULAR(i, s) half3(0, 0, 0) -#elif defined(_NORMALMAP) -# define REFLECTVEC_FOR_SPECULAR(i, s) reflect(i.tangentSpaceEyeVec, s.tangentSpaceNormal) -#else -# define REFLECTVEC_FOR_SPECULAR(i, s) s.reflUVW -#endif - -half3 LightDirForSpecular(VertexOutputBaseSimple i, UnityLight mainLight) -{ - #if SPECULAR_HIGHLIGHTS && defined(_NORMALMAP) - return i.tangentSpaceLightDir; - #else - return mainLight.dir; - #endif -} - -half3 BRDF3DirectSimple(half3 diffColor, half3 specColor, half smoothness, half rl) -{ - #if SPECULAR_HIGHLIGHTS - return BRDF3_Direct(diffColor, specColor, Pow4(rl), smoothness); - #else - return diffColor; - #endif -} - -half4 fragForwardBaseSimpleInternal (VertexOutputBaseSimple i) -{ - UNITY_APPLY_DITHER_CROSSFADE(i.pos.xy); - - FragmentCommonData s = FragmentSetupSimple(i); - - UnityLight mainLight = MainLightSimple(i, s); - - #if !defined(LIGHTMAP_ON) && defined(_NORMALMAP) - half ndotl = saturate(dot(s.tangentSpaceNormal, i.tangentSpaceLightDir)); - #else - half ndotl = saturate(dot(s.normalWorld, mainLight.dir)); - #endif - - //we can't have worldpos here (not enough interpolator on SM 2.0) so no shadow fade in that case. - half shadowMaskAttenuation = UnitySampleBakedOcclusion(i.ambientOrLightmapUV, 0); - half realtimeShadowAttenuation = SHADOW_ATTENUATION(i); - half atten = UnityMixRealtimeAndBakedShadows(realtimeShadowAttenuation, shadowMaskAttenuation, 0); - - half occlusion = Occlusion(i.tex.xy); - half rl = dot(REFLECTVEC_FOR_SPECULAR(i, s), LightDirForSpecular(i, mainLight)); - - UnityGI gi = FragmentGI (s, occlusion, i.ambientOrLightmapUV, atten, mainLight); - half3 attenuatedLightColor = gi.light.color * ndotl; - - half3 c = BRDF3_Indirect(s.diffColor, s.specColor, gi.indirect, PerVertexGrazingTerm(i, s), PerVertexFresnelTerm(i)); - c += BRDF3DirectSimple(s.diffColor, s.specColor, s.smoothness, rl) * attenuatedLightColor; - c += Emission(i.tex.xy); - - UNITY_APPLY_FOG(i.fogCoord, c); - - return OutputForward (half4(c, 1), s.alpha); -} - -half4 fragForwardBaseSimple (VertexOutputBaseSimple i) : SV_Target // backward compatibility (this used to be the fragment entry function) -{ - return fragForwardBaseSimpleInternal(i); -} - -struct VertexOutputForwardAddSimple -{ - UNITY_POSITION(pos); - float4 tex : TEXCOORD0; - float3 posWorld : TEXCOORD1; - - UNITY_SHADOW_COORDS(2) - -#if !defined(_NORMALMAP) && SPECULAR_HIGHLIGHTS - UNITY_FOG_COORDS_PACKED(3, half4) // x: fogCoord, yzw: reflectVec -#else - UNITY_FOG_COORDS_PACKED(3, half1) -#endif - - half3 lightDir : TEXCOORD4; - -#if defined(_NORMALMAP) - #if SPECULAR_HIGHLIGHTS - half3 tangentSpaceEyeVec : TEXCOORD5; - #endif -#else - half3 normalWorld : TEXCOORD5; -#endif - - UNITY_VERTEX_OUTPUT_STEREO -}; - -VertexOutputForwardAddSimple vertForwardAddSimple (VertexInput v) -{ - VertexOutputForwardAddSimple o; - UNITY_SETUP_INSTANCE_ID(v); - UNITY_INITIALIZE_OUTPUT(VertexOutputForwardAddSimple, o); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - - float4 posWorld = mul(unity_ObjectToWorld, v.vertex); - o.pos = UnityObjectToClipPos(v.vertex); - o.tex = TexCoords(v); - o.posWorld = posWorld.xyz; - - //We need this for shadow receiving - UNITY_TRANSFER_SHADOW(o, v.uv1); - - half3 lightDir = _WorldSpaceLightPos0.xyz - posWorld.xyz * _WorldSpaceLightPos0.w; - #ifndef USING_DIRECTIONAL_LIGHT - lightDir = NormalizePerVertexNormal(lightDir); - #endif - - #if SPECULAR_HIGHLIGHTS - half3 eyeVec = normalize(posWorld.xyz - _WorldSpaceCameraPos); - #endif - - half3 normalWorld = UnityObjectToWorldNormal(v.normal); - - #ifdef _NORMALMAP - #if SPECULAR_HIGHLIGHTS - TangentSpaceLightingInput(normalWorld, v.tangent, lightDir, eyeVec, o.lightDir, o.tangentSpaceEyeVec); - #else - half3 ignore; - TangentSpaceLightingInput(normalWorld, v.tangent, lightDir, 0, o.lightDir, ignore); - #endif - #else - o.lightDir = lightDir; - o.normalWorld = normalWorld; - #if SPECULAR_HIGHLIGHTS - o.fogCoord.yzw = reflect(eyeVec, normalWorld); - #endif - #endif - - UNITY_TRANSFER_FOG(o,o.pos); - return o; -} - -FragmentCommonData FragmentSetupSimpleAdd(VertexOutputForwardAddSimple i, float4 mfxUv, float3 mfxVertexPos)
-{ - //half alpha = Alpha(i.tex.xy); - //#if defined(_ALPHATEST_ON) - // clip (alpha - _Cutoff); - //#endif - - half alpha = GetMfxDissolve(i.mfxUv, i.worldPos); - MfxClip(alpha); - - FragmentCommonData s = UNITY_SETUP_BRDF_INPUT (i.tex); - - // NOTE: shader relies on pre-multiply alpha-blend (_SrcBlend = One, _DstBlend = OneMinusSrcAlpha) - s.diffColor = PreMultiplyAlpha (s.diffColor, alpha, s.oneMinusReflectivity, /*out*/ s.alpha); - s.alpha = alpha; - s.eyeVec = 0; - s.posWorld = i.posWorld; - - #ifdef _NORMALMAP - s.tangentSpaceNormal = NormalInTangentSpace(i.tex); - s.normalWorld = 0; - #else - s.tangentSpaceNormal = 0; - s.normalWorld = i.normalWorld; - #endif - - #if SPECULAR_HIGHLIGHTS && !defined(_NORMALMAP) - s.reflUVW = i.fogCoord.yzw; - #else - s.reflUVW = 0; - #endif - - return s; -} - -half3 LightSpaceNormal(VertexOutputForwardAddSimple i, FragmentCommonData s) -{ - #ifdef _NORMALMAP - return s.tangentSpaceNormal; - #else - return i.normalWorld; - #endif -} - -half4 fragForwardAddSimpleInternal(VertexOutputForwardAddSimple i, float4 mfxUv, float3 mfxVertexPos)
-{ - UNITY_APPLY_DITHER_CROSSFADE(i.pos.xy); - - FragmentCommonData s = FragmentSetupSimpleAdd(i); - - half3 c = BRDF3DirectSimple(s.diffColor, s.specColor, s.smoothness, dot(REFLECTVEC_FOR_SPECULAR(i, s), i.lightDir)); - - #if SPECULAR_HIGHLIGHTS // else diffColor has premultiplied light color - c *= _LightColor0.rgb; - #endif - - UNITY_LIGHT_ATTENUATION(atten, i, s.posWorld) - c *= atten * saturate(dot(LightSpaceNormal(i, s), i.lightDir)); - - UNITY_APPLY_FOG_COLOR(i.fogCoord, c.rgb, half4(0,0,0,0)); // fog towards black in additive pass - return OutputForward (half4(c, 1), s.alpha); -} - -half4 fragForwardAddSimple (VertexOutputForwardAddSimple i) : SV_Target // backward compatibility (this used to be the fragment entry function) -{ - return fragForwardAddSimpleInternal(i); -} - -#endif // UNITY_STANDARD_CORE_FORWARD_SIMPLE_INCLUDED diff --git a/Assets/MaterializeFX/Shaders/Standart/UnityStandardCoreForwardSimple.cginc.meta b/Assets/MaterializeFX/Shaders/Standart/UnityStandardCoreForwardSimple.cginc.meta deleted file mode 100644 index 08c3faf9..00000000 --- a/Assets/MaterializeFX/Shaders/Standart/UnityStandardCoreForwardSimple.cginc.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 687eaee521d30524490beeea14de5f7e -timeCreated: 1522477140 -licenseType: Store -ShaderImporter: - externalObjects: {} - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MaterializeFX/Shaders/Standart/UnityStandardInput.cginc b/Assets/MaterializeFX/Shaders/Standart/UnityStandardInput.cginc deleted file mode 100644 index 3c206a64..00000000 --- a/Assets/MaterializeFX/Shaders/Standart/UnityStandardInput.cginc +++ /dev/null @@ -1,240 +0,0 @@ -// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) - -#ifndef UNITY_STANDARD_INPUT_INCLUDED -#define UNITY_STANDARD_INPUT_INCLUDED - -#include "UnityCG.cginc" -#include "UnityStandardConfig.cginc" -#include "UnityPBSLighting.cginc" // TBD: remove -#include "UnityStandardUtils.cginc" - -//--------------------------------------- -// Directional lightmaps & Parallax require tangent space too -#if (_NORMALMAP || DIRLIGHTMAP_COMBINED || _PARALLAXMAP) - #define _TANGENT_TO_WORLD 1 -#endif - -#if (_DETAIL_MULX2 || _DETAIL_MUL || _DETAIL_ADD || _DETAIL_LERP) - #define _DETAIL 1 -#endif - -//--------------------------------------- -half4 _Color; -half _Cutoff; - -sampler2D _MainTex; -float4 _MainTex_ST; - -sampler2D _DetailAlbedoMap; -float4 _DetailAlbedoMap_ST; - -sampler2D _BumpMap; -half _BumpScale; - -sampler2D _DetailMask; -sampler2D _DetailNormalMap; -half _DetailNormalMapScale; - -sampler2D _SpecGlossMap; -sampler2D _MetallicGlossMap; -half _Metallic; -half _Glossiness; -half _GlossMapScale; - -sampler2D _OcclusionMap; -half _OcclusionStrength; - -sampler2D _ParallaxMap; -half _Parallax; -half _UVSec; - -half4 _EmissionColor; -sampler2D _EmissionMap; - -//------------------------------------------------------------------------------------- -// Input functions - -struct VertexInput -{ - float4 vertex : POSITION; - half3 normal : NORMAL; - float2 uv0 : TEXCOORD0; - float2 uv1 : TEXCOORD1; -#if defined(DYNAMICLIGHTMAP_ON) || defined(UNITY_PASS_META) - float2 uv2 : TEXCOORD2; -#endif -#ifdef _TANGENT_TO_WORLD - half4 tangent : TANGENT; -#endif - UNITY_VERTEX_INPUT_INSTANCE_ID -}; - -float4 TexCoords(VertexInput v) -{ - float4 texcoord; - texcoord.xy = TRANSFORM_TEX(v.uv0, _MainTex); // Always source from uv0 - texcoord.zw = TRANSFORM_TEX(((_UVSec == 0) ? v.uv0 : v.uv1), _DetailAlbedoMap); - return texcoord; -} - -half DetailMask(float2 uv) -{ - return tex2D (_DetailMask, uv).a; -} - -half3 Albedo(float4 texcoords) -{ - half3 albedo = _Color.rgb * tex2D (_MainTex, texcoords.xy).rgb; -#if _DETAIL - #if (SHADER_TARGET < 30) - // SM20: instruction count limitation - // SM20: no detail mask - half mask = 1; - #else - half mask = DetailMask(texcoords.xy); - #endif - half3 detailAlbedo = tex2D (_DetailAlbedoMap, texcoords.zw).rgb; - #if _DETAIL_MULX2 - albedo *= LerpWhiteTo (detailAlbedo * unity_ColorSpaceDouble.rgb, mask); - #elif _DETAIL_MUL - albedo *= LerpWhiteTo (detailAlbedo, mask); - #elif _DETAIL_ADD - albedo += detailAlbedo * mask; - #elif _DETAIL_LERP - albedo = lerp (albedo, detailAlbedo, mask); - #endif -#endif - return albedo; -} - -half Alpha(float2 uv) -{ -#if defined(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A) - return _Color.a; -#else - return tex2D(_MainTex, uv).a * _Color.a; -#endif -} - -half Occlusion(float2 uv) -{ -#if (SHADER_TARGET < 30) - // SM20: instruction count limitation - // SM20: simpler occlusion - return tex2D(_OcclusionMap, uv).g; -#else - half occ = tex2D(_OcclusionMap, uv).g; - return LerpOneTo (occ, _OcclusionStrength); -#endif -} - -half4 SpecularGloss(float2 uv) -{ - half4 sg; -#ifdef _SPECGLOSSMAP - #if defined(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A) - sg.rgb = tex2D(_SpecGlossMap, uv).rgb; - sg.a = tex2D(_MainTex, uv).a; - #else - sg = tex2D(_SpecGlossMap, uv); - #endif - sg.a *= _GlossMapScale; -#else - sg.rgb = _SpecColor.rgb; - #ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A - sg.a = tex2D(_MainTex, uv).a * _GlossMapScale; - #else - sg.a = _Glossiness; - #endif -#endif - return sg; -} - -half2 MetallicGloss(float2 uv) -{ - half2 mg; - -#ifdef _METALLICGLOSSMAP - #ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A - mg.r = tex2D(_MetallicGlossMap, uv).r; - mg.g = tex2D(_MainTex, uv).a; - #else - mg = tex2D(_MetallicGlossMap, uv).ra; - #endif - mg.g *= _GlossMapScale; -#else - mg.r = _Metallic; - #ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A - mg.g = tex2D(_MainTex, uv).a * _GlossMapScale; - #else - mg.g = _Glossiness; - #endif -#endif - return mg; -} - -half2 MetallicRough(float2 uv) -{ - half2 mg; -#ifdef _METALLICGLOSSMAP - mg.r = tex2D(_MetallicGlossMap, uv).r; -#else - mg.r = _Metallic; -#endif - -#ifdef _SPECGLOSSMAP - mg.g = 1.0f - tex2D(_SpecGlossMap, uv).r; -#else - mg.g = 1.0f - _Glossiness; -#endif - return mg; -} - -half3 Emission(float2 uv) -{ -#ifndef _EMISSION - return 0; -#else - return tex2D(_EmissionMap, uv).rgb * _EmissionColor.rgb; -#endif -} - -#ifdef _NORMALMAP -half3 NormalInTangentSpace(float4 texcoords) -{ - half3 normalTangent = UnpackScaleNormal(tex2D (_BumpMap, texcoords.xy), _BumpScale); - -#if _DETAIL && defined(UNITY_ENABLE_DETAIL_NORMALMAP) - half mask = DetailMask(texcoords.xy); - half3 detailNormalTangent = UnpackScaleNormal(tex2D (_DetailNormalMap, texcoords.zw), _DetailNormalMapScale); - #if _DETAIL_LERP - normalTangent = lerp( - normalTangent, - detailNormalTangent, - mask); - #else - normalTangent = lerp( - normalTangent, - BlendNormals(normalTangent, detailNormalTangent), - mask); - #endif -#endif - - return normalTangent; -} -#endif - -float4 Parallax (float4 texcoords, half3 viewDir) -{ -#if !defined(_PARALLAXMAP) || (SHADER_TARGET < 30) - // Disable parallax on pre-SM3.0 shader target models - return texcoords; -#else - half h = tex2D (_ParallaxMap, texcoords.xy).g; - float2 offset = ParallaxOffset1Step (h, _Parallax, viewDir); - return float4(texcoords.xy + offset, texcoords.zw + offset); -#endif - -} - -#endif // UNITY_STANDARD_INPUT_INCLUDED diff --git a/Assets/MaterializeFX/Shaders/Standart/UnityStandardInput.cginc.meta b/Assets/MaterializeFX/Shaders/Standart/UnityStandardInput.cginc.meta deleted file mode 100644 index 54eb16f5..00000000 --- a/Assets/MaterializeFX/Shaders/Standart/UnityStandardInput.cginc.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 9ad9a6ef1083a9b439514ea8a9604108 -timeCreated: 1522477140 -licenseType: Store -ShaderImporter: - externalObjects: {} - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MaterializeFX/Shaders/Standart/UnityStandardMeta.cginc b/Assets/MaterializeFX/Shaders/Standart/UnityStandardMeta.cginc deleted file mode 100644 index 37ce2a5b..00000000 --- a/Assets/MaterializeFX/Shaders/Standart/UnityStandardMeta.cginc +++ /dev/null @@ -1,64 +0,0 @@ -// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) - -#ifndef UNITY_STANDARD_META_INCLUDED -#define UNITY_STANDARD_META_INCLUDED - -// Functionality for Standard shader "meta" pass -// (extracts albedo/emission for lightmapper etc.) - -// define meta pass before including other files; they have conditions -// on that in some places -#define UNITY_PASS_META 1 - -#include "UnityCG.cginc" -#include "UnityStandardInput.cginc" -#include "UnityMetaPass.cginc" -#include "UnityStandardCore.cginc" - -struct v2f_meta -{ - float4 uv : TEXCOORD0; - float4 pos : SV_POSITION; -}; - -v2f_meta vert_meta (VertexInput v) -{ - v2f_meta o; - o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST); - o.uv = TexCoords(v); - return o; -} - -// Albedo for lightmapping should basically be diffuse color. -// But rough metals (black diffuse) still scatter quite a lot of light around, so -// we want to take some of that into account too. -half3 UnityLightmappingAlbedo (half3 diffuse, half3 specular, half smoothness) -{ - half roughness = SmoothnessToRoughness(smoothness); - half3 res = diffuse; - res += specular * roughness * 0.5; - return res; -} - -float4 frag_meta (v2f_meta i) : SV_Target -{ - // we're interested in diffuse & specular colors, - // and surface roughness to produce final albedo. - FragmentCommonData data = UNITY_SETUP_BRDF_INPUT (i.uv, float4(0, 0, 0, 0), float3(0, 0, 0)); - - UnityMetaInput o; - UNITY_INITIALIZE_OUTPUT(UnityMetaInput, o); - -#if defined(EDITOR_VISUALIZATION) - o.Albedo = data.diffColor; -#else - o.Albedo = UnityLightmappingAlbedo (data.diffColor, data.specColor, data.smoothness); -#endif - o.SpecularColor = data.specColor; - - o.Emission = Emission(i.uv.xy); - - return UnityMetaFragment(o); -} - -#endif // UNITY_STANDARD_META_INCLUDED diff --git a/Assets/MaterializeFX/Shaders/Standart/UnityStandardMeta.cginc.meta b/Assets/MaterializeFX/Shaders/Standart/UnityStandardMeta.cginc.meta deleted file mode 100644 index c0959554..00000000 --- a/Assets/MaterializeFX/Shaders/Standart/UnityStandardMeta.cginc.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 521102cceb95c1445b5537c1384d2b43 -timeCreated: 1522477140 -licenseType: Store -ShaderImporter: - externalObjects: {} - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/MaterializeFX/Shaders/Standart/UnityStandardShadow.cginc b/Assets/MaterializeFX/Shaders/Standart/UnityStandardShadow.cginc deleted file mode 100644 index 0f716cc3..00000000 --- a/Assets/MaterializeFX/Shaders/Standart/UnityStandardShadow.cginc +++ /dev/null @@ -1,233 +0,0 @@ -// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
-
-#ifndef UNITY_STANDARD_SHADOW_INCLUDED
-#define UNITY_STANDARD_SHADOW_INCLUDED
-
-// NOTE: had to split shadow functions into separate file,
-// otherwise compiler gives trouble with LIGHTING_COORDS macro (in UnityStandardCore.cginc)
-
-#include "UnityCG.cginc"
-#include "UnityShaderVariables.cginc"
-#include "UnityInstancing.cginc"
-#include "UnityStandardConfig.cginc"
-#include "UnityStandardUtils.cginc"
-
-#if (defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON)) && defined(UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS)
- #define UNITY_STANDARD_USE_DITHER_MASK 1
-#endif
-
-// Need to output UVs in shadow caster, since we need to sample texture and do clip/dithering based on it
-#if defined(_ALPHATEST_ON) || defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON)
-#define UNITY_STANDARD_USE_SHADOW_UVS 1
-#endif
-
-// Has a non-empty shadow caster output struct (it's an error to have empty structs on some platforms...)
-#if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS)
-#define UNITY_STANDARD_USE_SHADOW_OUTPUT_STRUCT 1
-#endif
-
-#ifdef UNITY_STEREO_INSTANCING_ENABLED
-#define UNITY_STANDARD_USE_STEREO_SHADOW_OUTPUT_STRUCT 1
-#endif
-
-
-half4 _Color;
-half _Cutoff;
-sampler2D _MainTex;
-float4 _MainTex_ST;
-#ifdef UNITY_STANDARD_USE_DITHER_MASK
-sampler3D _DitherMaskLOD;
-#endif
-
-// Handle PremultipliedAlpha from Fade or Transparent shading mode
-half4 _SpecColor;
-half _Metallic;
-#ifdef _SPECGLOSSMAP
-sampler2D _SpecGlossMap;
-#endif
-#ifdef _METALLICGLOSSMAP
-sampler2D _MetallicGlossMap;
-#endif
-
-#if defined(UNITY_STANDARD_USE_SHADOW_UVS) && defined(_PARALLAXMAP)
-sampler2D _ParallaxMap;
-half _Parallax;
-#endif
-
-//MFX
-#include "Assets/MaterializeFX/Shaders/cginc/MFX.cginc"
-
-half MetallicSetup_ShadowGetOneMinusReflectivity(half2 uv)
-{
- half metallicity = _Metallic;
- #ifdef _METALLICGLOSSMAP
- metallicity = tex2D(_MetallicGlossMap, uv).r;
- #endif
- return OneMinusReflectivityFromMetallic(metallicity);
-}
-
-half RoughnessSetup_ShadowGetOneMinusReflectivity(half2 uv)
-{
- half metallicity = _Metallic;
-#ifdef _METALLICGLOSSMAP
- metallicity = tex2D(_MetallicGlossMap, uv).r;
-#endif
- return OneMinusReflectivityFromMetallic(metallicity);
-}
-
-half SpecularSetup_ShadowGetOneMinusReflectivity(half2 uv)
-{
- half3 specColor = _SpecColor.rgb;
- #ifdef _SPECGLOSSMAP
- specColor = tex2D(_SpecGlossMap, uv).rgb;
- #endif
- return (1 - SpecularStrength(specColor));
-}
-
-// SHADOW_ONEMINUSREFLECTIVITY(): workaround to get one minus reflectivity based on UNITY_SETUP_BRDF_INPUT
-#define SHADOW_JOIN2(a, b) a##b
-#define SHADOW_JOIN(a, b) SHADOW_JOIN2(a,b)
-#define SHADOW_ONEMINUSREFLECTIVITY SHADOW_JOIN(UNITY_SETUP_BRDF_INPUT, _ShadowGetOneMinusReflectivity)
-
-struct VertexInput
-{
- float4 vertex : POSITION;
- float3 normal : NORMAL;
- float2 uv0 : TEXCOORD0;
- #if defined(UNITY_STANDARD_USE_SHADOW_UVS) && defined(_PARALLAXMAP)
- half4 tangent : TANGENT;
- #endif
- UNITY_VERTEX_INPUT_INSTANCE_ID
-};
-
-#ifdef UNITY_STANDARD_USE_SHADOW_OUTPUT_STRUCT
-struct VertexOutputShadowCaster
-{
- V2F_SHADOW_CASTER_NOPOS
- #if defined(UNITY_STANDARD_USE_SHADOW_UVS)
- float2 tex : TEXCOORD1;
-
- #if defined(_PARALLAXMAP)
- half3 viewDirForParallax : TEXCOORD2;
- #endif
- #endif
-
- //MFX
- float4 mfxUv : TEXCOORD5;
- float3 worldPos : TEXCOORD6;
-};
-#endif
-
-#ifdef UNITY_STANDARD_USE_STEREO_SHADOW_OUTPUT_STRUCT
-struct VertexOutputStereoShadowCaster
-{
- UNITY_VERTEX_OUTPUT_STEREO
-
- //MFX
- float4 mfxUv : TEXCOORD5;
- float3 worldPos : TEXCOORD6;
-};
-#endif
-
-// We have to do these dances of outputting SV_POSITION separately from the vertex shader,
-// and inputting VPOS in the pixel shader, since they both map to "POSITION" semantic on
-// some platforms, and then things don't go well.
-
-
-void vertShadowCaster (VertexInput v
- , out float4 opos : SV_POSITION
- #ifdef UNITY_STANDARD_USE_SHADOW_OUTPUT_STRUCT
- , out VertexOutputShadowCaster o
- #endif
- #ifdef UNITY_STANDARD_USE_STEREO_SHADOW_OUTPUT_STRUCT
- , out VertexOutputStereoShadowCaster os
- #endif
-)
-{
- UNITY_SETUP_INSTANCE_ID(v);
-
- #ifdef UNITY_STANDARD_USE_SHADOW_OUTPUT_STRUCT
- UNITY_INITIALIZE_OUTPUT(VertexOutputShadowCaster, o);
- #endif
-
- #ifdef UNITY_STANDARD_USE_STEREO_SHADOW_OUTPUT_STRUCT
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(os);
- #endif
- TRANSFER_SHADOW_CASTER_NOPOS(o,opos)
- #if defined(UNITY_STANDARD_USE_SHADOW_UVS)
- o.tex = TRANSFORM_TEX(v.uv0, _MainTex);
-
- #ifdef _PARALLAXMAP
- TANGENT_SPACE_ROTATION;
- o.viewDirForParallax = mul (rotation, ObjSpaceViewDir(v.vertex));
- #endif
- #endif
-
-#ifdef UNITY_STANDARD_USE_SHADOW_OUTPUT_STRUCT
- //MFX
- PassMfxVertex2Fragment(v.uv0.xy, o.mfxUv);
- o.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
-#endif
-#ifdef UNITY_STANDARD_USE_STEREO_SHADOW_OUTPUT_STRUCT
- //MFX
- PassMfxVertex2Fragment(v.uv0.xy, os.mfxUv);
- os.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
-#endif
-}
-
-
-half4 fragShadowCaster (UNITY_POSITION(vpos)
-#ifdef UNITY_STANDARD_USE_SHADOW_OUTPUT_STRUCT
- , VertexOutputShadowCaster i
-#endif
-) : SV_Target
-{
- #if defined(UNITY_STANDARD_USE_SHADOW_UVS)
- #if defined(_PARALLAXMAP) && (SHADER_TARGET >= 30)
- half3 viewDirForParallax = normalize(i.viewDirForParallax);
- fixed h = tex2D (_ParallaxMap, i.tex.xy).g;
- half2 offset = ParallaxOffset1Step (h, _Parallax, viewDirForParallax);
- i.tex.xy += offset;
- #endif
-
- //MFX
- half alpha = GetMfxDissolve(i.mfxUv, i.worldPos);
- MfxClip(alpha);
-
- // half alpha = tex2D(_MainTex, i.tesx).a * _Color.a;
- // #if defined(_ALPHATEST_ON)
- // clip (alpha - _Cutoff);
- // #endif
- // #if defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON)
- // #if defined(_ALPHAPREMULTIPLY_ON)
- // half outModifiedAlpha;
- // PreMultiplyAlpha(half3(0, 0, 0), alpha, SHADOW_ONEMINUSREFLECTIVITY(i.tex), outModifiedAlpha);
- // alpha = outModifiedAlpha;
- // #endif
- // #if defined(UNITY_STANDARD_USE_DITHER_MASK)
- // // Use dither mask for alpha blended shadows, based on pixel position xy
- // // and alpha level. Our dither texture is 4x4x16.
- // #ifdef LOD_FADE_CROSSFADE
- // #define _LOD_FADE_ON_ALPHA
- // alpha *= unity_LODFade.y;
- // #endif
- // half alphaRef = tex3D(_DitherMaskLOD, float3(vpos.xy*0.25,alpha*0.9375)).a;
- // clip (alphaRef - 0.01);
- // #else
- // clip (alpha - _Cutoff);
- // #endif
- // #endif
- #endif // #if defined(UNITY_STANDARD_USE_SHADOW_UVS)
-
- #ifdef LOD_FADE_CROSSFADE
- #ifdef _LOD_FADE_ON_ALPHA
- #undef _LOD_FADE_ON_ALPHA
- #else
- UnityApplyDitherCrossFade(vpos.xy);
- #endif
- #endif
-
- SHADOW_CASTER_FRAGMENT(i)
-}
-
-#endif // UNITY_STANDARD_SHADOW_INCLUDED
diff --git a/Assets/MaterializeFX/Shaders/Standart/UnityStandardShadow.cginc.meta b/Assets/MaterializeFX/Shaders/Standart/UnityStandardShadow.cginc.meta deleted file mode 100644 index db93af3a..00000000 --- a/Assets/MaterializeFX/Shaders/Standart/UnityStandardShadow.cginc.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2
-guid: f6c98ee1cfbc55346b4d629c5de75e00
-timeCreated: 1522477140
-licenseType: Store
-ShaderImporter:
- externalObjects: {}
- defaultTextures: []
- userData:
- assetBundleName:
- assetBundleVariant:
|