4288 lines
230 KiB
GLSL
4288 lines
230 KiB
GLSL
Shader "NatureManufacture/URP/Particles/NM Decal"
|
|
{
|
|
Properties
|
|
{
|
|
[ToggleUI]_Alpha_Use_T_Base_Color_A_F_Maskmap_B("Alpha Use (T) Base Color A (F) Maskmap B", Float) = 1
|
|
_BaseColor("Base Color", Color) = (1, 1, 1, 1)
|
|
[NoScaleOffset]_BaseColorMap("Base Map", 2D) = "white" {}
|
|
[Normal][NoScaleOffset]_NormalMap("Normal Map", 2D) = "bump" {}
|
|
Normal_Blend("Normal Blend", Float) = 0.5
|
|
[ToggleUI]_MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B("MaskMap Alpha Use (T) Base Color A (F) Maskmap B", Float) = 1
|
|
[NoScaleOffset]_MaskMap("MaskMap", 2D) = "white" {}
|
|
_MetallicRemapMin("Metallic Remap Min", Range(0, 1)) = 0
|
|
_MetallicRemapMax("Metallic Remap Max", Range(0, 1)) = 1
|
|
_AORemapMin("AO Remap Min", Range(0, 1)) = 0
|
|
_AORemapMax("AO Remap Max", Range(0, 1)) = 1
|
|
_SmoothnessRemapMin("Smoothness Remap Min", Range(0, 1)) = 0
|
|
_SmoothnessRemapMax("Smoothness Remap Max", Range(0, 1)) = 1
|
|
_MaskBlendSrc("Mask Map Opacity", Range(0, 1)) = 1
|
|
[HDR]_EmissiveColor("Emissive Color", Color) = (0, 0, 0, 0)
|
|
[NoScaleOffset]_EmissiveColorMap("Emissive Color Map", 2D) = "white" {}
|
|
[HideInInspector]_DrawOrder("Draw Order", Range(-50, 50)) = 0
|
|
[HideInInspector][Enum(Depth Bias, 0, View Bias, 1)]_DecalMeshBiasType("DecalMesh BiasType", Float) = 0
|
|
[HideInInspector]_DecalMeshDepthBias("DecalMesh DepthBias", Float) = 0
|
|
[HideInInspector]_DecalMeshViewBias("DecalMesh ViewBias", Float) = 0
|
|
[HideInInspector]_DecalAngleFadeSupported("Decal Angle Fade Supported", Float) = 1
|
|
[HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
|
|
[HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
|
|
[HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
|
|
}
|
|
SubShader
|
|
{
|
|
Tags
|
|
{
|
|
"RenderPipeline"="UniversalPipeline"
|
|
// RenderType: <None>
|
|
"PreviewType"="Plane"
|
|
// Queue: <None>
|
|
"ShaderGraphShader"="true"
|
|
"ShaderGraphTargetId"=""
|
|
}
|
|
Pass
|
|
{
|
|
Name "DBufferProjector"
|
|
Tags
|
|
{
|
|
"LightMode" = "DBufferProjector"
|
|
}
|
|
|
|
// Render State
|
|
Cull Front
|
|
Blend 0 SrcAlpha OneMinusSrcAlpha, Zero OneMinusSrcAlpha
|
|
Blend 1 SrcAlpha OneMinusSrcAlpha, Zero OneMinusSrcAlpha
|
|
Blend 2 SrcAlpha OneMinusSrcAlpha, Zero OneMinusSrcAlpha
|
|
ZTest Greater
|
|
ZWrite Off
|
|
ColorMask RGBA
|
|
ColorMask RGBA 1
|
|
ColorMask RGBA 2
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 3.5
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
#pragma multi_compile_instancing
|
|
#pragma editor_sync_compilation
|
|
|
|
// Keywords
|
|
#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
|
|
// GraphKeywords: <None>
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
|
|
// Defines
|
|
#define ATTRIBUTES_NEED_TEXCOORD0
|
|
#define VARYINGS_NEED_TEXCOORD0
|
|
|
|
#define HAVE_MESH_MODIFICATION
|
|
|
|
|
|
#define SHADERPASS SHADERPASS_DBUFFER_PROJECTOR
|
|
#define _MATERIAL_AFFECTS_ALBEDO 1
|
|
#define _MATERIAL_AFFECTS_NORMAL 1
|
|
#define _MATERIAL_AFFECTS_NORMAL_BLEND 1
|
|
#define _MATERIAL_AFFECTS_MAOS 1
|
|
#define DECAL_ANGLE_FADE 1
|
|
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// -- Properties used by ScenePickingPass
|
|
#ifdef SCENEPICKINGPASS
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
// Includes
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Structs and Packing
|
|
|
|
struct Attributes
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float4 uv0 : TEXCOORD0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : INSTANCEID_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct Varyings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 texCoord0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct SurfaceDescriptionInputs
|
|
{
|
|
float3 TangentSpaceNormal;
|
|
float4 uv0;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
};
|
|
struct PackedVaryings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 texCoord0 : INTERP0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
PackedVaryings PackVaryings (Varyings input)
|
|
{
|
|
PackedVaryings output;
|
|
ZERO_INITIALIZE(PackedVaryings, output);
|
|
output.positionCS = input.positionCS;
|
|
output.texCoord0.xyzw = input.texCoord0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
Varyings UnpackVaryings (PackedVaryings input)
|
|
{
|
|
Varyings output;
|
|
output.positionCS = input.positionCS;
|
|
output.texCoord0 = input.texCoord0.xyzw;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
|
|
// --------------------------------------------------
|
|
// Graph
|
|
|
|
// Graph Properties
|
|
CBUFFER_START(UnityPerMaterial)
|
|
float4 _BaseColorMap_TexelSize;
|
|
float4 _NormalMap_TexelSize;
|
|
float Normal_Blend;
|
|
float4 _BaseColor;
|
|
float4 _MaskMap_TexelSize;
|
|
float _MetallicRemapMax;
|
|
float _MetallicRemapMin;
|
|
float _AORemapMin;
|
|
float _AORemapMax;
|
|
float _SmoothnessRemapMin;
|
|
float _SmoothnessRemapMax;
|
|
float _MaskBlendSrc;
|
|
float4 _EmissiveColor;
|
|
float4 _EmissiveColorMap_TexelSize;
|
|
float _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _DrawOrder;
|
|
float _DecalMeshBiasType;
|
|
float _DecalMeshDepthBias;
|
|
float _DecalMeshViewBias;
|
|
float _DecalAngleFadeSupported;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_BaseColorMap);
|
|
SAMPLER(sampler_BaseColorMap);
|
|
TEXTURE2D(_NormalMap);
|
|
SAMPLER(sampler_NormalMap);
|
|
TEXTURE2D(_MaskMap);
|
|
SAMPLER(sampler_MaskMap);
|
|
TEXTURE2D(_EmissiveColorMap);
|
|
SAMPLER(sampler_EmissiveColorMap);
|
|
|
|
// Graph Functions
|
|
|
|
void Unity_Multiply_float4_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Branch_float(float Predicate, float True, float False, out float Out)
|
|
{
|
|
Out = Predicate ? True : False;
|
|
}
|
|
|
|
void Unity_Multiply_float_float(float A, float B, out float Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Remap_float(float In, float2 InMinMax, float2 OutMinMax, out float Out)
|
|
{
|
|
Out = OutMinMax.x + (In - InMinMax.x) * (OutMinMax.y - OutMinMax.x) / (InMinMax.y - InMinMax.x);
|
|
}
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
};
|
|
|
|
VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
|
|
{
|
|
VertexDescription description = (VertexDescription)0;
|
|
return description;
|
|
}
|
|
|
|
// Graph Pixel
|
|
struct SurfaceDescription
|
|
{
|
|
float3 BaseColor;
|
|
float Alpha;
|
|
float3 NormalTS;
|
|
float NormalAlpha;
|
|
float Metallic;
|
|
float Occlusion;
|
|
float Smoothness;
|
|
float MAOSAlpha;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
float4 _Property_320fefd883db46679cd769f61b130dd7_Out_0 = _BaseColor;
|
|
UnityTexture2D _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0 = UnityBuildTexture2DStructNoScale(_BaseColorMap);
|
|
float4 _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0 = SAMPLE_TEXTURE2D(_Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.tex, _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.samplerstate, _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_R_4 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.r;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_G_5 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.g;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_B_6 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.b;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_A_7 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.a;
|
|
float4 _Multiply_885586d42d884019a5375f12f3c61e52_Out_2;
|
|
Unity_Multiply_float4_float4(_Property_320fefd883db46679cd769f61b130dd7_Out_0, _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0, _Multiply_885586d42d884019a5375f12f3c61e52_Out_2);
|
|
float _Property_97f64a9c7748494dbf6dc5b32920f5a5_Out_0 = _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_R_1 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[0];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_G_2 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[1];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_B_3 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[2];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[3];
|
|
UnityTexture2D _Property_b46891aff98b4364a190337410150f10_Out_0 = UnityBuildTexture2DStructNoScale(_MaskMap);
|
|
float4 _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0 = SAMPLE_TEXTURE2D(_Property_b46891aff98b4364a190337410150f10_Out_0.tex, _Property_b46891aff98b4364a190337410150f10_Out_0.samplerstate, _Property_b46891aff98b4364a190337410150f10_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_R_4 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.r;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_G_5 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.g;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.b;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_A_7 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.a;
|
|
float _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3;
|
|
Unity_Branch_float(_Property_97f64a9c7748494dbf6dc5b32920f5a5_Out_0, _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3);
|
|
UnityTexture2D _Property_360e6833e8d64d75827ab98987b2b545_Out_0 = UnityBuildTexture2DStructNoScale(_NormalMap);
|
|
float4 _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0 = SAMPLE_TEXTURE2D(_Property_360e6833e8d64d75827ab98987b2b545_Out_0.tex, _Property_360e6833e8d64d75827ab98987b2b545_Out_0.samplerstate, _Property_360e6833e8d64d75827ab98987b2b545_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.rgb = UnpackNormal(_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0);
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_R_4 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.r;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_G_5 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.g;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_B_6 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.b;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_A_7 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.a;
|
|
float _Property_e94639b7a37847e1a4616aeed6a21034_Out_0 = _MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _Branch_39df5838709544d2951602a5ba721694_Out_3;
|
|
Unity_Branch_float(_Property_e94639b7a37847e1a4616aeed6a21034_Out_0, _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Branch_39df5838709544d2951602a5ba721694_Out_3);
|
|
float _Property_1ed131c6c6bd4d3b9225106c761ab06c_Out_0 = Normal_Blend;
|
|
float _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2;
|
|
Unity_Multiply_float_float(_Branch_39df5838709544d2951602a5ba721694_Out_3, _Property_1ed131c6c6bd4d3b9225106c761ab06c_Out_0, _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2);
|
|
float _Property_5830ed7c65ef489e93de994fcb2769e2_Out_0 = _MetallicRemapMin;
|
|
float _Property_3b33ae94b35943b5bbaa24c03b7069a8_Out_0 = _MetallicRemapMax;
|
|
float2 _Vector2_0ad2d19d32894d5e83e19e69d72753fd_Out_0 = float2(_Property_5830ed7c65ef489e93de994fcb2769e2_Out_0, _Property_3b33ae94b35943b5bbaa24c03b7069a8_Out_0);
|
|
float _Remap_b3145e45987e489f9b15e9672b41a608_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_R_4, float2 (0, 1), _Vector2_0ad2d19d32894d5e83e19e69d72753fd_Out_0, _Remap_b3145e45987e489f9b15e9672b41a608_Out_3);
|
|
float _Property_6427dba68c8342eebff5ce521921ddc5_Out_0 = _AORemapMin;
|
|
float _Property_f74a95489f364e41b53a083f89ad2365_Out_0 = _AORemapMax;
|
|
float2 _Vector2_a00f84e5347b414ca0e9496b9948ba0b_Out_0 = float2(_Property_6427dba68c8342eebff5ce521921ddc5_Out_0, _Property_f74a95489f364e41b53a083f89ad2365_Out_0);
|
|
float _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_G_5, float2 (0, 1), _Vector2_a00f84e5347b414ca0e9496b9948ba0b_Out_0, _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3);
|
|
float _Property_9d6993415be843799b7ec2e689c5db02_Out_0 = _SmoothnessRemapMin;
|
|
float _Property_df4aa91a4fe94e5f8768553f10cd1f82_Out_0 = _SmoothnessRemapMax;
|
|
float2 _Vector2_d67e05a1240344f3978c1c9e3cb9525f_Out_0 = float2(_Property_9d6993415be843799b7ec2e689c5db02_Out_0, _Property_df4aa91a4fe94e5f8768553f10cd1f82_Out_0);
|
|
float _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_A_7, float2 (0, 1), _Vector2_d67e05a1240344f3978c1c9e3cb9525f_Out_0, _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3);
|
|
float _Property_5c661f4099b14a5bac0c24977977340d_Out_0 = _MaskBlendSrc;
|
|
float _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2;
|
|
Unity_Multiply_float_float(_Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _Property_5c661f4099b14a5bac0c24977977340d_Out_0, _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2);
|
|
float _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2;
|
|
Unity_Multiply_float_float(_Property_5c661f4099b14a5bac0c24977977340d_Out_0, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2);
|
|
float _Branch_753c02949c6b4f128d654534f2d64ced_Out_3;
|
|
Unity_Branch_float(_Property_e94639b7a37847e1a4616aeed6a21034_Out_0, _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2, _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2, _Branch_753c02949c6b4f128d654534f2d64ced_Out_3);
|
|
surface.BaseColor = (_Multiply_885586d42d884019a5375f12f3c61e52_Out_2.xyz);
|
|
surface.Alpha = _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3;
|
|
surface.NormalTS = (_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.xyz);
|
|
surface.NormalAlpha = _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2;
|
|
surface.Metallic = _Remap_b3145e45987e489f9b15e9672b41a608_Out_3;
|
|
surface.Occlusion = _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3;
|
|
surface.Smoothness = _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3;
|
|
surface.MAOSAlpha = _Branch_753c02949c6b4f128d654534f2d64ced_Out_3;
|
|
return surface;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Graph Inputs
|
|
|
|
|
|
// $features.graphVertex: $include("VertexAnimation.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : VertexAnimation.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
|
|
// $features.graphPixel: $include("SharedCode.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : SharedCode.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
|
{
|
|
SurfaceDescriptionInputs output;
|
|
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
|
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorCopyToSDI' */
|
|
|
|
|
|
|
|
output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
|
#else
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
#endif
|
|
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
|
|
return output;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Surface Data
|
|
|
|
uint2 ComputeFadeMaskSeed(uint2 positionSS)
|
|
{
|
|
uint2 fadeMaskSeed;
|
|
|
|
// Can't use the view direction, it is the same across the entire screen.
|
|
fadeMaskSeed = positionSS;
|
|
|
|
return fadeMaskSeed;
|
|
}
|
|
|
|
void GetSurfaceData(Varyings input, uint2 positionSS, float angleFadeFactor, out DecalSurfaceData surfaceData)
|
|
{
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
half4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld);
|
|
half fadeFactor = clamp(normalToWorld[0][3], 0.0f, 1.0f) * angleFadeFactor;
|
|
float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]);
|
|
float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]);
|
|
input.texCoord0.xy = input.texCoord0.xy * scale + offset;
|
|
half3 normalWS = TransformObjectToWorldDir(half3(0, 1, 0));
|
|
half3 tangentWS = TransformObjectToWorldDir(half3(1, 0, 0));
|
|
half3 bitangentWS = TransformObjectToWorldDir(half3(0, 0, 1));
|
|
half sign = dot(cross(normalWS, tangentWS), bitangentWS) > 0 ? 1 : -1;
|
|
#else
|
|
#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group
|
|
LODDitheringTransition(ComputeFadeMaskSeed(positionSS), unity_LODFade.x);
|
|
#endif
|
|
|
|
half fadeFactor = half(1.0);
|
|
#endif
|
|
|
|
SurfaceDescriptionInputs surfaceDescriptionInputs = BuildSurfaceDescriptionInputs(input);
|
|
SurfaceDescription surfaceDescription = SurfaceDescriptionFunction(surfaceDescriptionInputs);
|
|
|
|
// setup defaults -- these are used if the graph doesn't output a value
|
|
ZERO_INITIALIZE(DecalSurfaceData, surfaceData);
|
|
surfaceData.occlusion = half(1.0);
|
|
surfaceData.smoothness = half(0);
|
|
|
|
#ifdef _MATERIAL_AFFECTS_NORMAL
|
|
surfaceData.normalWS.w = half(1.0);
|
|
#else
|
|
surfaceData.normalWS.w = half(0.0);
|
|
#endif
|
|
|
|
|
|
// copy across graph values, if defined
|
|
surfaceData.baseColor.xyz = half3(surfaceDescription.BaseColor);
|
|
surfaceData.baseColor.w = half(surfaceDescription.Alpha * fadeFactor);
|
|
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz));
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz);
|
|
#endif
|
|
#elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
float sgn = input.tangentWS.w; // should be either +1 or -1
|
|
float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz);
|
|
half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz);
|
|
|
|
// We need to normalize as we use mikkt tangent space and this is expected (tangent space is not normalize)
|
|
surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld));
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); // Default to vertex normal
|
|
#endif
|
|
#endif
|
|
|
|
surfaceData.normalWS.w = surfaceDescription.NormalAlpha * fadeFactor;
|
|
|
|
// In case of Smoothness / AO / Metal, all the three are always computed but color mask can change
|
|
surfaceData.metallic = half(surfaceDescription.Metallic);
|
|
surfaceData.occlusion = half(surfaceDescription.Occlusion);
|
|
surfaceData.smoothness = half(surfaceDescription.Smoothness);
|
|
surfaceData.MAOSAlpha = half(surfaceDescription.MAOSAlpha * fadeFactor);
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Main
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPassDecal.hlsl"
|
|
|
|
ENDHLSL
|
|
}
|
|
Pass
|
|
{
|
|
Name "DecalProjectorForwardEmissive"
|
|
Tags
|
|
{
|
|
"LightMode" = "DecalProjectorForwardEmissive"
|
|
}
|
|
|
|
// Render State
|
|
Cull Front
|
|
Blend 0 SrcAlpha One
|
|
ZTest Greater
|
|
ZWrite Off
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 3.5
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
#pragma multi_compile_instancing
|
|
#pragma editor_sync_compilation
|
|
|
|
// Keywords
|
|
// PassKeywords: <None>
|
|
// GraphKeywords: <None>
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
|
|
// Defines
|
|
#define ATTRIBUTES_NEED_TEXCOORD0
|
|
#define VARYINGS_NEED_TEXCOORD0
|
|
|
|
#define HAVE_MESH_MODIFICATION
|
|
|
|
|
|
#define SHADERPASS SHADERPASS_FORWARD_EMISSIVE_PROJECTOR
|
|
#define _MATERIAL_AFFECTS_ALBEDO 1
|
|
#define _MATERIAL_AFFECTS_NORMAL 1
|
|
#define _MATERIAL_AFFECTS_NORMAL_BLEND 1
|
|
#define _MATERIAL_AFFECTS_MAOS 1
|
|
#define DECAL_ANGLE_FADE 1
|
|
#define _MATERIAL_AFFECTS_EMISSION 1
|
|
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// -- Properties used by ScenePickingPass
|
|
#ifdef SCENEPICKINGPASS
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
// Includes
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Structs and Packing
|
|
|
|
struct Attributes
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float4 uv0 : TEXCOORD0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : INSTANCEID_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct Varyings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 texCoord0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct SurfaceDescriptionInputs
|
|
{
|
|
float4 uv0;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
};
|
|
struct PackedVaryings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 texCoord0 : INTERP0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
PackedVaryings PackVaryings (Varyings input)
|
|
{
|
|
PackedVaryings output;
|
|
ZERO_INITIALIZE(PackedVaryings, output);
|
|
output.positionCS = input.positionCS;
|
|
output.texCoord0.xyzw = input.texCoord0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
Varyings UnpackVaryings (PackedVaryings input)
|
|
{
|
|
Varyings output;
|
|
output.positionCS = input.positionCS;
|
|
output.texCoord0 = input.texCoord0.xyzw;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
|
|
// --------------------------------------------------
|
|
// Graph
|
|
|
|
// Graph Properties
|
|
CBUFFER_START(UnityPerMaterial)
|
|
float4 _BaseColorMap_TexelSize;
|
|
float4 _NormalMap_TexelSize;
|
|
float Normal_Blend;
|
|
float4 _BaseColor;
|
|
float4 _MaskMap_TexelSize;
|
|
float _MetallicRemapMax;
|
|
float _MetallicRemapMin;
|
|
float _AORemapMin;
|
|
float _AORemapMax;
|
|
float _SmoothnessRemapMin;
|
|
float _SmoothnessRemapMax;
|
|
float _MaskBlendSrc;
|
|
float4 _EmissiveColor;
|
|
float4 _EmissiveColorMap_TexelSize;
|
|
float _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _DrawOrder;
|
|
float _DecalMeshBiasType;
|
|
float _DecalMeshDepthBias;
|
|
float _DecalMeshViewBias;
|
|
float _DecalAngleFadeSupported;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_BaseColorMap);
|
|
SAMPLER(sampler_BaseColorMap);
|
|
TEXTURE2D(_NormalMap);
|
|
SAMPLER(sampler_NormalMap);
|
|
TEXTURE2D(_MaskMap);
|
|
SAMPLER(sampler_MaskMap);
|
|
TEXTURE2D(_EmissiveColorMap);
|
|
SAMPLER(sampler_EmissiveColorMap);
|
|
|
|
// Graph Functions
|
|
|
|
void Unity_Multiply_float4_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Branch_float(float Predicate, float True, float False, out float Out)
|
|
{
|
|
Out = Predicate ? True : False;
|
|
}
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
};
|
|
|
|
VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
|
|
{
|
|
VertexDescription description = (VertexDescription)0;
|
|
return description;
|
|
}
|
|
|
|
// Graph Pixel
|
|
struct SurfaceDescription
|
|
{
|
|
float Alpha;
|
|
float3 Emission;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
float _Property_97f64a9c7748494dbf6dc5b32920f5a5_Out_0 = _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float4 _Property_320fefd883db46679cd769f61b130dd7_Out_0 = _BaseColor;
|
|
UnityTexture2D _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0 = UnityBuildTexture2DStructNoScale(_BaseColorMap);
|
|
float4 _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0 = SAMPLE_TEXTURE2D(_Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.tex, _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.samplerstate, _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_R_4 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.r;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_G_5 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.g;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_B_6 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.b;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_A_7 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.a;
|
|
float4 _Multiply_885586d42d884019a5375f12f3c61e52_Out_2;
|
|
Unity_Multiply_float4_float4(_Property_320fefd883db46679cd769f61b130dd7_Out_0, _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0, _Multiply_885586d42d884019a5375f12f3c61e52_Out_2);
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_R_1 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[0];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_G_2 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[1];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_B_3 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[2];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[3];
|
|
UnityTexture2D _Property_b46891aff98b4364a190337410150f10_Out_0 = UnityBuildTexture2DStructNoScale(_MaskMap);
|
|
float4 _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0 = SAMPLE_TEXTURE2D(_Property_b46891aff98b4364a190337410150f10_Out_0.tex, _Property_b46891aff98b4364a190337410150f10_Out_0.samplerstate, _Property_b46891aff98b4364a190337410150f10_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_R_4 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.r;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_G_5 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.g;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.b;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_A_7 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.a;
|
|
float _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3;
|
|
Unity_Branch_float(_Property_97f64a9c7748494dbf6dc5b32920f5a5_Out_0, _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3);
|
|
float4 _Property_293317916e0e41cc98bbd5377294091b_Out_0 = IsGammaSpace() ? LinearToSRGB(_EmissiveColor) : _EmissiveColor;
|
|
UnityTexture2D _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0 = UnityBuildTexture2DStructNoScale(_EmissiveColorMap);
|
|
float4 _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0 = SAMPLE_TEXTURE2D(_Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.tex, _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.samplerstate, _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_R_4 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.r;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_G_5 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.g;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_B_6 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.b;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_A_7 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.a;
|
|
float4 _Multiply_2fa508cc2b6044e09e63453927d92375_Out_2;
|
|
Unity_Multiply_float4_float4(_Property_293317916e0e41cc98bbd5377294091b_Out_0, _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0, _Multiply_2fa508cc2b6044e09e63453927d92375_Out_2);
|
|
surface.Alpha = _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3;
|
|
surface.Emission = (_Multiply_2fa508cc2b6044e09e63453927d92375_Out_2.xyz);
|
|
return surface;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Graph Inputs
|
|
|
|
|
|
// $features.graphVertex: $include("VertexAnimation.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : VertexAnimation.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
|
|
// $features.graphPixel: $include("SharedCode.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : SharedCode.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
|
{
|
|
SurfaceDescriptionInputs output;
|
|
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
|
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorCopyToSDI' */
|
|
|
|
|
|
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
|
#else
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
#endif
|
|
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
|
|
return output;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Surface Data
|
|
|
|
uint2 ComputeFadeMaskSeed(uint2 positionSS)
|
|
{
|
|
uint2 fadeMaskSeed;
|
|
|
|
// Can't use the view direction, it is the same across the entire screen.
|
|
fadeMaskSeed = positionSS;
|
|
|
|
return fadeMaskSeed;
|
|
}
|
|
|
|
void GetSurfaceData(Varyings input, uint2 positionSS, float angleFadeFactor, out DecalSurfaceData surfaceData)
|
|
{
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
half4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld);
|
|
half fadeFactor = clamp(normalToWorld[0][3], 0.0f, 1.0f) * angleFadeFactor;
|
|
float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]);
|
|
float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]);
|
|
input.texCoord0.xy = input.texCoord0.xy * scale + offset;
|
|
half3 normalWS = TransformObjectToWorldDir(half3(0, 1, 0));
|
|
half3 tangentWS = TransformObjectToWorldDir(half3(1, 0, 0));
|
|
half3 bitangentWS = TransformObjectToWorldDir(half3(0, 0, 1));
|
|
half sign = dot(cross(normalWS, tangentWS), bitangentWS) > 0 ? 1 : -1;
|
|
#else
|
|
#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group
|
|
LODDitheringTransition(ComputeFadeMaskSeed(positionSS), unity_LODFade.x);
|
|
#endif
|
|
|
|
half fadeFactor = half(1.0);
|
|
#endif
|
|
|
|
SurfaceDescriptionInputs surfaceDescriptionInputs = BuildSurfaceDescriptionInputs(input);
|
|
SurfaceDescription surfaceDescription = SurfaceDescriptionFunction(surfaceDescriptionInputs);
|
|
|
|
// setup defaults -- these are used if the graph doesn't output a value
|
|
ZERO_INITIALIZE(DecalSurfaceData, surfaceData);
|
|
surfaceData.occlusion = half(1.0);
|
|
surfaceData.smoothness = half(0);
|
|
|
|
#ifdef _MATERIAL_AFFECTS_NORMAL
|
|
surfaceData.normalWS.w = half(1.0);
|
|
#else
|
|
surfaceData.normalWS.w = half(0.0);
|
|
#endif
|
|
|
|
surfaceData.emissive.rgb = half3(surfaceDescription.Emission.rgb * fadeFactor);
|
|
|
|
// copy across graph values, if defined
|
|
surfaceData.baseColor.w = half(surfaceDescription.Alpha * fadeFactor);
|
|
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz);
|
|
#endif
|
|
#elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
float sgn = input.tangentWS.w; // should be either +1 or -1
|
|
float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz);
|
|
half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz);
|
|
|
|
// We need to normalize as we use mikkt tangent space and this is expected (tangent space is not normalize)
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); // Default to vertex normal
|
|
#endif
|
|
#endif
|
|
|
|
|
|
// In case of Smoothness / AO / Metal, all the three are always computed but color mask can change
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Main
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPassDecal.hlsl"
|
|
|
|
ENDHLSL
|
|
}
|
|
Pass
|
|
{
|
|
Name "DecalScreenSpaceProjector"
|
|
Tags
|
|
{
|
|
"LightMode" = "DecalScreenSpaceProjector"
|
|
}
|
|
|
|
// Render State
|
|
Cull Front
|
|
Blend SrcAlpha OneMinusSrcAlpha
|
|
ZTest Greater
|
|
ZWrite Off
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 2.5
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
#pragma multi_compile_instancing
|
|
#pragma multi_compile_fog
|
|
#pragma editor_sync_compilation
|
|
|
|
// Keywords
|
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
|
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
|
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
|
|
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
|
#pragma multi_compile _ _CLUSTERED_RENDERING
|
|
#pragma multi_compile _DECAL_NORMAL_BLEND_LOW _DECAL_NORMAL_BLEND_MEDIUM _DECAL_NORMAL_BLEND_HIGH
|
|
// GraphKeywords: <None>
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
|
|
// Defines
|
|
#define ATTRIBUTES_NEED_NORMAL
|
|
#define ATTRIBUTES_NEED_TEXCOORD0
|
|
#define VARYINGS_NEED_NORMAL_WS
|
|
#define VARYINGS_NEED_VIEWDIRECTION_WS
|
|
#define VARYINGS_NEED_TEXCOORD0
|
|
#define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
|
|
#define VARYINGS_NEED_SH
|
|
#define VARYINGS_NEED_STATIC_LIGHTMAP_UV
|
|
#define VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV
|
|
|
|
#define HAVE_MESH_MODIFICATION
|
|
|
|
|
|
#define SHADERPASS SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR
|
|
#define _MATERIAL_AFFECTS_ALBEDO 1
|
|
#define _MATERIAL_AFFECTS_NORMAL 1
|
|
#define _MATERIAL_AFFECTS_NORMAL_BLEND 1
|
|
#define _MATERIAL_AFFECTS_MAOS 1
|
|
#define DECAL_ANGLE_FADE 1
|
|
#define _MATERIAL_AFFECTS_EMISSION 1
|
|
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// -- Properties used by ScenePickingPass
|
|
#ifdef SCENEPICKINGPASS
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
// Includes
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Structs and Packing
|
|
|
|
struct Attributes
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 uv0 : TEXCOORD0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : INSTANCEID_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct Varyings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float3 normalWS;
|
|
float4 texCoord0;
|
|
float3 viewDirectionWS;
|
|
#if defined(LIGHTMAP_ON)
|
|
float2 staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
float2 dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
float3 sh;
|
|
#endif
|
|
float4 fogFactorAndVertexLight;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct SurfaceDescriptionInputs
|
|
{
|
|
float3 TangentSpaceNormal;
|
|
float4 uv0;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
};
|
|
struct PackedVaryings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
#if defined(LIGHTMAP_ON)
|
|
float2 staticLightmapUV : INTERP0;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
float2 dynamicLightmapUV : INTERP1;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
float3 sh : INTERP2;
|
|
#endif
|
|
float4 texCoord0 : INTERP3;
|
|
float4 fogFactorAndVertexLight : INTERP4;
|
|
float3 normalWS : INTERP5;
|
|
float3 viewDirectionWS : INTERP6;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
PackedVaryings PackVaryings (Varyings input)
|
|
{
|
|
PackedVaryings output;
|
|
ZERO_INITIALIZE(PackedVaryings, output);
|
|
output.positionCS = input.positionCS;
|
|
#if defined(LIGHTMAP_ON)
|
|
output.staticLightmapUV = input.staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
output.dynamicLightmapUV = input.dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
output.sh = input.sh;
|
|
#endif
|
|
output.texCoord0.xyzw = input.texCoord0;
|
|
output.fogFactorAndVertexLight.xyzw = input.fogFactorAndVertexLight;
|
|
output.normalWS.xyz = input.normalWS;
|
|
output.viewDirectionWS.xyz = input.viewDirectionWS;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
Varyings UnpackVaryings (PackedVaryings input)
|
|
{
|
|
Varyings output;
|
|
output.positionCS = input.positionCS;
|
|
#if defined(LIGHTMAP_ON)
|
|
output.staticLightmapUV = input.staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
output.dynamicLightmapUV = input.dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
output.sh = input.sh;
|
|
#endif
|
|
output.texCoord0 = input.texCoord0.xyzw;
|
|
output.fogFactorAndVertexLight = input.fogFactorAndVertexLight.xyzw;
|
|
output.normalWS = input.normalWS.xyz;
|
|
output.viewDirectionWS = input.viewDirectionWS.xyz;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
|
|
// --------------------------------------------------
|
|
// Graph
|
|
|
|
// Graph Properties
|
|
CBUFFER_START(UnityPerMaterial)
|
|
float4 _BaseColorMap_TexelSize;
|
|
float4 _NormalMap_TexelSize;
|
|
float Normal_Blend;
|
|
float4 _BaseColor;
|
|
float4 _MaskMap_TexelSize;
|
|
float _MetallicRemapMax;
|
|
float _MetallicRemapMin;
|
|
float _AORemapMin;
|
|
float _AORemapMax;
|
|
float _SmoothnessRemapMin;
|
|
float _SmoothnessRemapMax;
|
|
float _MaskBlendSrc;
|
|
float4 _EmissiveColor;
|
|
float4 _EmissiveColorMap_TexelSize;
|
|
float _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _DrawOrder;
|
|
float _DecalMeshBiasType;
|
|
float _DecalMeshDepthBias;
|
|
float _DecalMeshViewBias;
|
|
float _DecalAngleFadeSupported;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_BaseColorMap);
|
|
SAMPLER(sampler_BaseColorMap);
|
|
TEXTURE2D(_NormalMap);
|
|
SAMPLER(sampler_NormalMap);
|
|
TEXTURE2D(_MaskMap);
|
|
SAMPLER(sampler_MaskMap);
|
|
TEXTURE2D(_EmissiveColorMap);
|
|
SAMPLER(sampler_EmissiveColorMap);
|
|
|
|
// Graph Functions
|
|
|
|
void Unity_Multiply_float4_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Branch_float(float Predicate, float True, float False, out float Out)
|
|
{
|
|
Out = Predicate ? True : False;
|
|
}
|
|
|
|
void Unity_Multiply_float_float(float A, float B, out float Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Remap_float(float In, float2 InMinMax, float2 OutMinMax, out float Out)
|
|
{
|
|
Out = OutMinMax.x + (In - InMinMax.x) * (OutMinMax.y - OutMinMax.x) / (InMinMax.y - InMinMax.x);
|
|
}
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
};
|
|
|
|
VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
|
|
{
|
|
VertexDescription description = (VertexDescription)0;
|
|
return description;
|
|
}
|
|
|
|
// Graph Pixel
|
|
struct SurfaceDescription
|
|
{
|
|
float3 BaseColor;
|
|
float Alpha;
|
|
float3 NormalTS;
|
|
float NormalAlpha;
|
|
float Metallic;
|
|
float Occlusion;
|
|
float Smoothness;
|
|
float MAOSAlpha;
|
|
float3 Emission;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
float4 _Property_320fefd883db46679cd769f61b130dd7_Out_0 = _BaseColor;
|
|
UnityTexture2D _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0 = UnityBuildTexture2DStructNoScale(_BaseColorMap);
|
|
float4 _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0 = SAMPLE_TEXTURE2D(_Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.tex, _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.samplerstate, _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_R_4 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.r;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_G_5 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.g;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_B_6 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.b;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_A_7 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.a;
|
|
float4 _Multiply_885586d42d884019a5375f12f3c61e52_Out_2;
|
|
Unity_Multiply_float4_float4(_Property_320fefd883db46679cd769f61b130dd7_Out_0, _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0, _Multiply_885586d42d884019a5375f12f3c61e52_Out_2);
|
|
float _Property_97f64a9c7748494dbf6dc5b32920f5a5_Out_0 = _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_R_1 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[0];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_G_2 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[1];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_B_3 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[2];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[3];
|
|
UnityTexture2D _Property_b46891aff98b4364a190337410150f10_Out_0 = UnityBuildTexture2DStructNoScale(_MaskMap);
|
|
float4 _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0 = SAMPLE_TEXTURE2D(_Property_b46891aff98b4364a190337410150f10_Out_0.tex, _Property_b46891aff98b4364a190337410150f10_Out_0.samplerstate, _Property_b46891aff98b4364a190337410150f10_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_R_4 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.r;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_G_5 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.g;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.b;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_A_7 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.a;
|
|
float _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3;
|
|
Unity_Branch_float(_Property_97f64a9c7748494dbf6dc5b32920f5a5_Out_0, _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3);
|
|
UnityTexture2D _Property_360e6833e8d64d75827ab98987b2b545_Out_0 = UnityBuildTexture2DStructNoScale(_NormalMap);
|
|
float4 _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0 = SAMPLE_TEXTURE2D(_Property_360e6833e8d64d75827ab98987b2b545_Out_0.tex, _Property_360e6833e8d64d75827ab98987b2b545_Out_0.samplerstate, _Property_360e6833e8d64d75827ab98987b2b545_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.rgb = UnpackNormal(_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0);
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_R_4 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.r;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_G_5 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.g;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_B_6 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.b;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_A_7 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.a;
|
|
float _Property_e94639b7a37847e1a4616aeed6a21034_Out_0 = _MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _Branch_39df5838709544d2951602a5ba721694_Out_3;
|
|
Unity_Branch_float(_Property_e94639b7a37847e1a4616aeed6a21034_Out_0, _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Branch_39df5838709544d2951602a5ba721694_Out_3);
|
|
float _Property_1ed131c6c6bd4d3b9225106c761ab06c_Out_0 = Normal_Blend;
|
|
float _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2;
|
|
Unity_Multiply_float_float(_Branch_39df5838709544d2951602a5ba721694_Out_3, _Property_1ed131c6c6bd4d3b9225106c761ab06c_Out_0, _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2);
|
|
float _Property_5830ed7c65ef489e93de994fcb2769e2_Out_0 = _MetallicRemapMin;
|
|
float _Property_3b33ae94b35943b5bbaa24c03b7069a8_Out_0 = _MetallicRemapMax;
|
|
float2 _Vector2_0ad2d19d32894d5e83e19e69d72753fd_Out_0 = float2(_Property_5830ed7c65ef489e93de994fcb2769e2_Out_0, _Property_3b33ae94b35943b5bbaa24c03b7069a8_Out_0);
|
|
float _Remap_b3145e45987e489f9b15e9672b41a608_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_R_4, float2 (0, 1), _Vector2_0ad2d19d32894d5e83e19e69d72753fd_Out_0, _Remap_b3145e45987e489f9b15e9672b41a608_Out_3);
|
|
float _Property_6427dba68c8342eebff5ce521921ddc5_Out_0 = _AORemapMin;
|
|
float _Property_f74a95489f364e41b53a083f89ad2365_Out_0 = _AORemapMax;
|
|
float2 _Vector2_a00f84e5347b414ca0e9496b9948ba0b_Out_0 = float2(_Property_6427dba68c8342eebff5ce521921ddc5_Out_0, _Property_f74a95489f364e41b53a083f89ad2365_Out_0);
|
|
float _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_G_5, float2 (0, 1), _Vector2_a00f84e5347b414ca0e9496b9948ba0b_Out_0, _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3);
|
|
float _Property_9d6993415be843799b7ec2e689c5db02_Out_0 = _SmoothnessRemapMin;
|
|
float _Property_df4aa91a4fe94e5f8768553f10cd1f82_Out_0 = _SmoothnessRemapMax;
|
|
float2 _Vector2_d67e05a1240344f3978c1c9e3cb9525f_Out_0 = float2(_Property_9d6993415be843799b7ec2e689c5db02_Out_0, _Property_df4aa91a4fe94e5f8768553f10cd1f82_Out_0);
|
|
float _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_A_7, float2 (0, 1), _Vector2_d67e05a1240344f3978c1c9e3cb9525f_Out_0, _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3);
|
|
float _Property_5c661f4099b14a5bac0c24977977340d_Out_0 = _MaskBlendSrc;
|
|
float _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2;
|
|
Unity_Multiply_float_float(_Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _Property_5c661f4099b14a5bac0c24977977340d_Out_0, _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2);
|
|
float _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2;
|
|
Unity_Multiply_float_float(_Property_5c661f4099b14a5bac0c24977977340d_Out_0, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2);
|
|
float _Branch_753c02949c6b4f128d654534f2d64ced_Out_3;
|
|
Unity_Branch_float(_Property_e94639b7a37847e1a4616aeed6a21034_Out_0, _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2, _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2, _Branch_753c02949c6b4f128d654534f2d64ced_Out_3);
|
|
float4 _Property_293317916e0e41cc98bbd5377294091b_Out_0 = IsGammaSpace() ? LinearToSRGB(_EmissiveColor) : _EmissiveColor;
|
|
UnityTexture2D _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0 = UnityBuildTexture2DStructNoScale(_EmissiveColorMap);
|
|
float4 _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0 = SAMPLE_TEXTURE2D(_Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.tex, _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.samplerstate, _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_R_4 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.r;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_G_5 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.g;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_B_6 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.b;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_A_7 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.a;
|
|
float4 _Multiply_2fa508cc2b6044e09e63453927d92375_Out_2;
|
|
Unity_Multiply_float4_float4(_Property_293317916e0e41cc98bbd5377294091b_Out_0, _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0, _Multiply_2fa508cc2b6044e09e63453927d92375_Out_2);
|
|
surface.BaseColor = (_Multiply_885586d42d884019a5375f12f3c61e52_Out_2.xyz);
|
|
surface.Alpha = _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3;
|
|
surface.NormalTS = (_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.xyz);
|
|
surface.NormalAlpha = _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2;
|
|
surface.Metallic = _Remap_b3145e45987e489f9b15e9672b41a608_Out_3;
|
|
surface.Occlusion = _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3;
|
|
surface.Smoothness = _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3;
|
|
surface.MAOSAlpha = _Branch_753c02949c6b4f128d654534f2d64ced_Out_3;
|
|
surface.Emission = (_Multiply_2fa508cc2b6044e09e63453927d92375_Out_2.xyz);
|
|
return surface;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Graph Inputs
|
|
|
|
|
|
// $features.graphVertex: $include("VertexAnimation.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : VertexAnimation.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
|
|
// $features.graphPixel: $include("SharedCode.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : SharedCode.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
|
{
|
|
SurfaceDescriptionInputs output;
|
|
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
|
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorCopyToSDI' */
|
|
|
|
|
|
|
|
output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
|
#else
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
#endif
|
|
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
|
|
return output;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Surface Data
|
|
|
|
uint2 ComputeFadeMaskSeed(uint2 positionSS)
|
|
{
|
|
uint2 fadeMaskSeed;
|
|
|
|
// Can't use the view direction, it is the same across the entire screen.
|
|
fadeMaskSeed = positionSS;
|
|
|
|
return fadeMaskSeed;
|
|
}
|
|
|
|
void GetSurfaceData(Varyings input, uint2 positionSS, float angleFadeFactor, out DecalSurfaceData surfaceData)
|
|
{
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
half4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld);
|
|
half fadeFactor = clamp(normalToWorld[0][3], 0.0f, 1.0f) * angleFadeFactor;
|
|
float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]);
|
|
float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]);
|
|
input.texCoord0.xy = input.texCoord0.xy * scale + offset;
|
|
half3 normalWS = TransformObjectToWorldDir(half3(0, 1, 0));
|
|
half3 tangentWS = TransformObjectToWorldDir(half3(1, 0, 0));
|
|
half3 bitangentWS = TransformObjectToWorldDir(half3(0, 0, 1));
|
|
half sign = dot(cross(normalWS, tangentWS), bitangentWS) > 0 ? 1 : -1;
|
|
input.normalWS.xyz = normalWS;
|
|
#else
|
|
#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group
|
|
LODDitheringTransition(ComputeFadeMaskSeed(positionSS), unity_LODFade.x);
|
|
#endif
|
|
|
|
half fadeFactor = half(1.0);
|
|
#endif
|
|
|
|
SurfaceDescriptionInputs surfaceDescriptionInputs = BuildSurfaceDescriptionInputs(input);
|
|
SurfaceDescription surfaceDescription = SurfaceDescriptionFunction(surfaceDescriptionInputs);
|
|
|
|
// setup defaults -- these are used if the graph doesn't output a value
|
|
ZERO_INITIALIZE(DecalSurfaceData, surfaceData);
|
|
surfaceData.occlusion = half(1.0);
|
|
surfaceData.smoothness = half(0);
|
|
|
|
#ifdef _MATERIAL_AFFECTS_NORMAL
|
|
surfaceData.normalWS.w = half(1.0);
|
|
#else
|
|
surfaceData.normalWS.w = half(0.0);
|
|
#endif
|
|
|
|
surfaceData.emissive.rgb = half3(surfaceDescription.Emission.rgb * fadeFactor);
|
|
|
|
// copy across graph values, if defined
|
|
surfaceData.baseColor.xyz = half3(surfaceDescription.BaseColor);
|
|
surfaceData.baseColor.w = half(surfaceDescription.Alpha * fadeFactor);
|
|
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz));
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz);
|
|
#endif
|
|
#elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
float sgn = input.tangentWS.w; // should be either +1 or -1
|
|
float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz);
|
|
half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz);
|
|
|
|
// We need to normalize as we use mikkt tangent space and this is expected (tangent space is not normalize)
|
|
surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld));
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); // Default to vertex normal
|
|
#endif
|
|
#endif
|
|
|
|
surfaceData.normalWS.w = surfaceDescription.NormalAlpha * fadeFactor;
|
|
|
|
// In case of Smoothness / AO / Metal, all the three are always computed but color mask can change
|
|
surfaceData.metallic = half(surfaceDescription.Metallic);
|
|
surfaceData.occlusion = half(surfaceDescription.Occlusion);
|
|
surfaceData.smoothness = half(surfaceDescription.Smoothness);
|
|
surfaceData.MAOSAlpha = half(surfaceDescription.MAOSAlpha * fadeFactor);
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Main
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPassDecal.hlsl"
|
|
|
|
ENDHLSL
|
|
}
|
|
Pass
|
|
{
|
|
Name "DecalGBufferProjector"
|
|
Tags
|
|
{
|
|
"LightMode" = "DecalGBufferProjector"
|
|
}
|
|
|
|
// Render State
|
|
Cull Front
|
|
Blend 0 SrcAlpha OneMinusSrcAlpha
|
|
Blend 1 SrcAlpha OneMinusSrcAlpha
|
|
Blend 2 SrcAlpha OneMinusSrcAlpha
|
|
Blend 3 SrcAlpha OneMinusSrcAlpha
|
|
ZTest Greater
|
|
ZWrite Off
|
|
ColorMask RGB
|
|
ColorMask 0 1
|
|
ColorMask RGB 2
|
|
ColorMask RGB 3
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 3.5
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
#pragma multi_compile_instancing
|
|
#pragma multi_compile_fog
|
|
#pragma editor_sync_compilation
|
|
|
|
// Keywords
|
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
|
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
|
#pragma multi_compile _DECAL_NORMAL_BLEND_LOW _DECAL_NORMAL_BLEND_MEDIUM _DECAL_NORMAL_BLEND_HIGH
|
|
#pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
|
|
// GraphKeywords: <None>
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
|
|
// Defines
|
|
#define ATTRIBUTES_NEED_NORMAL
|
|
#define ATTRIBUTES_NEED_TEXCOORD0
|
|
#define VARYINGS_NEED_NORMAL_WS
|
|
#define VARYINGS_NEED_VIEWDIRECTION_WS
|
|
#define VARYINGS_NEED_TEXCOORD0
|
|
#define VARYINGS_NEED_SH
|
|
#define VARYINGS_NEED_STATIC_LIGHTMAP_UV
|
|
#define VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV
|
|
|
|
#define HAVE_MESH_MODIFICATION
|
|
|
|
|
|
#define SHADERPASS SHADERPASS_DECAL_GBUFFER_PROJECTOR
|
|
#define _MATERIAL_AFFECTS_ALBEDO 1
|
|
#define _MATERIAL_AFFECTS_NORMAL 1
|
|
#define _MATERIAL_AFFECTS_NORMAL_BLEND 1
|
|
#define _MATERIAL_AFFECTS_MAOS 1
|
|
#define DECAL_ANGLE_FADE 1
|
|
#define _MATERIAL_AFFECTS_EMISSION 1
|
|
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// -- Properties used by ScenePickingPass
|
|
#ifdef SCENEPICKINGPASS
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
// Includes
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Structs and Packing
|
|
|
|
struct Attributes
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 uv0 : TEXCOORD0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : INSTANCEID_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct Varyings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float3 normalWS;
|
|
float4 texCoord0;
|
|
float3 viewDirectionWS;
|
|
#if defined(LIGHTMAP_ON)
|
|
float2 staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
float2 dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
float3 sh;
|
|
#endif
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct SurfaceDescriptionInputs
|
|
{
|
|
float3 TangentSpaceNormal;
|
|
float4 uv0;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
};
|
|
struct PackedVaryings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
#if defined(LIGHTMAP_ON)
|
|
float2 staticLightmapUV : INTERP0;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
float2 dynamicLightmapUV : INTERP1;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
float3 sh : INTERP2;
|
|
#endif
|
|
float4 texCoord0 : INTERP3;
|
|
float3 normalWS : INTERP4;
|
|
float3 viewDirectionWS : INTERP5;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
PackedVaryings PackVaryings (Varyings input)
|
|
{
|
|
PackedVaryings output;
|
|
ZERO_INITIALIZE(PackedVaryings, output);
|
|
output.positionCS = input.positionCS;
|
|
#if defined(LIGHTMAP_ON)
|
|
output.staticLightmapUV = input.staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
output.dynamicLightmapUV = input.dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
output.sh = input.sh;
|
|
#endif
|
|
output.texCoord0.xyzw = input.texCoord0;
|
|
output.normalWS.xyz = input.normalWS;
|
|
output.viewDirectionWS.xyz = input.viewDirectionWS;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
Varyings UnpackVaryings (PackedVaryings input)
|
|
{
|
|
Varyings output;
|
|
output.positionCS = input.positionCS;
|
|
#if defined(LIGHTMAP_ON)
|
|
output.staticLightmapUV = input.staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
output.dynamicLightmapUV = input.dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
output.sh = input.sh;
|
|
#endif
|
|
output.texCoord0 = input.texCoord0.xyzw;
|
|
output.normalWS = input.normalWS.xyz;
|
|
output.viewDirectionWS = input.viewDirectionWS.xyz;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
|
|
// --------------------------------------------------
|
|
// Graph
|
|
|
|
// Graph Properties
|
|
CBUFFER_START(UnityPerMaterial)
|
|
float4 _BaseColorMap_TexelSize;
|
|
float4 _NormalMap_TexelSize;
|
|
float Normal_Blend;
|
|
float4 _BaseColor;
|
|
float4 _MaskMap_TexelSize;
|
|
float _MetallicRemapMax;
|
|
float _MetallicRemapMin;
|
|
float _AORemapMin;
|
|
float _AORemapMax;
|
|
float _SmoothnessRemapMin;
|
|
float _SmoothnessRemapMax;
|
|
float _MaskBlendSrc;
|
|
float4 _EmissiveColor;
|
|
float4 _EmissiveColorMap_TexelSize;
|
|
float _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _DrawOrder;
|
|
float _DecalMeshBiasType;
|
|
float _DecalMeshDepthBias;
|
|
float _DecalMeshViewBias;
|
|
float _DecalAngleFadeSupported;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_BaseColorMap);
|
|
SAMPLER(sampler_BaseColorMap);
|
|
TEXTURE2D(_NormalMap);
|
|
SAMPLER(sampler_NormalMap);
|
|
TEXTURE2D(_MaskMap);
|
|
SAMPLER(sampler_MaskMap);
|
|
TEXTURE2D(_EmissiveColorMap);
|
|
SAMPLER(sampler_EmissiveColorMap);
|
|
|
|
// Graph Functions
|
|
|
|
void Unity_Multiply_float4_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Branch_float(float Predicate, float True, float False, out float Out)
|
|
{
|
|
Out = Predicate ? True : False;
|
|
}
|
|
|
|
void Unity_Multiply_float_float(float A, float B, out float Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Remap_float(float In, float2 InMinMax, float2 OutMinMax, out float Out)
|
|
{
|
|
Out = OutMinMax.x + (In - InMinMax.x) * (OutMinMax.y - OutMinMax.x) / (InMinMax.y - InMinMax.x);
|
|
}
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
};
|
|
|
|
VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
|
|
{
|
|
VertexDescription description = (VertexDescription)0;
|
|
return description;
|
|
}
|
|
|
|
// Graph Pixel
|
|
struct SurfaceDescription
|
|
{
|
|
float3 BaseColor;
|
|
float Alpha;
|
|
float3 NormalTS;
|
|
float NormalAlpha;
|
|
float Metallic;
|
|
float Occlusion;
|
|
float Smoothness;
|
|
float MAOSAlpha;
|
|
float3 Emission;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
float4 _Property_320fefd883db46679cd769f61b130dd7_Out_0 = _BaseColor;
|
|
UnityTexture2D _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0 = UnityBuildTexture2DStructNoScale(_BaseColorMap);
|
|
float4 _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0 = SAMPLE_TEXTURE2D(_Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.tex, _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.samplerstate, _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_R_4 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.r;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_G_5 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.g;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_B_6 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.b;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_A_7 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.a;
|
|
float4 _Multiply_885586d42d884019a5375f12f3c61e52_Out_2;
|
|
Unity_Multiply_float4_float4(_Property_320fefd883db46679cd769f61b130dd7_Out_0, _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0, _Multiply_885586d42d884019a5375f12f3c61e52_Out_2);
|
|
float _Property_97f64a9c7748494dbf6dc5b32920f5a5_Out_0 = _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_R_1 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[0];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_G_2 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[1];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_B_3 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[2];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[3];
|
|
UnityTexture2D _Property_b46891aff98b4364a190337410150f10_Out_0 = UnityBuildTexture2DStructNoScale(_MaskMap);
|
|
float4 _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0 = SAMPLE_TEXTURE2D(_Property_b46891aff98b4364a190337410150f10_Out_0.tex, _Property_b46891aff98b4364a190337410150f10_Out_0.samplerstate, _Property_b46891aff98b4364a190337410150f10_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_R_4 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.r;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_G_5 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.g;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.b;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_A_7 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.a;
|
|
float _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3;
|
|
Unity_Branch_float(_Property_97f64a9c7748494dbf6dc5b32920f5a5_Out_0, _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3);
|
|
UnityTexture2D _Property_360e6833e8d64d75827ab98987b2b545_Out_0 = UnityBuildTexture2DStructNoScale(_NormalMap);
|
|
float4 _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0 = SAMPLE_TEXTURE2D(_Property_360e6833e8d64d75827ab98987b2b545_Out_0.tex, _Property_360e6833e8d64d75827ab98987b2b545_Out_0.samplerstate, _Property_360e6833e8d64d75827ab98987b2b545_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.rgb = UnpackNormal(_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0);
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_R_4 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.r;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_G_5 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.g;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_B_6 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.b;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_A_7 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.a;
|
|
float _Property_e94639b7a37847e1a4616aeed6a21034_Out_0 = _MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _Branch_39df5838709544d2951602a5ba721694_Out_3;
|
|
Unity_Branch_float(_Property_e94639b7a37847e1a4616aeed6a21034_Out_0, _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Branch_39df5838709544d2951602a5ba721694_Out_3);
|
|
float _Property_1ed131c6c6bd4d3b9225106c761ab06c_Out_0 = Normal_Blend;
|
|
float _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2;
|
|
Unity_Multiply_float_float(_Branch_39df5838709544d2951602a5ba721694_Out_3, _Property_1ed131c6c6bd4d3b9225106c761ab06c_Out_0, _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2);
|
|
float _Property_5830ed7c65ef489e93de994fcb2769e2_Out_0 = _MetallicRemapMin;
|
|
float _Property_3b33ae94b35943b5bbaa24c03b7069a8_Out_0 = _MetallicRemapMax;
|
|
float2 _Vector2_0ad2d19d32894d5e83e19e69d72753fd_Out_0 = float2(_Property_5830ed7c65ef489e93de994fcb2769e2_Out_0, _Property_3b33ae94b35943b5bbaa24c03b7069a8_Out_0);
|
|
float _Remap_b3145e45987e489f9b15e9672b41a608_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_R_4, float2 (0, 1), _Vector2_0ad2d19d32894d5e83e19e69d72753fd_Out_0, _Remap_b3145e45987e489f9b15e9672b41a608_Out_3);
|
|
float _Property_6427dba68c8342eebff5ce521921ddc5_Out_0 = _AORemapMin;
|
|
float _Property_f74a95489f364e41b53a083f89ad2365_Out_0 = _AORemapMax;
|
|
float2 _Vector2_a00f84e5347b414ca0e9496b9948ba0b_Out_0 = float2(_Property_6427dba68c8342eebff5ce521921ddc5_Out_0, _Property_f74a95489f364e41b53a083f89ad2365_Out_0);
|
|
float _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_G_5, float2 (0, 1), _Vector2_a00f84e5347b414ca0e9496b9948ba0b_Out_0, _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3);
|
|
float _Property_9d6993415be843799b7ec2e689c5db02_Out_0 = _SmoothnessRemapMin;
|
|
float _Property_df4aa91a4fe94e5f8768553f10cd1f82_Out_0 = _SmoothnessRemapMax;
|
|
float2 _Vector2_d67e05a1240344f3978c1c9e3cb9525f_Out_0 = float2(_Property_9d6993415be843799b7ec2e689c5db02_Out_0, _Property_df4aa91a4fe94e5f8768553f10cd1f82_Out_0);
|
|
float _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_A_7, float2 (0, 1), _Vector2_d67e05a1240344f3978c1c9e3cb9525f_Out_0, _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3);
|
|
float _Property_5c661f4099b14a5bac0c24977977340d_Out_0 = _MaskBlendSrc;
|
|
float _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2;
|
|
Unity_Multiply_float_float(_Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _Property_5c661f4099b14a5bac0c24977977340d_Out_0, _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2);
|
|
float _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2;
|
|
Unity_Multiply_float_float(_Property_5c661f4099b14a5bac0c24977977340d_Out_0, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2);
|
|
float _Branch_753c02949c6b4f128d654534f2d64ced_Out_3;
|
|
Unity_Branch_float(_Property_e94639b7a37847e1a4616aeed6a21034_Out_0, _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2, _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2, _Branch_753c02949c6b4f128d654534f2d64ced_Out_3);
|
|
float4 _Property_293317916e0e41cc98bbd5377294091b_Out_0 = IsGammaSpace() ? LinearToSRGB(_EmissiveColor) : _EmissiveColor;
|
|
UnityTexture2D _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0 = UnityBuildTexture2DStructNoScale(_EmissiveColorMap);
|
|
float4 _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0 = SAMPLE_TEXTURE2D(_Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.tex, _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.samplerstate, _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_R_4 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.r;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_G_5 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.g;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_B_6 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.b;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_A_7 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.a;
|
|
float4 _Multiply_2fa508cc2b6044e09e63453927d92375_Out_2;
|
|
Unity_Multiply_float4_float4(_Property_293317916e0e41cc98bbd5377294091b_Out_0, _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0, _Multiply_2fa508cc2b6044e09e63453927d92375_Out_2);
|
|
surface.BaseColor = (_Multiply_885586d42d884019a5375f12f3c61e52_Out_2.xyz);
|
|
surface.Alpha = _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3;
|
|
surface.NormalTS = (_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.xyz);
|
|
surface.NormalAlpha = _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2;
|
|
surface.Metallic = _Remap_b3145e45987e489f9b15e9672b41a608_Out_3;
|
|
surface.Occlusion = _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3;
|
|
surface.Smoothness = _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3;
|
|
surface.MAOSAlpha = _Branch_753c02949c6b4f128d654534f2d64ced_Out_3;
|
|
surface.Emission = (_Multiply_2fa508cc2b6044e09e63453927d92375_Out_2.xyz);
|
|
return surface;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Graph Inputs
|
|
|
|
|
|
// $features.graphVertex: $include("VertexAnimation.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : VertexAnimation.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
|
|
// $features.graphPixel: $include("SharedCode.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : SharedCode.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
|
{
|
|
SurfaceDescriptionInputs output;
|
|
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
|
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorCopyToSDI' */
|
|
|
|
|
|
|
|
output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
|
#else
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
#endif
|
|
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
|
|
return output;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Surface Data
|
|
|
|
uint2 ComputeFadeMaskSeed(uint2 positionSS)
|
|
{
|
|
uint2 fadeMaskSeed;
|
|
|
|
// Can't use the view direction, it is the same across the entire screen.
|
|
fadeMaskSeed = positionSS;
|
|
|
|
return fadeMaskSeed;
|
|
}
|
|
|
|
void GetSurfaceData(Varyings input, uint2 positionSS, float angleFadeFactor, out DecalSurfaceData surfaceData)
|
|
{
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
half4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld);
|
|
half fadeFactor = clamp(normalToWorld[0][3], 0.0f, 1.0f) * angleFadeFactor;
|
|
float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]);
|
|
float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]);
|
|
input.texCoord0.xy = input.texCoord0.xy * scale + offset;
|
|
half3 normalWS = TransformObjectToWorldDir(half3(0, 1, 0));
|
|
half3 tangentWS = TransformObjectToWorldDir(half3(1, 0, 0));
|
|
half3 bitangentWS = TransformObjectToWorldDir(half3(0, 0, 1));
|
|
half sign = dot(cross(normalWS, tangentWS), bitangentWS) > 0 ? 1 : -1;
|
|
input.normalWS.xyz = normalWS;
|
|
#else
|
|
#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group
|
|
LODDitheringTransition(ComputeFadeMaskSeed(positionSS), unity_LODFade.x);
|
|
#endif
|
|
|
|
half fadeFactor = half(1.0);
|
|
#endif
|
|
|
|
SurfaceDescriptionInputs surfaceDescriptionInputs = BuildSurfaceDescriptionInputs(input);
|
|
SurfaceDescription surfaceDescription = SurfaceDescriptionFunction(surfaceDescriptionInputs);
|
|
|
|
// setup defaults -- these are used if the graph doesn't output a value
|
|
ZERO_INITIALIZE(DecalSurfaceData, surfaceData);
|
|
surfaceData.occlusion = half(1.0);
|
|
surfaceData.smoothness = half(0);
|
|
|
|
#ifdef _MATERIAL_AFFECTS_NORMAL
|
|
surfaceData.normalWS.w = half(1.0);
|
|
#else
|
|
surfaceData.normalWS.w = half(0.0);
|
|
#endif
|
|
|
|
surfaceData.emissive.rgb = half3(surfaceDescription.Emission.rgb * fadeFactor);
|
|
|
|
// copy across graph values, if defined
|
|
surfaceData.baseColor.xyz = half3(surfaceDescription.BaseColor);
|
|
surfaceData.baseColor.w = half(surfaceDescription.Alpha * fadeFactor);
|
|
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz));
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz);
|
|
#endif
|
|
#elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
float sgn = input.tangentWS.w; // should be either +1 or -1
|
|
float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz);
|
|
half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz);
|
|
|
|
// We need to normalize as we use mikkt tangent space and this is expected (tangent space is not normalize)
|
|
surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld));
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); // Default to vertex normal
|
|
#endif
|
|
#endif
|
|
|
|
surfaceData.normalWS.w = surfaceDescription.NormalAlpha * fadeFactor;
|
|
|
|
// In case of Smoothness / AO / Metal, all the three are always computed but color mask can change
|
|
surfaceData.metallic = half(surfaceDescription.Metallic);
|
|
surfaceData.occlusion = half(surfaceDescription.Occlusion);
|
|
surfaceData.smoothness = half(surfaceDescription.Smoothness);
|
|
surfaceData.MAOSAlpha = half(surfaceDescription.MAOSAlpha * fadeFactor);
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Main
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPassDecal.hlsl"
|
|
|
|
ENDHLSL
|
|
}
|
|
Pass
|
|
{
|
|
Name "DBufferMesh"
|
|
Tags
|
|
{
|
|
"LightMode" = "DBufferMesh"
|
|
}
|
|
|
|
// Render State
|
|
Blend 0 SrcAlpha OneMinusSrcAlpha, Zero OneMinusSrcAlpha
|
|
Blend 1 SrcAlpha OneMinusSrcAlpha, Zero OneMinusSrcAlpha
|
|
Blend 2 SrcAlpha OneMinusSrcAlpha, Zero OneMinusSrcAlpha
|
|
ZTest LEqual
|
|
ZWrite Off
|
|
ColorMask RGBA
|
|
ColorMask RGBA 1
|
|
ColorMask RGBA 2
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 3.5
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
#pragma multi_compile_instancing
|
|
#pragma editor_sync_compilation
|
|
|
|
// Keywords
|
|
#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
|
|
// GraphKeywords: <None>
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
|
|
// Defines
|
|
#define ATTRIBUTES_NEED_NORMAL
|
|
#define ATTRIBUTES_NEED_TANGENT
|
|
#define ATTRIBUTES_NEED_TEXCOORD0
|
|
#define ATTRIBUTES_NEED_TEXCOORD1
|
|
#define ATTRIBUTES_NEED_TEXCOORD2
|
|
#define VARYINGS_NEED_POSITION_WS
|
|
#define VARYINGS_NEED_NORMAL_WS
|
|
#define VARYINGS_NEED_TANGENT_WS
|
|
#define VARYINGS_NEED_TEXCOORD0
|
|
|
|
#define HAVE_MESH_MODIFICATION
|
|
|
|
|
|
#define SHADERPASS SHADERPASS_DBUFFER_MESH
|
|
#define _MATERIAL_AFFECTS_ALBEDO 1
|
|
#define _MATERIAL_AFFECTS_NORMAL 1
|
|
#define _MATERIAL_AFFECTS_NORMAL_BLEND 1
|
|
#define _MATERIAL_AFFECTS_MAOS 1
|
|
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// -- Properties used by ScenePickingPass
|
|
#ifdef SCENEPICKINGPASS
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
// Includes
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Structs and Packing
|
|
|
|
struct Attributes
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
float4 uv0 : TEXCOORD0;
|
|
float4 uv1 : TEXCOORD1;
|
|
float4 uv2 : TEXCOORD2;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : INSTANCEID_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct Varyings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float3 positionWS;
|
|
float3 normalWS;
|
|
float4 tangentWS;
|
|
float4 texCoord0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct SurfaceDescriptionInputs
|
|
{
|
|
float3 TangentSpaceNormal;
|
|
float4 uv0;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
};
|
|
struct PackedVaryings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 tangentWS : INTERP0;
|
|
float4 texCoord0 : INTERP1;
|
|
float3 positionWS : INTERP2;
|
|
float3 normalWS : INTERP3;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
PackedVaryings PackVaryings (Varyings input)
|
|
{
|
|
PackedVaryings output;
|
|
ZERO_INITIALIZE(PackedVaryings, output);
|
|
output.positionCS = input.positionCS;
|
|
output.tangentWS.xyzw = input.tangentWS;
|
|
output.texCoord0.xyzw = input.texCoord0;
|
|
output.positionWS.xyz = input.positionWS;
|
|
output.normalWS.xyz = input.normalWS;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
Varyings UnpackVaryings (PackedVaryings input)
|
|
{
|
|
Varyings output;
|
|
output.positionCS = input.positionCS;
|
|
output.tangentWS = input.tangentWS.xyzw;
|
|
output.texCoord0 = input.texCoord0.xyzw;
|
|
output.positionWS = input.positionWS.xyz;
|
|
output.normalWS = input.normalWS.xyz;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
|
|
// --------------------------------------------------
|
|
// Graph
|
|
|
|
// Graph Properties
|
|
CBUFFER_START(UnityPerMaterial)
|
|
float4 _BaseColorMap_TexelSize;
|
|
float4 _NormalMap_TexelSize;
|
|
float Normal_Blend;
|
|
float4 _BaseColor;
|
|
float4 _MaskMap_TexelSize;
|
|
float _MetallicRemapMax;
|
|
float _MetallicRemapMin;
|
|
float _AORemapMin;
|
|
float _AORemapMax;
|
|
float _SmoothnessRemapMin;
|
|
float _SmoothnessRemapMax;
|
|
float _MaskBlendSrc;
|
|
float4 _EmissiveColor;
|
|
float4 _EmissiveColorMap_TexelSize;
|
|
float _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _DrawOrder;
|
|
float _DecalMeshBiasType;
|
|
float _DecalMeshDepthBias;
|
|
float _DecalMeshViewBias;
|
|
float _DecalAngleFadeSupported;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_BaseColorMap);
|
|
SAMPLER(sampler_BaseColorMap);
|
|
TEXTURE2D(_NormalMap);
|
|
SAMPLER(sampler_NormalMap);
|
|
TEXTURE2D(_MaskMap);
|
|
SAMPLER(sampler_MaskMap);
|
|
TEXTURE2D(_EmissiveColorMap);
|
|
SAMPLER(sampler_EmissiveColorMap);
|
|
|
|
// Graph Functions
|
|
|
|
void Unity_Multiply_float4_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Branch_float(float Predicate, float True, float False, out float Out)
|
|
{
|
|
Out = Predicate ? True : False;
|
|
}
|
|
|
|
void Unity_Multiply_float_float(float A, float B, out float Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Remap_float(float In, float2 InMinMax, float2 OutMinMax, out float Out)
|
|
{
|
|
Out = OutMinMax.x + (In - InMinMax.x) * (OutMinMax.y - OutMinMax.x) / (InMinMax.y - InMinMax.x);
|
|
}
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
};
|
|
|
|
VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
|
|
{
|
|
VertexDescription description = (VertexDescription)0;
|
|
return description;
|
|
}
|
|
|
|
// Graph Pixel
|
|
struct SurfaceDescription
|
|
{
|
|
float3 BaseColor;
|
|
float Alpha;
|
|
float3 NormalTS;
|
|
float NormalAlpha;
|
|
float Metallic;
|
|
float Occlusion;
|
|
float Smoothness;
|
|
float MAOSAlpha;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
float4 _Property_320fefd883db46679cd769f61b130dd7_Out_0 = _BaseColor;
|
|
UnityTexture2D _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0 = UnityBuildTexture2DStructNoScale(_BaseColorMap);
|
|
float4 _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0 = SAMPLE_TEXTURE2D(_Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.tex, _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.samplerstate, _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_R_4 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.r;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_G_5 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.g;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_B_6 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.b;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_A_7 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.a;
|
|
float4 _Multiply_885586d42d884019a5375f12f3c61e52_Out_2;
|
|
Unity_Multiply_float4_float4(_Property_320fefd883db46679cd769f61b130dd7_Out_0, _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0, _Multiply_885586d42d884019a5375f12f3c61e52_Out_2);
|
|
float _Property_97f64a9c7748494dbf6dc5b32920f5a5_Out_0 = _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_R_1 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[0];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_G_2 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[1];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_B_3 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[2];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[3];
|
|
UnityTexture2D _Property_b46891aff98b4364a190337410150f10_Out_0 = UnityBuildTexture2DStructNoScale(_MaskMap);
|
|
float4 _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0 = SAMPLE_TEXTURE2D(_Property_b46891aff98b4364a190337410150f10_Out_0.tex, _Property_b46891aff98b4364a190337410150f10_Out_0.samplerstate, _Property_b46891aff98b4364a190337410150f10_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_R_4 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.r;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_G_5 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.g;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.b;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_A_7 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.a;
|
|
float _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3;
|
|
Unity_Branch_float(_Property_97f64a9c7748494dbf6dc5b32920f5a5_Out_0, _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3);
|
|
UnityTexture2D _Property_360e6833e8d64d75827ab98987b2b545_Out_0 = UnityBuildTexture2DStructNoScale(_NormalMap);
|
|
float4 _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0 = SAMPLE_TEXTURE2D(_Property_360e6833e8d64d75827ab98987b2b545_Out_0.tex, _Property_360e6833e8d64d75827ab98987b2b545_Out_0.samplerstate, _Property_360e6833e8d64d75827ab98987b2b545_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.rgb = UnpackNormal(_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0);
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_R_4 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.r;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_G_5 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.g;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_B_6 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.b;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_A_7 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.a;
|
|
float _Property_e94639b7a37847e1a4616aeed6a21034_Out_0 = _MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _Branch_39df5838709544d2951602a5ba721694_Out_3;
|
|
Unity_Branch_float(_Property_e94639b7a37847e1a4616aeed6a21034_Out_0, _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Branch_39df5838709544d2951602a5ba721694_Out_3);
|
|
float _Property_1ed131c6c6bd4d3b9225106c761ab06c_Out_0 = Normal_Blend;
|
|
float _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2;
|
|
Unity_Multiply_float_float(_Branch_39df5838709544d2951602a5ba721694_Out_3, _Property_1ed131c6c6bd4d3b9225106c761ab06c_Out_0, _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2);
|
|
float _Property_5830ed7c65ef489e93de994fcb2769e2_Out_0 = _MetallicRemapMin;
|
|
float _Property_3b33ae94b35943b5bbaa24c03b7069a8_Out_0 = _MetallicRemapMax;
|
|
float2 _Vector2_0ad2d19d32894d5e83e19e69d72753fd_Out_0 = float2(_Property_5830ed7c65ef489e93de994fcb2769e2_Out_0, _Property_3b33ae94b35943b5bbaa24c03b7069a8_Out_0);
|
|
float _Remap_b3145e45987e489f9b15e9672b41a608_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_R_4, float2 (0, 1), _Vector2_0ad2d19d32894d5e83e19e69d72753fd_Out_0, _Remap_b3145e45987e489f9b15e9672b41a608_Out_3);
|
|
float _Property_6427dba68c8342eebff5ce521921ddc5_Out_0 = _AORemapMin;
|
|
float _Property_f74a95489f364e41b53a083f89ad2365_Out_0 = _AORemapMax;
|
|
float2 _Vector2_a00f84e5347b414ca0e9496b9948ba0b_Out_0 = float2(_Property_6427dba68c8342eebff5ce521921ddc5_Out_0, _Property_f74a95489f364e41b53a083f89ad2365_Out_0);
|
|
float _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_G_5, float2 (0, 1), _Vector2_a00f84e5347b414ca0e9496b9948ba0b_Out_0, _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3);
|
|
float _Property_9d6993415be843799b7ec2e689c5db02_Out_0 = _SmoothnessRemapMin;
|
|
float _Property_df4aa91a4fe94e5f8768553f10cd1f82_Out_0 = _SmoothnessRemapMax;
|
|
float2 _Vector2_d67e05a1240344f3978c1c9e3cb9525f_Out_0 = float2(_Property_9d6993415be843799b7ec2e689c5db02_Out_0, _Property_df4aa91a4fe94e5f8768553f10cd1f82_Out_0);
|
|
float _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_A_7, float2 (0, 1), _Vector2_d67e05a1240344f3978c1c9e3cb9525f_Out_0, _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3);
|
|
float _Property_5c661f4099b14a5bac0c24977977340d_Out_0 = _MaskBlendSrc;
|
|
float _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2;
|
|
Unity_Multiply_float_float(_Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _Property_5c661f4099b14a5bac0c24977977340d_Out_0, _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2);
|
|
float _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2;
|
|
Unity_Multiply_float_float(_Property_5c661f4099b14a5bac0c24977977340d_Out_0, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2);
|
|
float _Branch_753c02949c6b4f128d654534f2d64ced_Out_3;
|
|
Unity_Branch_float(_Property_e94639b7a37847e1a4616aeed6a21034_Out_0, _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2, _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2, _Branch_753c02949c6b4f128d654534f2d64ced_Out_3);
|
|
surface.BaseColor = (_Multiply_885586d42d884019a5375f12f3c61e52_Out_2.xyz);
|
|
surface.Alpha = _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3;
|
|
surface.NormalTS = (_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.xyz);
|
|
surface.NormalAlpha = _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2;
|
|
surface.Metallic = _Remap_b3145e45987e489f9b15e9672b41a608_Out_3;
|
|
surface.Occlusion = _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3;
|
|
surface.Smoothness = _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3;
|
|
surface.MAOSAlpha = _Branch_753c02949c6b4f128d654534f2d64ced_Out_3;
|
|
return surface;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Graph Inputs
|
|
|
|
|
|
// $features.graphVertex: $include("VertexAnimation.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : VertexAnimation.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
|
|
// $features.graphPixel: $include("SharedCode.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : SharedCode.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
|
{
|
|
SurfaceDescriptionInputs output;
|
|
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
|
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorCopyToSDI' */
|
|
|
|
|
|
|
|
output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
|
#else
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
#endif
|
|
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
|
|
return output;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Surface Data
|
|
|
|
uint2 ComputeFadeMaskSeed(uint2 positionSS)
|
|
{
|
|
uint2 fadeMaskSeed;
|
|
|
|
// Can't use the view direction, it is the same across the entire screen.
|
|
fadeMaskSeed = positionSS;
|
|
|
|
return fadeMaskSeed;
|
|
}
|
|
|
|
void GetSurfaceData(Varyings input, uint2 positionSS, float angleFadeFactor, out DecalSurfaceData surfaceData)
|
|
{
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
half4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld);
|
|
half fadeFactor = clamp(normalToWorld[0][3], 0.0f, 1.0f) * angleFadeFactor;
|
|
float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]);
|
|
float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]);
|
|
input.texCoord0.xy = input.texCoord0.xy * scale + offset;
|
|
half3 normalWS = TransformObjectToWorldDir(half3(0, 1, 0));
|
|
half3 tangentWS = TransformObjectToWorldDir(half3(1, 0, 0));
|
|
half3 bitangentWS = TransformObjectToWorldDir(half3(0, 0, 1));
|
|
half sign = dot(cross(normalWS, tangentWS), bitangentWS) > 0 ? 1 : -1;
|
|
input.normalWS.xyz = normalWS;
|
|
input.tangentWS.xyzw = half4(tangentWS, sign);
|
|
#else
|
|
#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group
|
|
LODDitheringTransition(ComputeFadeMaskSeed(positionSS), unity_LODFade.x);
|
|
#endif
|
|
|
|
half fadeFactor = half(1.0);
|
|
#endif
|
|
|
|
SurfaceDescriptionInputs surfaceDescriptionInputs = BuildSurfaceDescriptionInputs(input);
|
|
SurfaceDescription surfaceDescription = SurfaceDescriptionFunction(surfaceDescriptionInputs);
|
|
|
|
// setup defaults -- these are used if the graph doesn't output a value
|
|
ZERO_INITIALIZE(DecalSurfaceData, surfaceData);
|
|
surfaceData.occlusion = half(1.0);
|
|
surfaceData.smoothness = half(0);
|
|
|
|
#ifdef _MATERIAL_AFFECTS_NORMAL
|
|
surfaceData.normalWS.w = half(1.0);
|
|
#else
|
|
surfaceData.normalWS.w = half(0.0);
|
|
#endif
|
|
|
|
|
|
// copy across graph values, if defined
|
|
surfaceData.baseColor.xyz = half3(surfaceDescription.BaseColor);
|
|
surfaceData.baseColor.w = half(surfaceDescription.Alpha * fadeFactor);
|
|
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz));
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz);
|
|
#endif
|
|
#elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
float sgn = input.tangentWS.w; // should be either +1 or -1
|
|
float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz);
|
|
half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz);
|
|
|
|
// We need to normalize as we use mikkt tangent space and this is expected (tangent space is not normalize)
|
|
surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld));
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); // Default to vertex normal
|
|
#endif
|
|
#endif
|
|
|
|
surfaceData.normalWS.w = surfaceDescription.NormalAlpha * fadeFactor;
|
|
|
|
// In case of Smoothness / AO / Metal, all the three are always computed but color mask can change
|
|
surfaceData.metallic = half(surfaceDescription.Metallic);
|
|
surfaceData.occlusion = half(surfaceDescription.Occlusion);
|
|
surfaceData.smoothness = half(surfaceDescription.Smoothness);
|
|
surfaceData.MAOSAlpha = half(surfaceDescription.MAOSAlpha * fadeFactor);
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Main
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPassDecal.hlsl"
|
|
|
|
ENDHLSL
|
|
}
|
|
Pass
|
|
{
|
|
Name "DecalMeshForwardEmissive"
|
|
Tags
|
|
{
|
|
"LightMode" = "DecalMeshForwardEmissive"
|
|
}
|
|
|
|
// Render State
|
|
Blend 0 SrcAlpha One
|
|
ZTest LEqual
|
|
ZWrite Off
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 3.5
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
#pragma multi_compile_instancing
|
|
#pragma editor_sync_compilation
|
|
|
|
// Keywords
|
|
// PassKeywords: <None>
|
|
// GraphKeywords: <None>
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
|
|
// Defines
|
|
#define ATTRIBUTES_NEED_NORMAL
|
|
#define ATTRIBUTES_NEED_TANGENT
|
|
#define ATTRIBUTES_NEED_TEXCOORD0
|
|
#define ATTRIBUTES_NEED_TEXCOORD1
|
|
#define ATTRIBUTES_NEED_TEXCOORD2
|
|
#define VARYINGS_NEED_POSITION_WS
|
|
#define VARYINGS_NEED_NORMAL_WS
|
|
#define VARYINGS_NEED_TANGENT_WS
|
|
#define VARYINGS_NEED_TEXCOORD0
|
|
|
|
#define HAVE_MESH_MODIFICATION
|
|
|
|
|
|
#define SHADERPASS SHADERPASS_FORWARD_EMISSIVE_MESH
|
|
#define _MATERIAL_AFFECTS_ALBEDO 1
|
|
#define _MATERIAL_AFFECTS_NORMAL 1
|
|
#define _MATERIAL_AFFECTS_NORMAL_BLEND 1
|
|
#define _MATERIAL_AFFECTS_MAOS 1
|
|
#define _MATERIAL_AFFECTS_EMISSION 1
|
|
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// -- Properties used by ScenePickingPass
|
|
#ifdef SCENEPICKINGPASS
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
// Includes
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Structs and Packing
|
|
|
|
struct Attributes
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
float4 uv0 : TEXCOORD0;
|
|
float4 uv1 : TEXCOORD1;
|
|
float4 uv2 : TEXCOORD2;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : INSTANCEID_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct Varyings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float3 positionWS;
|
|
float3 normalWS;
|
|
float4 tangentWS;
|
|
float4 texCoord0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct SurfaceDescriptionInputs
|
|
{
|
|
float3 TangentSpaceNormal;
|
|
float4 uv0;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
};
|
|
struct PackedVaryings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 tangentWS : INTERP0;
|
|
float4 texCoord0 : INTERP1;
|
|
float3 positionWS : INTERP2;
|
|
float3 normalWS : INTERP3;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
PackedVaryings PackVaryings (Varyings input)
|
|
{
|
|
PackedVaryings output;
|
|
ZERO_INITIALIZE(PackedVaryings, output);
|
|
output.positionCS = input.positionCS;
|
|
output.tangentWS.xyzw = input.tangentWS;
|
|
output.texCoord0.xyzw = input.texCoord0;
|
|
output.positionWS.xyz = input.positionWS;
|
|
output.normalWS.xyz = input.normalWS;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
Varyings UnpackVaryings (PackedVaryings input)
|
|
{
|
|
Varyings output;
|
|
output.positionCS = input.positionCS;
|
|
output.tangentWS = input.tangentWS.xyzw;
|
|
output.texCoord0 = input.texCoord0.xyzw;
|
|
output.positionWS = input.positionWS.xyz;
|
|
output.normalWS = input.normalWS.xyz;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
|
|
// --------------------------------------------------
|
|
// Graph
|
|
|
|
// Graph Properties
|
|
CBUFFER_START(UnityPerMaterial)
|
|
float4 _BaseColorMap_TexelSize;
|
|
float4 _NormalMap_TexelSize;
|
|
float Normal_Blend;
|
|
float4 _BaseColor;
|
|
float4 _MaskMap_TexelSize;
|
|
float _MetallicRemapMax;
|
|
float _MetallicRemapMin;
|
|
float _AORemapMin;
|
|
float _AORemapMax;
|
|
float _SmoothnessRemapMin;
|
|
float _SmoothnessRemapMax;
|
|
float _MaskBlendSrc;
|
|
float4 _EmissiveColor;
|
|
float4 _EmissiveColorMap_TexelSize;
|
|
float _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _DrawOrder;
|
|
float _DecalMeshBiasType;
|
|
float _DecalMeshDepthBias;
|
|
float _DecalMeshViewBias;
|
|
float _DecalAngleFadeSupported;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_BaseColorMap);
|
|
SAMPLER(sampler_BaseColorMap);
|
|
TEXTURE2D(_NormalMap);
|
|
SAMPLER(sampler_NormalMap);
|
|
TEXTURE2D(_MaskMap);
|
|
SAMPLER(sampler_MaskMap);
|
|
TEXTURE2D(_EmissiveColorMap);
|
|
SAMPLER(sampler_EmissiveColorMap);
|
|
|
|
// Graph Functions
|
|
|
|
void Unity_Multiply_float4_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Branch_float(float Predicate, float True, float False, out float Out)
|
|
{
|
|
Out = Predicate ? True : False;
|
|
}
|
|
|
|
void Unity_Multiply_float_float(float A, float B, out float Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Remap_float(float In, float2 InMinMax, float2 OutMinMax, out float Out)
|
|
{
|
|
Out = OutMinMax.x + (In - InMinMax.x) * (OutMinMax.y - OutMinMax.x) / (InMinMax.y - InMinMax.x);
|
|
}
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
};
|
|
|
|
VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
|
|
{
|
|
VertexDescription description = (VertexDescription)0;
|
|
return description;
|
|
}
|
|
|
|
// Graph Pixel
|
|
struct SurfaceDescription
|
|
{
|
|
float3 BaseColor;
|
|
float Alpha;
|
|
float3 NormalTS;
|
|
float NormalAlpha;
|
|
float Metallic;
|
|
float Occlusion;
|
|
float Smoothness;
|
|
float MAOSAlpha;
|
|
float3 Emission;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
float4 _Property_320fefd883db46679cd769f61b130dd7_Out_0 = _BaseColor;
|
|
UnityTexture2D _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0 = UnityBuildTexture2DStructNoScale(_BaseColorMap);
|
|
float4 _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0 = SAMPLE_TEXTURE2D(_Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.tex, _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.samplerstate, _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_R_4 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.r;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_G_5 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.g;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_B_6 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.b;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_A_7 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.a;
|
|
float4 _Multiply_885586d42d884019a5375f12f3c61e52_Out_2;
|
|
Unity_Multiply_float4_float4(_Property_320fefd883db46679cd769f61b130dd7_Out_0, _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0, _Multiply_885586d42d884019a5375f12f3c61e52_Out_2);
|
|
float _Property_97f64a9c7748494dbf6dc5b32920f5a5_Out_0 = _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_R_1 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[0];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_G_2 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[1];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_B_3 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[2];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[3];
|
|
UnityTexture2D _Property_b46891aff98b4364a190337410150f10_Out_0 = UnityBuildTexture2DStructNoScale(_MaskMap);
|
|
float4 _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0 = SAMPLE_TEXTURE2D(_Property_b46891aff98b4364a190337410150f10_Out_0.tex, _Property_b46891aff98b4364a190337410150f10_Out_0.samplerstate, _Property_b46891aff98b4364a190337410150f10_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_R_4 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.r;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_G_5 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.g;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.b;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_A_7 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.a;
|
|
float _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3;
|
|
Unity_Branch_float(_Property_97f64a9c7748494dbf6dc5b32920f5a5_Out_0, _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3);
|
|
UnityTexture2D _Property_360e6833e8d64d75827ab98987b2b545_Out_0 = UnityBuildTexture2DStructNoScale(_NormalMap);
|
|
float4 _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0 = SAMPLE_TEXTURE2D(_Property_360e6833e8d64d75827ab98987b2b545_Out_0.tex, _Property_360e6833e8d64d75827ab98987b2b545_Out_0.samplerstate, _Property_360e6833e8d64d75827ab98987b2b545_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.rgb = UnpackNormal(_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0);
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_R_4 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.r;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_G_5 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.g;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_B_6 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.b;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_A_7 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.a;
|
|
float _Property_e94639b7a37847e1a4616aeed6a21034_Out_0 = _MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _Branch_39df5838709544d2951602a5ba721694_Out_3;
|
|
Unity_Branch_float(_Property_e94639b7a37847e1a4616aeed6a21034_Out_0, _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Branch_39df5838709544d2951602a5ba721694_Out_3);
|
|
float _Property_1ed131c6c6bd4d3b9225106c761ab06c_Out_0 = Normal_Blend;
|
|
float _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2;
|
|
Unity_Multiply_float_float(_Branch_39df5838709544d2951602a5ba721694_Out_3, _Property_1ed131c6c6bd4d3b9225106c761ab06c_Out_0, _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2);
|
|
float _Property_5830ed7c65ef489e93de994fcb2769e2_Out_0 = _MetallicRemapMin;
|
|
float _Property_3b33ae94b35943b5bbaa24c03b7069a8_Out_0 = _MetallicRemapMax;
|
|
float2 _Vector2_0ad2d19d32894d5e83e19e69d72753fd_Out_0 = float2(_Property_5830ed7c65ef489e93de994fcb2769e2_Out_0, _Property_3b33ae94b35943b5bbaa24c03b7069a8_Out_0);
|
|
float _Remap_b3145e45987e489f9b15e9672b41a608_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_R_4, float2 (0, 1), _Vector2_0ad2d19d32894d5e83e19e69d72753fd_Out_0, _Remap_b3145e45987e489f9b15e9672b41a608_Out_3);
|
|
float _Property_6427dba68c8342eebff5ce521921ddc5_Out_0 = _AORemapMin;
|
|
float _Property_f74a95489f364e41b53a083f89ad2365_Out_0 = _AORemapMax;
|
|
float2 _Vector2_a00f84e5347b414ca0e9496b9948ba0b_Out_0 = float2(_Property_6427dba68c8342eebff5ce521921ddc5_Out_0, _Property_f74a95489f364e41b53a083f89ad2365_Out_0);
|
|
float _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_G_5, float2 (0, 1), _Vector2_a00f84e5347b414ca0e9496b9948ba0b_Out_0, _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3);
|
|
float _Property_9d6993415be843799b7ec2e689c5db02_Out_0 = _SmoothnessRemapMin;
|
|
float _Property_df4aa91a4fe94e5f8768553f10cd1f82_Out_0 = _SmoothnessRemapMax;
|
|
float2 _Vector2_d67e05a1240344f3978c1c9e3cb9525f_Out_0 = float2(_Property_9d6993415be843799b7ec2e689c5db02_Out_0, _Property_df4aa91a4fe94e5f8768553f10cd1f82_Out_0);
|
|
float _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_A_7, float2 (0, 1), _Vector2_d67e05a1240344f3978c1c9e3cb9525f_Out_0, _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3);
|
|
float _Property_5c661f4099b14a5bac0c24977977340d_Out_0 = _MaskBlendSrc;
|
|
float _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2;
|
|
Unity_Multiply_float_float(_Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _Property_5c661f4099b14a5bac0c24977977340d_Out_0, _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2);
|
|
float _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2;
|
|
Unity_Multiply_float_float(_Property_5c661f4099b14a5bac0c24977977340d_Out_0, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2);
|
|
float _Branch_753c02949c6b4f128d654534f2d64ced_Out_3;
|
|
Unity_Branch_float(_Property_e94639b7a37847e1a4616aeed6a21034_Out_0, _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2, _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2, _Branch_753c02949c6b4f128d654534f2d64ced_Out_3);
|
|
float4 _Property_293317916e0e41cc98bbd5377294091b_Out_0 = IsGammaSpace() ? LinearToSRGB(_EmissiveColor) : _EmissiveColor;
|
|
UnityTexture2D _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0 = UnityBuildTexture2DStructNoScale(_EmissiveColorMap);
|
|
float4 _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0 = SAMPLE_TEXTURE2D(_Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.tex, _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.samplerstate, _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_R_4 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.r;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_G_5 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.g;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_B_6 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.b;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_A_7 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.a;
|
|
float4 _Multiply_2fa508cc2b6044e09e63453927d92375_Out_2;
|
|
Unity_Multiply_float4_float4(_Property_293317916e0e41cc98bbd5377294091b_Out_0, _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0, _Multiply_2fa508cc2b6044e09e63453927d92375_Out_2);
|
|
surface.BaseColor = (_Multiply_885586d42d884019a5375f12f3c61e52_Out_2.xyz);
|
|
surface.Alpha = _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3;
|
|
surface.NormalTS = (_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.xyz);
|
|
surface.NormalAlpha = _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2;
|
|
surface.Metallic = _Remap_b3145e45987e489f9b15e9672b41a608_Out_3;
|
|
surface.Occlusion = _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3;
|
|
surface.Smoothness = _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3;
|
|
surface.MAOSAlpha = _Branch_753c02949c6b4f128d654534f2d64ced_Out_3;
|
|
surface.Emission = (_Multiply_2fa508cc2b6044e09e63453927d92375_Out_2.xyz);
|
|
return surface;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Graph Inputs
|
|
|
|
|
|
// $features.graphVertex: $include("VertexAnimation.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : VertexAnimation.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
|
|
// $features.graphPixel: $include("SharedCode.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : SharedCode.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
|
{
|
|
SurfaceDescriptionInputs output;
|
|
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
|
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorCopyToSDI' */
|
|
|
|
|
|
|
|
output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
|
#else
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
#endif
|
|
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
|
|
return output;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Surface Data
|
|
|
|
uint2 ComputeFadeMaskSeed(uint2 positionSS)
|
|
{
|
|
uint2 fadeMaskSeed;
|
|
|
|
// Can't use the view direction, it is the same across the entire screen.
|
|
fadeMaskSeed = positionSS;
|
|
|
|
return fadeMaskSeed;
|
|
}
|
|
|
|
void GetSurfaceData(Varyings input, uint2 positionSS, float angleFadeFactor, out DecalSurfaceData surfaceData)
|
|
{
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
half4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld);
|
|
half fadeFactor = clamp(normalToWorld[0][3], 0.0f, 1.0f) * angleFadeFactor;
|
|
float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]);
|
|
float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]);
|
|
input.texCoord0.xy = input.texCoord0.xy * scale + offset;
|
|
half3 normalWS = TransformObjectToWorldDir(half3(0, 1, 0));
|
|
half3 tangentWS = TransformObjectToWorldDir(half3(1, 0, 0));
|
|
half3 bitangentWS = TransformObjectToWorldDir(half3(0, 0, 1));
|
|
half sign = dot(cross(normalWS, tangentWS), bitangentWS) > 0 ? 1 : -1;
|
|
input.normalWS.xyz = normalWS;
|
|
input.tangentWS.xyzw = half4(tangentWS, sign);
|
|
#else
|
|
#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group
|
|
LODDitheringTransition(ComputeFadeMaskSeed(positionSS), unity_LODFade.x);
|
|
#endif
|
|
|
|
half fadeFactor = half(1.0);
|
|
#endif
|
|
|
|
SurfaceDescriptionInputs surfaceDescriptionInputs = BuildSurfaceDescriptionInputs(input);
|
|
SurfaceDescription surfaceDescription = SurfaceDescriptionFunction(surfaceDescriptionInputs);
|
|
|
|
// setup defaults -- these are used if the graph doesn't output a value
|
|
ZERO_INITIALIZE(DecalSurfaceData, surfaceData);
|
|
surfaceData.occlusion = half(1.0);
|
|
surfaceData.smoothness = half(0);
|
|
|
|
#ifdef _MATERIAL_AFFECTS_NORMAL
|
|
surfaceData.normalWS.w = half(1.0);
|
|
#else
|
|
surfaceData.normalWS.w = half(0.0);
|
|
#endif
|
|
|
|
surfaceData.emissive.rgb = half3(surfaceDescription.Emission.rgb * fadeFactor);
|
|
|
|
// copy across graph values, if defined
|
|
surfaceData.baseColor.xyz = half3(surfaceDescription.BaseColor);
|
|
surfaceData.baseColor.w = half(surfaceDescription.Alpha * fadeFactor);
|
|
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz));
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz);
|
|
#endif
|
|
#elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
float sgn = input.tangentWS.w; // should be either +1 or -1
|
|
float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz);
|
|
half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz);
|
|
|
|
// We need to normalize as we use mikkt tangent space and this is expected (tangent space is not normalize)
|
|
surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld));
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); // Default to vertex normal
|
|
#endif
|
|
#endif
|
|
|
|
surfaceData.normalWS.w = surfaceDescription.NormalAlpha * fadeFactor;
|
|
|
|
// In case of Smoothness / AO / Metal, all the three are always computed but color mask can change
|
|
surfaceData.metallic = half(surfaceDescription.Metallic);
|
|
surfaceData.occlusion = half(surfaceDescription.Occlusion);
|
|
surfaceData.smoothness = half(surfaceDescription.Smoothness);
|
|
surfaceData.MAOSAlpha = half(surfaceDescription.MAOSAlpha * fadeFactor);
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Main
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPassDecal.hlsl"
|
|
|
|
ENDHLSL
|
|
}
|
|
Pass
|
|
{
|
|
Name "DecalScreenSpaceMesh"
|
|
Tags
|
|
{
|
|
"LightMode" = "DecalScreenSpaceMesh"
|
|
}
|
|
|
|
// Render State
|
|
Blend SrcAlpha OneMinusSrcAlpha
|
|
ZTest LEqual
|
|
ZWrite Off
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 2.5
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
#pragma multi_compile_instancing
|
|
#pragma multi_compile_fog
|
|
#pragma editor_sync_compilation
|
|
|
|
// Keywords
|
|
#pragma multi_compile _ LIGHTMAP_ON
|
|
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
|
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
|
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
|
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
|
|
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
|
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
|
|
#pragma multi_compile _ SHADOWS_SHADOWMASK
|
|
#pragma multi_compile _ _CLUSTERED_RENDERING
|
|
#pragma multi_compile _DECAL_NORMAL_BLEND_LOW _DECAL_NORMAL_BLEND_MEDIUM _DECAL_NORMAL_BLEND_HIGH
|
|
// GraphKeywords: <None>
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
|
|
// Defines
|
|
#define ATTRIBUTES_NEED_NORMAL
|
|
#define ATTRIBUTES_NEED_TANGENT
|
|
#define ATTRIBUTES_NEED_TEXCOORD0
|
|
#define ATTRIBUTES_NEED_TEXCOORD1
|
|
#define ATTRIBUTES_NEED_TEXCOORD2
|
|
#define VARYINGS_NEED_POSITION_WS
|
|
#define VARYINGS_NEED_NORMAL_WS
|
|
#define VARYINGS_NEED_VIEWDIRECTION_WS
|
|
#define VARYINGS_NEED_TANGENT_WS
|
|
#define VARYINGS_NEED_TEXCOORD0
|
|
#define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
|
|
#define VARYINGS_NEED_SH
|
|
#define VARYINGS_NEED_STATIC_LIGHTMAP_UV
|
|
#define VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV
|
|
|
|
#define HAVE_MESH_MODIFICATION
|
|
|
|
|
|
#define SHADERPASS SHADERPASS_DECAL_SCREEN_SPACE_MESH
|
|
#define _MATERIAL_AFFECTS_ALBEDO 1
|
|
#define _MATERIAL_AFFECTS_NORMAL 1
|
|
#define _MATERIAL_AFFECTS_NORMAL_BLEND 1
|
|
#define _MATERIAL_AFFECTS_MAOS 1
|
|
#define _MATERIAL_AFFECTS_EMISSION 1
|
|
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// -- Properties used by ScenePickingPass
|
|
#ifdef SCENEPICKINGPASS
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
// Includes
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Structs and Packing
|
|
|
|
struct Attributes
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
float4 uv0 : TEXCOORD0;
|
|
float4 uv1 : TEXCOORD1;
|
|
float4 uv2 : TEXCOORD2;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : INSTANCEID_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct Varyings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float3 positionWS;
|
|
float3 normalWS;
|
|
float4 tangentWS;
|
|
float4 texCoord0;
|
|
float3 viewDirectionWS;
|
|
#if defined(LIGHTMAP_ON)
|
|
float2 staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
float2 dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
float3 sh;
|
|
#endif
|
|
float4 fogFactorAndVertexLight;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct SurfaceDescriptionInputs
|
|
{
|
|
float3 TangentSpaceNormal;
|
|
float4 uv0;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
};
|
|
struct PackedVaryings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
#if defined(LIGHTMAP_ON)
|
|
float2 staticLightmapUV : INTERP0;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
float2 dynamicLightmapUV : INTERP1;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
float3 sh : INTERP2;
|
|
#endif
|
|
float4 tangentWS : INTERP3;
|
|
float4 texCoord0 : INTERP4;
|
|
float4 fogFactorAndVertexLight : INTERP5;
|
|
float3 positionWS : INTERP6;
|
|
float3 normalWS : INTERP7;
|
|
float3 viewDirectionWS : INTERP8;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
PackedVaryings PackVaryings (Varyings input)
|
|
{
|
|
PackedVaryings output;
|
|
ZERO_INITIALIZE(PackedVaryings, output);
|
|
output.positionCS = input.positionCS;
|
|
#if defined(LIGHTMAP_ON)
|
|
output.staticLightmapUV = input.staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
output.dynamicLightmapUV = input.dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
output.sh = input.sh;
|
|
#endif
|
|
output.tangentWS.xyzw = input.tangentWS;
|
|
output.texCoord0.xyzw = input.texCoord0;
|
|
output.fogFactorAndVertexLight.xyzw = input.fogFactorAndVertexLight;
|
|
output.positionWS.xyz = input.positionWS;
|
|
output.normalWS.xyz = input.normalWS;
|
|
output.viewDirectionWS.xyz = input.viewDirectionWS;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
Varyings UnpackVaryings (PackedVaryings input)
|
|
{
|
|
Varyings output;
|
|
output.positionCS = input.positionCS;
|
|
#if defined(LIGHTMAP_ON)
|
|
output.staticLightmapUV = input.staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
output.dynamicLightmapUV = input.dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
output.sh = input.sh;
|
|
#endif
|
|
output.tangentWS = input.tangentWS.xyzw;
|
|
output.texCoord0 = input.texCoord0.xyzw;
|
|
output.fogFactorAndVertexLight = input.fogFactorAndVertexLight.xyzw;
|
|
output.positionWS = input.positionWS.xyz;
|
|
output.normalWS = input.normalWS.xyz;
|
|
output.viewDirectionWS = input.viewDirectionWS.xyz;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
|
|
// --------------------------------------------------
|
|
// Graph
|
|
|
|
// Graph Properties
|
|
CBUFFER_START(UnityPerMaterial)
|
|
float4 _BaseColorMap_TexelSize;
|
|
float4 _NormalMap_TexelSize;
|
|
float Normal_Blend;
|
|
float4 _BaseColor;
|
|
float4 _MaskMap_TexelSize;
|
|
float _MetallicRemapMax;
|
|
float _MetallicRemapMin;
|
|
float _AORemapMin;
|
|
float _AORemapMax;
|
|
float _SmoothnessRemapMin;
|
|
float _SmoothnessRemapMax;
|
|
float _MaskBlendSrc;
|
|
float4 _EmissiveColor;
|
|
float4 _EmissiveColorMap_TexelSize;
|
|
float _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _DrawOrder;
|
|
float _DecalMeshBiasType;
|
|
float _DecalMeshDepthBias;
|
|
float _DecalMeshViewBias;
|
|
float _DecalAngleFadeSupported;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_BaseColorMap);
|
|
SAMPLER(sampler_BaseColorMap);
|
|
TEXTURE2D(_NormalMap);
|
|
SAMPLER(sampler_NormalMap);
|
|
TEXTURE2D(_MaskMap);
|
|
SAMPLER(sampler_MaskMap);
|
|
TEXTURE2D(_EmissiveColorMap);
|
|
SAMPLER(sampler_EmissiveColorMap);
|
|
|
|
// Graph Functions
|
|
|
|
void Unity_Multiply_float4_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Branch_float(float Predicate, float True, float False, out float Out)
|
|
{
|
|
Out = Predicate ? True : False;
|
|
}
|
|
|
|
void Unity_Multiply_float_float(float A, float B, out float Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Remap_float(float In, float2 InMinMax, float2 OutMinMax, out float Out)
|
|
{
|
|
Out = OutMinMax.x + (In - InMinMax.x) * (OutMinMax.y - OutMinMax.x) / (InMinMax.y - InMinMax.x);
|
|
}
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
};
|
|
|
|
VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
|
|
{
|
|
VertexDescription description = (VertexDescription)0;
|
|
return description;
|
|
}
|
|
|
|
// Graph Pixel
|
|
struct SurfaceDescription
|
|
{
|
|
float3 BaseColor;
|
|
float Alpha;
|
|
float3 NormalTS;
|
|
float NormalAlpha;
|
|
float Metallic;
|
|
float Occlusion;
|
|
float Smoothness;
|
|
float MAOSAlpha;
|
|
float3 Emission;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
float4 _Property_320fefd883db46679cd769f61b130dd7_Out_0 = _BaseColor;
|
|
UnityTexture2D _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0 = UnityBuildTexture2DStructNoScale(_BaseColorMap);
|
|
float4 _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0 = SAMPLE_TEXTURE2D(_Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.tex, _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.samplerstate, _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_R_4 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.r;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_G_5 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.g;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_B_6 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.b;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_A_7 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.a;
|
|
float4 _Multiply_885586d42d884019a5375f12f3c61e52_Out_2;
|
|
Unity_Multiply_float4_float4(_Property_320fefd883db46679cd769f61b130dd7_Out_0, _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0, _Multiply_885586d42d884019a5375f12f3c61e52_Out_2);
|
|
float _Property_97f64a9c7748494dbf6dc5b32920f5a5_Out_0 = _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_R_1 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[0];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_G_2 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[1];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_B_3 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[2];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[3];
|
|
UnityTexture2D _Property_b46891aff98b4364a190337410150f10_Out_0 = UnityBuildTexture2DStructNoScale(_MaskMap);
|
|
float4 _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0 = SAMPLE_TEXTURE2D(_Property_b46891aff98b4364a190337410150f10_Out_0.tex, _Property_b46891aff98b4364a190337410150f10_Out_0.samplerstate, _Property_b46891aff98b4364a190337410150f10_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_R_4 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.r;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_G_5 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.g;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.b;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_A_7 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.a;
|
|
float _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3;
|
|
Unity_Branch_float(_Property_97f64a9c7748494dbf6dc5b32920f5a5_Out_0, _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3);
|
|
UnityTexture2D _Property_360e6833e8d64d75827ab98987b2b545_Out_0 = UnityBuildTexture2DStructNoScale(_NormalMap);
|
|
float4 _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0 = SAMPLE_TEXTURE2D(_Property_360e6833e8d64d75827ab98987b2b545_Out_0.tex, _Property_360e6833e8d64d75827ab98987b2b545_Out_0.samplerstate, _Property_360e6833e8d64d75827ab98987b2b545_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.rgb = UnpackNormal(_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0);
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_R_4 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.r;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_G_5 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.g;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_B_6 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.b;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_A_7 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.a;
|
|
float _Property_e94639b7a37847e1a4616aeed6a21034_Out_0 = _MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _Branch_39df5838709544d2951602a5ba721694_Out_3;
|
|
Unity_Branch_float(_Property_e94639b7a37847e1a4616aeed6a21034_Out_0, _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Branch_39df5838709544d2951602a5ba721694_Out_3);
|
|
float _Property_1ed131c6c6bd4d3b9225106c761ab06c_Out_0 = Normal_Blend;
|
|
float _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2;
|
|
Unity_Multiply_float_float(_Branch_39df5838709544d2951602a5ba721694_Out_3, _Property_1ed131c6c6bd4d3b9225106c761ab06c_Out_0, _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2);
|
|
float _Property_5830ed7c65ef489e93de994fcb2769e2_Out_0 = _MetallicRemapMin;
|
|
float _Property_3b33ae94b35943b5bbaa24c03b7069a8_Out_0 = _MetallicRemapMax;
|
|
float2 _Vector2_0ad2d19d32894d5e83e19e69d72753fd_Out_0 = float2(_Property_5830ed7c65ef489e93de994fcb2769e2_Out_0, _Property_3b33ae94b35943b5bbaa24c03b7069a8_Out_0);
|
|
float _Remap_b3145e45987e489f9b15e9672b41a608_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_R_4, float2 (0, 1), _Vector2_0ad2d19d32894d5e83e19e69d72753fd_Out_0, _Remap_b3145e45987e489f9b15e9672b41a608_Out_3);
|
|
float _Property_6427dba68c8342eebff5ce521921ddc5_Out_0 = _AORemapMin;
|
|
float _Property_f74a95489f364e41b53a083f89ad2365_Out_0 = _AORemapMax;
|
|
float2 _Vector2_a00f84e5347b414ca0e9496b9948ba0b_Out_0 = float2(_Property_6427dba68c8342eebff5ce521921ddc5_Out_0, _Property_f74a95489f364e41b53a083f89ad2365_Out_0);
|
|
float _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_G_5, float2 (0, 1), _Vector2_a00f84e5347b414ca0e9496b9948ba0b_Out_0, _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3);
|
|
float _Property_9d6993415be843799b7ec2e689c5db02_Out_0 = _SmoothnessRemapMin;
|
|
float _Property_df4aa91a4fe94e5f8768553f10cd1f82_Out_0 = _SmoothnessRemapMax;
|
|
float2 _Vector2_d67e05a1240344f3978c1c9e3cb9525f_Out_0 = float2(_Property_9d6993415be843799b7ec2e689c5db02_Out_0, _Property_df4aa91a4fe94e5f8768553f10cd1f82_Out_0);
|
|
float _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_A_7, float2 (0, 1), _Vector2_d67e05a1240344f3978c1c9e3cb9525f_Out_0, _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3);
|
|
float _Property_5c661f4099b14a5bac0c24977977340d_Out_0 = _MaskBlendSrc;
|
|
float _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2;
|
|
Unity_Multiply_float_float(_Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _Property_5c661f4099b14a5bac0c24977977340d_Out_0, _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2);
|
|
float _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2;
|
|
Unity_Multiply_float_float(_Property_5c661f4099b14a5bac0c24977977340d_Out_0, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2);
|
|
float _Branch_753c02949c6b4f128d654534f2d64ced_Out_3;
|
|
Unity_Branch_float(_Property_e94639b7a37847e1a4616aeed6a21034_Out_0, _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2, _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2, _Branch_753c02949c6b4f128d654534f2d64ced_Out_3);
|
|
float4 _Property_293317916e0e41cc98bbd5377294091b_Out_0 = IsGammaSpace() ? LinearToSRGB(_EmissiveColor) : _EmissiveColor;
|
|
UnityTexture2D _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0 = UnityBuildTexture2DStructNoScale(_EmissiveColorMap);
|
|
float4 _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0 = SAMPLE_TEXTURE2D(_Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.tex, _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.samplerstate, _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_R_4 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.r;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_G_5 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.g;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_B_6 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.b;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_A_7 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.a;
|
|
float4 _Multiply_2fa508cc2b6044e09e63453927d92375_Out_2;
|
|
Unity_Multiply_float4_float4(_Property_293317916e0e41cc98bbd5377294091b_Out_0, _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0, _Multiply_2fa508cc2b6044e09e63453927d92375_Out_2);
|
|
surface.BaseColor = (_Multiply_885586d42d884019a5375f12f3c61e52_Out_2.xyz);
|
|
surface.Alpha = _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3;
|
|
surface.NormalTS = (_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.xyz);
|
|
surface.NormalAlpha = _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2;
|
|
surface.Metallic = _Remap_b3145e45987e489f9b15e9672b41a608_Out_3;
|
|
surface.Occlusion = _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3;
|
|
surface.Smoothness = _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3;
|
|
surface.MAOSAlpha = _Branch_753c02949c6b4f128d654534f2d64ced_Out_3;
|
|
surface.Emission = (_Multiply_2fa508cc2b6044e09e63453927d92375_Out_2.xyz);
|
|
return surface;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Graph Inputs
|
|
|
|
|
|
// $features.graphVertex: $include("VertexAnimation.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : VertexAnimation.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
|
|
// $features.graphPixel: $include("SharedCode.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : SharedCode.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
|
{
|
|
SurfaceDescriptionInputs output;
|
|
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
|
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorCopyToSDI' */
|
|
|
|
|
|
|
|
output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
|
#else
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
#endif
|
|
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
|
|
return output;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Surface Data
|
|
|
|
uint2 ComputeFadeMaskSeed(uint2 positionSS)
|
|
{
|
|
uint2 fadeMaskSeed;
|
|
|
|
// Can't use the view direction, it is the same across the entire screen.
|
|
fadeMaskSeed = positionSS;
|
|
|
|
return fadeMaskSeed;
|
|
}
|
|
|
|
void GetSurfaceData(Varyings input, uint2 positionSS, float angleFadeFactor, out DecalSurfaceData surfaceData)
|
|
{
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
half4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld);
|
|
half fadeFactor = clamp(normalToWorld[0][3], 0.0f, 1.0f) * angleFadeFactor;
|
|
float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]);
|
|
float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]);
|
|
input.texCoord0.xy = input.texCoord0.xy * scale + offset;
|
|
half3 normalWS = TransformObjectToWorldDir(half3(0, 1, 0));
|
|
half3 tangentWS = TransformObjectToWorldDir(half3(1, 0, 0));
|
|
half3 bitangentWS = TransformObjectToWorldDir(half3(0, 0, 1));
|
|
half sign = dot(cross(normalWS, tangentWS), bitangentWS) > 0 ? 1 : -1;
|
|
input.normalWS.xyz = normalWS;
|
|
input.tangentWS.xyzw = half4(tangentWS, sign);
|
|
#else
|
|
#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group
|
|
LODDitheringTransition(ComputeFadeMaskSeed(positionSS), unity_LODFade.x);
|
|
#endif
|
|
|
|
half fadeFactor = half(1.0);
|
|
#endif
|
|
|
|
SurfaceDescriptionInputs surfaceDescriptionInputs = BuildSurfaceDescriptionInputs(input);
|
|
SurfaceDescription surfaceDescription = SurfaceDescriptionFunction(surfaceDescriptionInputs);
|
|
|
|
// setup defaults -- these are used if the graph doesn't output a value
|
|
ZERO_INITIALIZE(DecalSurfaceData, surfaceData);
|
|
surfaceData.occlusion = half(1.0);
|
|
surfaceData.smoothness = half(0);
|
|
|
|
#ifdef _MATERIAL_AFFECTS_NORMAL
|
|
surfaceData.normalWS.w = half(1.0);
|
|
#else
|
|
surfaceData.normalWS.w = half(0.0);
|
|
#endif
|
|
|
|
surfaceData.emissive.rgb = half3(surfaceDescription.Emission.rgb * fadeFactor);
|
|
|
|
// copy across graph values, if defined
|
|
surfaceData.baseColor.xyz = half3(surfaceDescription.BaseColor);
|
|
surfaceData.baseColor.w = half(surfaceDescription.Alpha * fadeFactor);
|
|
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz));
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz);
|
|
#endif
|
|
#elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
float sgn = input.tangentWS.w; // should be either +1 or -1
|
|
float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz);
|
|
half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz);
|
|
|
|
// We need to normalize as we use mikkt tangent space and this is expected (tangent space is not normalize)
|
|
surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld));
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); // Default to vertex normal
|
|
#endif
|
|
#endif
|
|
|
|
surfaceData.normalWS.w = surfaceDescription.NormalAlpha * fadeFactor;
|
|
|
|
// In case of Smoothness / AO / Metal, all the three are always computed but color mask can change
|
|
surfaceData.metallic = half(surfaceDescription.Metallic);
|
|
surfaceData.occlusion = half(surfaceDescription.Occlusion);
|
|
surfaceData.smoothness = half(surfaceDescription.Smoothness);
|
|
surfaceData.MAOSAlpha = half(surfaceDescription.MAOSAlpha * fadeFactor);
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Main
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPassDecal.hlsl"
|
|
|
|
ENDHLSL
|
|
}
|
|
Pass
|
|
{
|
|
Name "DecalGBufferMesh"
|
|
Tags
|
|
{
|
|
"LightMode" = "DecalGBufferMesh"
|
|
}
|
|
|
|
// Render State
|
|
Blend 0 SrcAlpha OneMinusSrcAlpha
|
|
Blend 1 SrcAlpha OneMinusSrcAlpha
|
|
Blend 2 SrcAlpha OneMinusSrcAlpha
|
|
Blend 3 SrcAlpha OneMinusSrcAlpha
|
|
ZWrite Off
|
|
ColorMask RGB
|
|
ColorMask 0 1
|
|
ColorMask RGB 2
|
|
ColorMask RGB 3
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 3.5
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
#pragma multi_compile_instancing
|
|
#pragma multi_compile_fog
|
|
#pragma editor_sync_compilation
|
|
|
|
// Keywords
|
|
#pragma multi_compile _ LIGHTMAP_ON
|
|
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
|
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
|
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
|
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
|
|
#pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
|
|
#pragma multi_compile _DECAL_NORMAL_BLEND_LOW _DECAL_NORMAL_BLEND_MEDIUM _DECAL_NORMAL_BLEND_HIGH
|
|
#pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
|
|
// GraphKeywords: <None>
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
|
|
// Defines
|
|
#define ATTRIBUTES_NEED_NORMAL
|
|
#define ATTRIBUTES_NEED_TANGENT
|
|
#define ATTRIBUTES_NEED_TEXCOORD0
|
|
#define ATTRIBUTES_NEED_TEXCOORD1
|
|
#define ATTRIBUTES_NEED_TEXCOORD2
|
|
#define VARYINGS_NEED_POSITION_WS
|
|
#define VARYINGS_NEED_NORMAL_WS
|
|
#define VARYINGS_NEED_VIEWDIRECTION_WS
|
|
#define VARYINGS_NEED_TANGENT_WS
|
|
#define VARYINGS_NEED_TEXCOORD0
|
|
#define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
|
|
#define VARYINGS_NEED_SH
|
|
#define VARYINGS_NEED_STATIC_LIGHTMAP_UV
|
|
#define VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV
|
|
|
|
#define HAVE_MESH_MODIFICATION
|
|
|
|
|
|
#define SHADERPASS SHADERPASS_DECAL_GBUFFER_MESH
|
|
#define _MATERIAL_AFFECTS_ALBEDO 1
|
|
#define _MATERIAL_AFFECTS_NORMAL 1
|
|
#define _MATERIAL_AFFECTS_NORMAL_BLEND 1
|
|
#define _MATERIAL_AFFECTS_MAOS 1
|
|
#define _MATERIAL_AFFECTS_EMISSION 1
|
|
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// -- Properties used by ScenePickingPass
|
|
#ifdef SCENEPICKINGPASS
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
// Includes
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Structs and Packing
|
|
|
|
struct Attributes
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
float4 uv0 : TEXCOORD0;
|
|
float4 uv1 : TEXCOORD1;
|
|
float4 uv2 : TEXCOORD2;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : INSTANCEID_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct Varyings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float3 positionWS;
|
|
float3 normalWS;
|
|
float4 tangentWS;
|
|
float4 texCoord0;
|
|
float3 viewDirectionWS;
|
|
#if defined(LIGHTMAP_ON)
|
|
float2 staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
float2 dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
float3 sh;
|
|
#endif
|
|
float4 fogFactorAndVertexLight;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct SurfaceDescriptionInputs
|
|
{
|
|
float3 TangentSpaceNormal;
|
|
float4 uv0;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
};
|
|
struct PackedVaryings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
#if defined(LIGHTMAP_ON)
|
|
float2 staticLightmapUV : INTERP0;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
float2 dynamicLightmapUV : INTERP1;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
float3 sh : INTERP2;
|
|
#endif
|
|
float4 tangentWS : INTERP3;
|
|
float4 texCoord0 : INTERP4;
|
|
float4 fogFactorAndVertexLight : INTERP5;
|
|
float3 positionWS : INTERP6;
|
|
float3 normalWS : INTERP7;
|
|
float3 viewDirectionWS : INTERP8;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
PackedVaryings PackVaryings (Varyings input)
|
|
{
|
|
PackedVaryings output;
|
|
ZERO_INITIALIZE(PackedVaryings, output);
|
|
output.positionCS = input.positionCS;
|
|
#if defined(LIGHTMAP_ON)
|
|
output.staticLightmapUV = input.staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
output.dynamicLightmapUV = input.dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
output.sh = input.sh;
|
|
#endif
|
|
output.tangentWS.xyzw = input.tangentWS;
|
|
output.texCoord0.xyzw = input.texCoord0;
|
|
output.fogFactorAndVertexLight.xyzw = input.fogFactorAndVertexLight;
|
|
output.positionWS.xyz = input.positionWS;
|
|
output.normalWS.xyz = input.normalWS;
|
|
output.viewDirectionWS.xyz = input.viewDirectionWS;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
Varyings UnpackVaryings (PackedVaryings input)
|
|
{
|
|
Varyings output;
|
|
output.positionCS = input.positionCS;
|
|
#if defined(LIGHTMAP_ON)
|
|
output.staticLightmapUV = input.staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
output.dynamicLightmapUV = input.dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
output.sh = input.sh;
|
|
#endif
|
|
output.tangentWS = input.tangentWS.xyzw;
|
|
output.texCoord0 = input.texCoord0.xyzw;
|
|
output.fogFactorAndVertexLight = input.fogFactorAndVertexLight.xyzw;
|
|
output.positionWS = input.positionWS.xyz;
|
|
output.normalWS = input.normalWS.xyz;
|
|
output.viewDirectionWS = input.viewDirectionWS.xyz;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
|
|
// --------------------------------------------------
|
|
// Graph
|
|
|
|
// Graph Properties
|
|
CBUFFER_START(UnityPerMaterial)
|
|
float4 _BaseColorMap_TexelSize;
|
|
float4 _NormalMap_TexelSize;
|
|
float Normal_Blend;
|
|
float4 _BaseColor;
|
|
float4 _MaskMap_TexelSize;
|
|
float _MetallicRemapMax;
|
|
float _MetallicRemapMin;
|
|
float _AORemapMin;
|
|
float _AORemapMax;
|
|
float _SmoothnessRemapMin;
|
|
float _SmoothnessRemapMax;
|
|
float _MaskBlendSrc;
|
|
float4 _EmissiveColor;
|
|
float4 _EmissiveColorMap_TexelSize;
|
|
float _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _DrawOrder;
|
|
float _DecalMeshBiasType;
|
|
float _DecalMeshDepthBias;
|
|
float _DecalMeshViewBias;
|
|
float _DecalAngleFadeSupported;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_BaseColorMap);
|
|
SAMPLER(sampler_BaseColorMap);
|
|
TEXTURE2D(_NormalMap);
|
|
SAMPLER(sampler_NormalMap);
|
|
TEXTURE2D(_MaskMap);
|
|
SAMPLER(sampler_MaskMap);
|
|
TEXTURE2D(_EmissiveColorMap);
|
|
SAMPLER(sampler_EmissiveColorMap);
|
|
|
|
// Graph Functions
|
|
|
|
void Unity_Multiply_float4_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Branch_float(float Predicate, float True, float False, out float Out)
|
|
{
|
|
Out = Predicate ? True : False;
|
|
}
|
|
|
|
void Unity_Multiply_float_float(float A, float B, out float Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Remap_float(float In, float2 InMinMax, float2 OutMinMax, out float Out)
|
|
{
|
|
Out = OutMinMax.x + (In - InMinMax.x) * (OutMinMax.y - OutMinMax.x) / (InMinMax.y - InMinMax.x);
|
|
}
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
};
|
|
|
|
VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
|
|
{
|
|
VertexDescription description = (VertexDescription)0;
|
|
return description;
|
|
}
|
|
|
|
// Graph Pixel
|
|
struct SurfaceDescription
|
|
{
|
|
float3 BaseColor;
|
|
float Alpha;
|
|
float3 NormalTS;
|
|
float NormalAlpha;
|
|
float Metallic;
|
|
float Occlusion;
|
|
float Smoothness;
|
|
float MAOSAlpha;
|
|
float3 Emission;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
float4 _Property_320fefd883db46679cd769f61b130dd7_Out_0 = _BaseColor;
|
|
UnityTexture2D _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0 = UnityBuildTexture2DStructNoScale(_BaseColorMap);
|
|
float4 _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0 = SAMPLE_TEXTURE2D(_Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.tex, _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.samplerstate, _Property_9f1059a7a93a46ccab349515214f3ed2_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_R_4 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.r;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_G_5 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.g;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_B_6 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.b;
|
|
float _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_A_7 = _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0.a;
|
|
float4 _Multiply_885586d42d884019a5375f12f3c61e52_Out_2;
|
|
Unity_Multiply_float4_float4(_Property_320fefd883db46679cd769f61b130dd7_Out_0, _SampleTexture2D_7388a7ddbf6648ec92c3bb54ed055048_RGBA_0, _Multiply_885586d42d884019a5375f12f3c61e52_Out_2);
|
|
float _Property_97f64a9c7748494dbf6dc5b32920f5a5_Out_0 = _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_R_1 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[0];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_G_2 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[1];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_B_3 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[2];
|
|
float _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4 = _Multiply_885586d42d884019a5375f12f3c61e52_Out_2[3];
|
|
UnityTexture2D _Property_b46891aff98b4364a190337410150f10_Out_0 = UnityBuildTexture2DStructNoScale(_MaskMap);
|
|
float4 _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0 = SAMPLE_TEXTURE2D(_Property_b46891aff98b4364a190337410150f10_Out_0.tex, _Property_b46891aff98b4364a190337410150f10_Out_0.samplerstate, _Property_b46891aff98b4364a190337410150f10_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_R_4 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.r;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_G_5 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.g;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.b;
|
|
float _SampleTexture2D_2dcb30935afc407482bb065c4150e563_A_7 = _SampleTexture2D_2dcb30935afc407482bb065c4150e563_RGBA_0.a;
|
|
float _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3;
|
|
Unity_Branch_float(_Property_97f64a9c7748494dbf6dc5b32920f5a5_Out_0, _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3);
|
|
UnityTexture2D _Property_360e6833e8d64d75827ab98987b2b545_Out_0 = UnityBuildTexture2DStructNoScale(_NormalMap);
|
|
float4 _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0 = SAMPLE_TEXTURE2D(_Property_360e6833e8d64d75827ab98987b2b545_Out_0.tex, _Property_360e6833e8d64d75827ab98987b2b545_Out_0.samplerstate, _Property_360e6833e8d64d75827ab98987b2b545_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.rgb = UnpackNormal(_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0);
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_R_4 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.r;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_G_5 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.g;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_B_6 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.b;
|
|
float _SampleTexture2D_1300b7cb738f4b18927411750039acd2_A_7 = _SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.a;
|
|
float _Property_e94639b7a37847e1a4616aeed6a21034_Out_0 = _MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _Branch_39df5838709544d2951602a5ba721694_Out_3;
|
|
Unity_Branch_float(_Property_e94639b7a37847e1a4616aeed6a21034_Out_0, _Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Branch_39df5838709544d2951602a5ba721694_Out_3);
|
|
float _Property_1ed131c6c6bd4d3b9225106c761ab06c_Out_0 = Normal_Blend;
|
|
float _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2;
|
|
Unity_Multiply_float_float(_Branch_39df5838709544d2951602a5ba721694_Out_3, _Property_1ed131c6c6bd4d3b9225106c761ab06c_Out_0, _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2);
|
|
float _Property_5830ed7c65ef489e93de994fcb2769e2_Out_0 = _MetallicRemapMin;
|
|
float _Property_3b33ae94b35943b5bbaa24c03b7069a8_Out_0 = _MetallicRemapMax;
|
|
float2 _Vector2_0ad2d19d32894d5e83e19e69d72753fd_Out_0 = float2(_Property_5830ed7c65ef489e93de994fcb2769e2_Out_0, _Property_3b33ae94b35943b5bbaa24c03b7069a8_Out_0);
|
|
float _Remap_b3145e45987e489f9b15e9672b41a608_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_R_4, float2 (0, 1), _Vector2_0ad2d19d32894d5e83e19e69d72753fd_Out_0, _Remap_b3145e45987e489f9b15e9672b41a608_Out_3);
|
|
float _Property_6427dba68c8342eebff5ce521921ddc5_Out_0 = _AORemapMin;
|
|
float _Property_f74a95489f364e41b53a083f89ad2365_Out_0 = _AORemapMax;
|
|
float2 _Vector2_a00f84e5347b414ca0e9496b9948ba0b_Out_0 = float2(_Property_6427dba68c8342eebff5ce521921ddc5_Out_0, _Property_f74a95489f364e41b53a083f89ad2365_Out_0);
|
|
float _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_G_5, float2 (0, 1), _Vector2_a00f84e5347b414ca0e9496b9948ba0b_Out_0, _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3);
|
|
float _Property_9d6993415be843799b7ec2e689c5db02_Out_0 = _SmoothnessRemapMin;
|
|
float _Property_df4aa91a4fe94e5f8768553f10cd1f82_Out_0 = _SmoothnessRemapMax;
|
|
float2 _Vector2_d67e05a1240344f3978c1c9e3cb9525f_Out_0 = float2(_Property_9d6993415be843799b7ec2e689c5db02_Out_0, _Property_df4aa91a4fe94e5f8768553f10cd1f82_Out_0);
|
|
float _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3;
|
|
Unity_Remap_float(_SampleTexture2D_2dcb30935afc407482bb065c4150e563_A_7, float2 (0, 1), _Vector2_d67e05a1240344f3978c1c9e3cb9525f_Out_0, _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3);
|
|
float _Property_5c661f4099b14a5bac0c24977977340d_Out_0 = _MaskBlendSrc;
|
|
float _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2;
|
|
Unity_Multiply_float_float(_Split_da1fca62bd1b452a906195ffb7fa6a18_A_4, _Property_5c661f4099b14a5bac0c24977977340d_Out_0, _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2);
|
|
float _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2;
|
|
Unity_Multiply_float_float(_Property_5c661f4099b14a5bac0c24977977340d_Out_0, _SampleTexture2D_2dcb30935afc407482bb065c4150e563_B_6, _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2);
|
|
float _Branch_753c02949c6b4f128d654534f2d64ced_Out_3;
|
|
Unity_Branch_float(_Property_e94639b7a37847e1a4616aeed6a21034_Out_0, _Multiply_fc69b6805f38404cb402d2a6b2d2b73a_Out_2, _Multiply_2f94ef00580f43caa2427a59ed8ca124_Out_2, _Branch_753c02949c6b4f128d654534f2d64ced_Out_3);
|
|
float4 _Property_293317916e0e41cc98bbd5377294091b_Out_0 = IsGammaSpace() ? LinearToSRGB(_EmissiveColor) : _EmissiveColor;
|
|
UnityTexture2D _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0 = UnityBuildTexture2DStructNoScale(_EmissiveColorMap);
|
|
float4 _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0 = SAMPLE_TEXTURE2D(_Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.tex, _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.samplerstate, _Property_fb3929b3be5f4269845ceb27fb377d12_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_R_4 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.r;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_G_5 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.g;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_B_6 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.b;
|
|
float _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_A_7 = _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0.a;
|
|
float4 _Multiply_2fa508cc2b6044e09e63453927d92375_Out_2;
|
|
Unity_Multiply_float4_float4(_Property_293317916e0e41cc98bbd5377294091b_Out_0, _SampleTexture2D_d4d6d2f60c614e4c8b681d89316209dc_RGBA_0, _Multiply_2fa508cc2b6044e09e63453927d92375_Out_2);
|
|
surface.BaseColor = (_Multiply_885586d42d884019a5375f12f3c61e52_Out_2.xyz);
|
|
surface.Alpha = _Branch_eb932f0ef97d49398f01d62d896b2b60_Out_3;
|
|
surface.NormalTS = (_SampleTexture2D_1300b7cb738f4b18927411750039acd2_RGBA_0.xyz);
|
|
surface.NormalAlpha = _Multiply_52cb6c63b083455c8e01c3d5ccd89afc_Out_2;
|
|
surface.Metallic = _Remap_b3145e45987e489f9b15e9672b41a608_Out_3;
|
|
surface.Occlusion = _Remap_75ea5a896ac148bb8058b60d79c90284_Out_3;
|
|
surface.Smoothness = _Remap_ad26abe467c44f5284db4b4203d8242b_Out_3;
|
|
surface.MAOSAlpha = _Branch_753c02949c6b4f128d654534f2d64ced_Out_3;
|
|
surface.Emission = (_Multiply_2fa508cc2b6044e09e63453927d92375_Out_2.xyz);
|
|
return surface;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Graph Inputs
|
|
|
|
|
|
// $features.graphVertex: $include("VertexAnimation.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : VertexAnimation.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
|
|
// $features.graphPixel: $include("SharedCode.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : SharedCode.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
|
{
|
|
SurfaceDescriptionInputs output;
|
|
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
|
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorCopyToSDI' */
|
|
|
|
|
|
|
|
output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
|
#else
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
#endif
|
|
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
|
|
return output;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Surface Data
|
|
|
|
uint2 ComputeFadeMaskSeed(uint2 positionSS)
|
|
{
|
|
uint2 fadeMaskSeed;
|
|
|
|
// Can't use the view direction, it is the same across the entire screen.
|
|
fadeMaskSeed = positionSS;
|
|
|
|
return fadeMaskSeed;
|
|
}
|
|
|
|
void GetSurfaceData(Varyings input, uint2 positionSS, float angleFadeFactor, out DecalSurfaceData surfaceData)
|
|
{
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
half4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld);
|
|
half fadeFactor = clamp(normalToWorld[0][3], 0.0f, 1.0f) * angleFadeFactor;
|
|
float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]);
|
|
float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]);
|
|
input.texCoord0.xy = input.texCoord0.xy * scale + offset;
|
|
half3 normalWS = TransformObjectToWorldDir(half3(0, 1, 0));
|
|
half3 tangentWS = TransformObjectToWorldDir(half3(1, 0, 0));
|
|
half3 bitangentWS = TransformObjectToWorldDir(half3(0, 0, 1));
|
|
half sign = dot(cross(normalWS, tangentWS), bitangentWS) > 0 ? 1 : -1;
|
|
input.normalWS.xyz = normalWS;
|
|
input.tangentWS.xyzw = half4(tangentWS, sign);
|
|
#else
|
|
#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group
|
|
LODDitheringTransition(ComputeFadeMaskSeed(positionSS), unity_LODFade.x);
|
|
#endif
|
|
|
|
half fadeFactor = half(1.0);
|
|
#endif
|
|
|
|
SurfaceDescriptionInputs surfaceDescriptionInputs = BuildSurfaceDescriptionInputs(input);
|
|
SurfaceDescription surfaceDescription = SurfaceDescriptionFunction(surfaceDescriptionInputs);
|
|
|
|
// setup defaults -- these are used if the graph doesn't output a value
|
|
ZERO_INITIALIZE(DecalSurfaceData, surfaceData);
|
|
surfaceData.occlusion = half(1.0);
|
|
surfaceData.smoothness = half(0);
|
|
|
|
#ifdef _MATERIAL_AFFECTS_NORMAL
|
|
surfaceData.normalWS.w = half(1.0);
|
|
#else
|
|
surfaceData.normalWS.w = half(0.0);
|
|
#endif
|
|
|
|
surfaceData.emissive.rgb = half3(surfaceDescription.Emission.rgb * fadeFactor);
|
|
|
|
// copy across graph values, if defined
|
|
surfaceData.baseColor.xyz = half3(surfaceDescription.BaseColor);
|
|
surfaceData.baseColor.w = half(surfaceDescription.Alpha * fadeFactor);
|
|
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
surfaceData.normalWS.xyz = normalize(mul((half3x3)normalToWorld, surfaceDescription.NormalTS.xyz));
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz);
|
|
#endif
|
|
#elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
float sgn = input.tangentWS.w; // should be either +1 or -1
|
|
float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz);
|
|
half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz);
|
|
|
|
// We need to normalize as we use mikkt tangent space and this is expected (tangent space is not normalize)
|
|
surfaceData.normalWS.xyz = normalize(TransformTangentToWorld(surfaceDescription.NormalTS, tangentToWorld));
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); // Default to vertex normal
|
|
#endif
|
|
#endif
|
|
|
|
surfaceData.normalWS.w = surfaceDescription.NormalAlpha * fadeFactor;
|
|
|
|
// In case of Smoothness / AO / Metal, all the three are always computed but color mask can change
|
|
surfaceData.metallic = half(surfaceDescription.Metallic);
|
|
surfaceData.occlusion = half(surfaceDescription.Occlusion);
|
|
surfaceData.smoothness = half(surfaceDescription.Smoothness);
|
|
surfaceData.MAOSAlpha = half(surfaceDescription.MAOSAlpha * fadeFactor);
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Main
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPassDecal.hlsl"
|
|
|
|
ENDHLSL
|
|
}
|
|
Pass
|
|
{
|
|
Name "ScenePickingPass"
|
|
Tags
|
|
{
|
|
"LightMode" = "Picking"
|
|
}
|
|
|
|
// Render State
|
|
Cull Back
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 3.5
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
#pragma multi_compile_instancing
|
|
#pragma editor_sync_compilation
|
|
|
|
// Keywords
|
|
// PassKeywords: <None>
|
|
// GraphKeywords: <None>
|
|
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
|
|
// Defines
|
|
|
|
#define HAVE_MESH_MODIFICATION
|
|
|
|
|
|
#define SHADERPASS SHADERPASS_DEPTHONLY
|
|
#define SCENEPICKINGPASS 1
|
|
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// -- Properties used by ScenePickingPass
|
|
#ifdef SCENEPICKINGPASS
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
// Includes
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DecalInput.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderVariablesDecal.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Structs and Packing
|
|
|
|
struct Attributes
|
|
{
|
|
float3 positionOS : POSITION;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : INSTANCEID_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct Varyings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct SurfaceDescriptionInputs
|
|
{
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
};
|
|
struct PackedVaryings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
PackedVaryings PackVaryings (Varyings input)
|
|
{
|
|
PackedVaryings output;
|
|
ZERO_INITIALIZE(PackedVaryings, output);
|
|
output.positionCS = input.positionCS;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
Varyings UnpackVaryings (PackedVaryings input)
|
|
{
|
|
Varyings output;
|
|
output.positionCS = input.positionCS;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
|
|
// --------------------------------------------------
|
|
// Graph
|
|
|
|
// Graph Properties
|
|
CBUFFER_START(UnityPerMaterial)
|
|
float4 _BaseColorMap_TexelSize;
|
|
float4 _NormalMap_TexelSize;
|
|
float Normal_Blend;
|
|
float4 _BaseColor;
|
|
float4 _MaskMap_TexelSize;
|
|
float _MetallicRemapMax;
|
|
float _MetallicRemapMin;
|
|
float _AORemapMin;
|
|
float _AORemapMax;
|
|
float _SmoothnessRemapMin;
|
|
float _SmoothnessRemapMax;
|
|
float _MaskBlendSrc;
|
|
float4 _EmissiveColor;
|
|
float4 _EmissiveColorMap_TexelSize;
|
|
float _Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _MaskMap_Alpha_Use_T_Base_Color_A_F_Maskmap_B;
|
|
float _DrawOrder;
|
|
float _DecalMeshBiasType;
|
|
float _DecalMeshDepthBias;
|
|
float _DecalMeshViewBias;
|
|
float _DecalAngleFadeSupported;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_BaseColorMap);
|
|
SAMPLER(sampler_BaseColorMap);
|
|
TEXTURE2D(_NormalMap);
|
|
SAMPLER(sampler_NormalMap);
|
|
TEXTURE2D(_MaskMap);
|
|
SAMPLER(sampler_MaskMap);
|
|
TEXTURE2D(_EmissiveColorMap);
|
|
SAMPLER(sampler_EmissiveColorMap);
|
|
|
|
// Graph Functions
|
|
// GraphFunctions: <None>
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
};
|
|
|
|
VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
|
|
{
|
|
VertexDescription description = (VertexDescription)0;
|
|
return description;
|
|
}
|
|
|
|
// Graph Pixel
|
|
struct SurfaceDescription
|
|
{
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
return surface;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Graph Inputs
|
|
|
|
|
|
// $features.graphVertex: $include("VertexAnimation.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : VertexAnimation.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
|
|
// $features.graphPixel: $include("SharedCode.template.hlsl")
|
|
// ^ ERROR: $include cannot find file : SharedCode.template.hlsl. Looked into:
|
|
// Packages/com.unity.shadergraph/Editor/Generation/Templates
|
|
|
|
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
|
{
|
|
SurfaceDescriptionInputs output;
|
|
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
|
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorCopyToSDI' */
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
|
#else
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
#endif
|
|
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
|
|
return output;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Surface Data
|
|
|
|
uint2 ComputeFadeMaskSeed(uint2 positionSS)
|
|
{
|
|
uint2 fadeMaskSeed;
|
|
|
|
// Can't use the view direction, it is the same across the entire screen.
|
|
fadeMaskSeed = positionSS;
|
|
|
|
return fadeMaskSeed;
|
|
}
|
|
|
|
void GetSurfaceData(Varyings input, uint2 positionSS, float angleFadeFactor, out DecalSurfaceData surfaceData)
|
|
{
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
half4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld);
|
|
half fadeFactor = clamp(normalToWorld[0][3], 0.0f, 1.0f) * angleFadeFactor;
|
|
float2 scale = float2(normalToWorld[3][0], normalToWorld[3][1]);
|
|
float2 offset = float2(normalToWorld[3][2], normalToWorld[3][3]);
|
|
half3 normalWS = TransformObjectToWorldDir(half3(0, 1, 0));
|
|
half3 tangentWS = TransformObjectToWorldDir(half3(1, 0, 0));
|
|
half3 bitangentWS = TransformObjectToWorldDir(half3(0, 0, 1));
|
|
half sign = dot(cross(normalWS, tangentWS), bitangentWS) > 0 ? 1 : -1;
|
|
#else
|
|
#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group
|
|
LODDitheringTransition(ComputeFadeMaskSeed(positionSS), unity_LODFade.x);
|
|
#endif
|
|
|
|
half fadeFactor = half(1.0);
|
|
#endif
|
|
|
|
SurfaceDescriptionInputs surfaceDescriptionInputs = BuildSurfaceDescriptionInputs(input);
|
|
SurfaceDescription surfaceDescription = SurfaceDescriptionFunction(surfaceDescriptionInputs);
|
|
|
|
// setup defaults -- these are used if the graph doesn't output a value
|
|
ZERO_INITIALIZE(DecalSurfaceData, surfaceData);
|
|
surfaceData.occlusion = half(1.0);
|
|
surfaceData.smoothness = half(0);
|
|
|
|
#ifdef _MATERIAL_AFFECTS_NORMAL
|
|
surfaceData.normalWS.w = half(1.0);
|
|
#else
|
|
surfaceData.normalWS.w = half(0.0);
|
|
#endif
|
|
|
|
|
|
// copy across graph values, if defined
|
|
|
|
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(normalToWorld[2].xyz);
|
|
#endif
|
|
#elif (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH)
|
|
#if defined(_MATERIAL_AFFECTS_NORMAL)
|
|
float sgn = input.tangentWS.w; // should be either +1 or -1
|
|
float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz);
|
|
half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz);
|
|
|
|
// We need to normalize as we use mikkt tangent space and this is expected (tangent space is not normalize)
|
|
#else
|
|
surfaceData.normalWS.xyz = normalize(half3(input.normalWS)); // Default to vertex normal
|
|
#endif
|
|
#endif
|
|
|
|
|
|
// In case of Smoothness / AO / Metal, all the three are always computed but color mask can change
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Main
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPassDecal.hlsl"
|
|
|
|
ENDHLSL
|
|
}
|
|
}
|
|
CustomEditorForRenderPipeline "UnityEditor.Rendering.Universal.DecalShaderGraphGUI" "UnityEngine.Rendering.Universal.UniversalRenderPipelineAsset"
|
|
CustomEditor "UnityEditor.ShaderGraph.GenericShaderGraphMaterialGUI"
|
|
FallBack "Hidden/Shader Graph/FallbackError"
|
|
} |