先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
2842 lines
126 KiB
GLSL
2842 lines
126 KiB
GLSL
Shader "Shader Graphs/FresnelAlphaHighlightNoFog"
|
|
{
|
|
Properties
|
|
{
|
|
_ColorEdge("ColorEdge", Color) = (0.6989583, 0.582796, 0.794, 0)
|
|
_ColorBase("ColorBase", Color) = (1, 1, 1, 0)
|
|
_Alpha("Alpha", Range(0, 1)) = 1
|
|
[NoScaleOffset]_Normal("Normal", 2D) = "white" {}
|
|
[NoScaleOffset]_Tile("Tile", 2D) = "white" {}
|
|
_RimTiling("RimTiling", Vector) = (1, 1, 5, 0)
|
|
_Fresnel("Fresnel", Range(0, 5)) = 1
|
|
_Smoothness("Smoothness", Range(0, 1)) = 0.4
|
|
[HideInInspector]_QueueOffset("_QueueOffset", Float) = 0
|
|
[HideInInspector]_QueueControl("_QueueControl", 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"="Transparent"
|
|
"UniversalMaterialType" = "Lit"
|
|
"Queue"="Transparent"
|
|
"DisableBatching"="False"
|
|
"ShaderGraphShader"="true"
|
|
"ShaderGraphTargetId"="UniversalLitSubTarget"
|
|
}
|
|
Pass
|
|
{
|
|
Name "Universal Forward"
|
|
Tags
|
|
{
|
|
"LightMode" = "UniversalForward"
|
|
}
|
|
|
|
// Render State
|
|
Cull Back
|
|
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
|
|
ZTest LEqual
|
|
ZWrite Off
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 2.0
|
|
#pragma multi_compile_instancing
|
|
#pragma instancing_options renderinglayer
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// Keywords
|
|
#pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
|
|
#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 _ _REFLECTION_PROBE_BLENDING
|
|
#pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION
|
|
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
|
#pragma multi_compile_fragment _ _SHADOWS_SOFT_LOW
|
|
#pragma multi_compile_fragment _ _SHADOWS_SOFT_MEDIUM
|
|
#pragma multi_compile_fragment _ _SHADOWS_SOFT_HIGH
|
|
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
|
|
#pragma multi_compile _ SHADOWS_SHADOWMASK
|
|
#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
|
|
#pragma multi_compile_fragment _ _LIGHT_LAYERS
|
|
#pragma multi_compile_fragment _ DEBUG_DISPLAY
|
|
#pragma multi_compile_fragment _ _LIGHT_COOKIES
|
|
#pragma multi_compile _ _FORWARD_PLUS
|
|
// GraphKeywords: <None>
|
|
|
|
// Defines
|
|
|
|
#define _NORMALMAP 1
|
|
#define _NORMAL_DROPOFF_TS 1
|
|
#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 VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
|
|
#define VARYINGS_NEED_SHADOW_COORD
|
|
#define FEATURES_GRAPH_VERTEX
|
|
/* WARNING: $splice Could not find named fragment 'PassInstancing' */
|
|
#define SHADERPASS SHADERPASS_FORWARD
|
|
#define _FOG_FRAGMENT 1
|
|
#define _SURFACE_TYPE_TRANSPARENT 1
|
|
#define _SPECULAR_SETUP 1
|
|
#define _RECEIVE_SHADOWS_OFF 1
|
|
|
|
|
|
// custom interpolator pre-include
|
|
/* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */
|
|
|
|
// Includes
|
|
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
|
|
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
|
|
#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.universal/ShaderLibrary/Input.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Structs and Packing
|
|
|
|
// custom interpolators pre packing
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPrePacking' */
|
|
|
|
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 defined(LIGHTMAP_ON)
|
|
float2 staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
float2 dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
float3 sh;
|
|
#endif
|
|
float4 fogFactorAndVertexLight;
|
|
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
|
float4 shadowCoord;
|
|
#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 WorldSpaceNormal;
|
|
float3 TangentSpaceNormal;
|
|
float3 WorldSpaceViewDirection;
|
|
float3 ObjectSpacePosition;
|
|
float4 uv0;
|
|
float3 TimeParameters;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
float3 ObjectSpaceNormal;
|
|
float3 ObjectSpaceTangent;
|
|
float3 ObjectSpacePosition;
|
|
};
|
|
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
|
|
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
|
float4 shadowCoord : INTERP3;
|
|
#endif
|
|
float4 tangentWS : INTERP4;
|
|
float4 texCoord0 : INTERP5;
|
|
float4 fogFactorAndVertexLight : INTERP6;
|
|
float3 positionWS : INTERP7;
|
|
float3 normalWS : 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
|
|
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
|
output.shadowCoord = input.shadowCoord;
|
|
#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;
|
|
#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
|
|
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
|
output.shadowCoord = input.shadowCoord;
|
|
#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;
|
|
#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)
|
|
half4 _ColorEdge;
|
|
half4 _ColorBase;
|
|
half _Alpha;
|
|
float4 _Normal_TexelSize;
|
|
float4 _Tile_TexelSize;
|
|
half4 _RimTiling;
|
|
half _Fresnel;
|
|
half _Smoothness;
|
|
CBUFFER_END
|
|
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_Normal);
|
|
SAMPLER(sampler_Normal);
|
|
TEXTURE2D(_Tile);
|
|
SAMPLER(sampler_Tile);
|
|
|
|
// Graph Includes
|
|
// GraphIncludes: <None>
|
|
|
|
// -- Property used by ScenePickingPass
|
|
#ifdef SCENEPICKINGPASS
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
// -- Properties used by SceneSelectionPass
|
|
#ifdef SCENESELECTIONPASS
|
|
int _ObjectId;
|
|
int _PassValue;
|
|
#endif
|
|
|
|
// Graph Functions
|
|
|
|
void Unity_Multiply_float2_float2(float2 A, float2 B, out float2 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Divide_half(half A, half B, out half Out)
|
|
{
|
|
Out = A / B;
|
|
}
|
|
|
|
void Unity_Multiply_half2_half2(half2 A, half2 B, out half2 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Add_float2(float2 A, float2 B, out float2 Out)
|
|
{
|
|
Out = A + B;
|
|
}
|
|
|
|
void Unity_Subtract_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A - B;
|
|
}
|
|
|
|
void Unity_Saturate_float4(float4 In, out float4 Out)
|
|
{
|
|
Out = saturate(In);
|
|
}
|
|
|
|
void Unity_FresnelEffect_half(half3 Normal, half3 ViewDir, half Power, out half Out)
|
|
{
|
|
Out = pow((1.0 - saturate(dot(normalize(Normal), normalize(ViewDir)))), Power);
|
|
}
|
|
|
|
void Unity_Multiply_half4_half4(half4 A, half4 B, out half4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
// Custom interpolators pre vertex
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
half3 Position;
|
|
half3 Normal;
|
|
half3 Tangent;
|
|
};
|
|
|
|
VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
|
|
{
|
|
VertexDescription description = (VertexDescription)0;
|
|
description.Position = IN.ObjectSpacePosition;
|
|
description.Normal = IN.ObjectSpaceNormal;
|
|
description.Tangent = IN.ObjectSpaceTangent;
|
|
return description;
|
|
}
|
|
|
|
// Custom interpolators, pre surface
|
|
#ifdef FEATURES_GRAPH_VERTEX
|
|
Varyings CustomInterpolatorPassThroughFunc(inout Varyings output, VertexDescription input)
|
|
{
|
|
return output;
|
|
}
|
|
#define CUSTOMINTERPOLATOR_VARYPASSTHROUGH_FUNC
|
|
#endif
|
|
|
|
// Graph Pixel
|
|
struct SurfaceDescription
|
|
{
|
|
float3 BaseColor;
|
|
half3 NormalTS;
|
|
half3 Emission;
|
|
half3 Specular;
|
|
half Smoothness;
|
|
half Occlusion;
|
|
half Alpha;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
half4 _Property_0ca28f22f8fc4bb1a920c610ae9ee382_Out_0_Vector4 = _ColorBase;
|
|
UnityTexture2D _Property_9bf12734396842a5a6680213cdd8c6b5_Out_0_Texture2D = UnityBuildTexture2DStructNoScale(_Tile);
|
|
UnityTexture2D _Property_4cd8540b527e4e2aa5b294fc9c81afd1_Out_0_Texture2D = UnityBuildTexture2DStructNoScale(_Normal);
|
|
half4 _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4 = SAMPLE_TEXTURE2D(_Property_4cd8540b527e4e2aa5b294fc9c81afd1_Out_0_Texture2D.tex, _Property_4cd8540b527e4e2aa5b294fc9c81afd1_Out_0_Texture2D.samplerstate, _Property_4cd8540b527e4e2aa5b294fc9c81afd1_Out_0_Texture2D.GetTransformedUV(IN.uv0.xy) );
|
|
_SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.rgb = UnpackNormal(_SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4);
|
|
half _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_R_4_Float = _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.r;
|
|
half _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_G_5_Float = _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.g;
|
|
half _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_B_6_Float = _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.b;
|
|
half _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_A_7_Float = _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.a;
|
|
half2 _Vector2_8e1be6e93aa54bd08ebcdf4ad3fe6788_Out_0_Vector2 = half2(_SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_R_4_Float, _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_B_6_Float);
|
|
float _Split_dd1bfad4a644483bb3e9191b0b16994a_R_1_Float = IN.ObjectSpacePosition[0];
|
|
float _Split_dd1bfad4a644483bb3e9191b0b16994a_G_2_Float = IN.ObjectSpacePosition[1];
|
|
float _Split_dd1bfad4a644483bb3e9191b0b16994a_B_3_Float = IN.ObjectSpacePosition[2];
|
|
float _Split_dd1bfad4a644483bb3e9191b0b16994a_A_4_Float = 0;
|
|
float2 _Vector2_49487d61b6094bcab7b26db494f2cff5_Out_0_Vector2 = float2(_Split_dd1bfad4a644483bb3e9191b0b16994a_R_1_Float, _Split_dd1bfad4a644483bb3e9191b0b16994a_B_3_Float);
|
|
half4 _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4 = _RimTiling;
|
|
half _Split_63b683ee522c4572b36c77aa0b8c708c_R_1_Float = _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4[0];
|
|
half _Split_63b683ee522c4572b36c77aa0b8c708c_G_2_Float = _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4[1];
|
|
half _Split_63b683ee522c4572b36c77aa0b8c708c_B_3_Float = _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4[2];
|
|
half _Split_63b683ee522c4572b36c77aa0b8c708c_A_4_Float = _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4[3];
|
|
half2 _Vector2_5d63053287d34a23b442f5dec71562ce_Out_0_Vector2 = half2(_Split_63b683ee522c4572b36c77aa0b8c708c_R_1_Float, _Split_63b683ee522c4572b36c77aa0b8c708c_G_2_Float);
|
|
float2 _Multiply_29a974b89bea48419f0701b666cac1d4_Out_2_Vector2;
|
|
Unity_Multiply_float2_float2(_Vector2_49487d61b6094bcab7b26db494f2cff5_Out_0_Vector2, _Vector2_5d63053287d34a23b442f5dec71562ce_Out_0_Vector2, _Multiply_29a974b89bea48419f0701b666cac1d4_Out_2_Vector2);
|
|
half2 _Vector2_aa46889df8a4497089f0e7ae2f732a39_Out_0_Vector2 = half2(_Split_63b683ee522c4572b36c77aa0b8c708c_B_3_Float, _Split_63b683ee522c4572b36c77aa0b8c708c_A_4_Float);
|
|
half _Divide_06649e1447634e8489b60ca968f38135_Out_2_Float;
|
|
Unity_Divide_half(IN.TimeParameters.x, 20, _Divide_06649e1447634e8489b60ca968f38135_Out_2_Float);
|
|
half2 _Multiply_7dc204d8895546979c16e02f295e7fab_Out_2_Vector2;
|
|
Unity_Multiply_half2_half2(_Vector2_aa46889df8a4497089f0e7ae2f732a39_Out_0_Vector2, (_Divide_06649e1447634e8489b60ca968f38135_Out_2_Float.xx), _Multiply_7dc204d8895546979c16e02f295e7fab_Out_2_Vector2);
|
|
float2 _Add_51cb18f375dd4a5d8903182d5c53002b_Out_2_Vector2;
|
|
Unity_Add_float2(_Multiply_29a974b89bea48419f0701b666cac1d4_Out_2_Vector2, _Multiply_7dc204d8895546979c16e02f295e7fab_Out_2_Vector2, _Add_51cb18f375dd4a5d8903182d5c53002b_Out_2_Vector2);
|
|
float2 _Add_1cc8fe13fb4645ebba90a66d61a3f5e6_Out_2_Vector2;
|
|
Unity_Add_float2(_Vector2_8e1be6e93aa54bd08ebcdf4ad3fe6788_Out_0_Vector2, _Add_51cb18f375dd4a5d8903182d5c53002b_Out_2_Vector2, _Add_1cc8fe13fb4645ebba90a66d61a3f5e6_Out_2_Vector2);
|
|
float4 _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4 = SAMPLE_TEXTURE2D(_Property_9bf12734396842a5a6680213cdd8c6b5_Out_0_Texture2D.tex, _Property_9bf12734396842a5a6680213cdd8c6b5_Out_0_Texture2D.samplerstate, _Property_9bf12734396842a5a6680213cdd8c6b5_Out_0_Texture2D.GetTransformedUV(_Add_1cc8fe13fb4645ebba90a66d61a3f5e6_Out_2_Vector2) );
|
|
float _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_R_4_Float = _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4.r;
|
|
float _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_G_5_Float = _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4.g;
|
|
float _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_B_6_Float = _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4.b;
|
|
float _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_A_7_Float = _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4.a;
|
|
float4 _Subtract_984691ad39024b22aa1b8300c057ad32_Out_2_Vector4;
|
|
Unity_Subtract_float4(_Property_0ca28f22f8fc4bb1a920c610ae9ee382_Out_0_Vector4, _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4, _Subtract_984691ad39024b22aa1b8300c057ad32_Out_2_Vector4);
|
|
float4 _Saturate_41c1083715d648c2a61405c9fde0a155_Out_1_Vector4;
|
|
Unity_Saturate_float4(_Subtract_984691ad39024b22aa1b8300c057ad32_Out_2_Vector4, _Saturate_41c1083715d648c2a61405c9fde0a155_Out_1_Vector4);
|
|
half _Property_9a327d3062d0469dad9a63459adbb87d_Out_0_Float = _Fresnel;
|
|
half _FresnelEffect_85e026b6cc6d46ebb6f353e259d16bed_Out_3_Float;
|
|
Unity_FresnelEffect_half(IN.WorldSpaceNormal, IN.WorldSpaceViewDirection, _Property_9a327d3062d0469dad9a63459adbb87d_Out_0_Float, _FresnelEffect_85e026b6cc6d46ebb6f353e259d16bed_Out_3_Float);
|
|
half4 _Property_6a44294139264dd39a4ff874469689cf_Out_0_Vector4 = _ColorEdge;
|
|
half4 _Multiply_7c482092a5f0419fb7feb933fc1a3b14_Out_2_Vector4;
|
|
Unity_Multiply_half4_half4((_FresnelEffect_85e026b6cc6d46ebb6f353e259d16bed_Out_3_Float.xxxx), _Property_6a44294139264dd39a4ff874469689cf_Out_0_Vector4, _Multiply_7c482092a5f0419fb7feb933fc1a3b14_Out_2_Vector4);
|
|
half _Property_2ef90d8df10f486d960834f18befeb8a_Out_0_Float = _Smoothness;
|
|
half _Property_e1f45ea83ade48c986752cc481e9d0ba_Out_0_Float = _Alpha;
|
|
surface.BaseColor = (_Saturate_41c1083715d648c2a61405c9fde0a155_Out_1_Vector4.xyz);
|
|
surface.NormalTS = IN.TangentSpaceNormal;
|
|
surface.Emission = (_Multiply_7c482092a5f0419fb7feb933fc1a3b14_Out_2_Vector4.xyz);
|
|
surface.Specular = IsGammaSpace() ? half3(0.603, 0.603, 0.603) : SRGBToLinear(half3(0.603, 0.603, 0.603));
|
|
surface.Smoothness = _Property_2ef90d8df10f486d960834f18befeb8a_Out_0_Float;
|
|
surface.Occlusion = 1;
|
|
surface.Alpha = _Property_e1f45ea83ade48c986752cc481e9d0ba_Out_0_Float;
|
|
return surface;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Graph Inputs
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#define VFX_SRP_ATTRIBUTES Attributes
|
|
#define VFX_SRP_VARYINGS Varyings
|
|
#define VFX_SRP_SURFACE_INPUTS SurfaceDescriptionInputs
|
|
#endif
|
|
VertexDescriptionInputs BuildVertexDescriptionInputs(Attributes input)
|
|
{
|
|
VertexDescriptionInputs output;
|
|
ZERO_INITIALIZE(VertexDescriptionInputs, output);
|
|
|
|
output.ObjectSpaceNormal = input.normalOS;
|
|
output.ObjectSpaceTangent = input.tangentOS.xyz;
|
|
output.ObjectSpacePosition = input.positionOS;
|
|
|
|
return output;
|
|
}
|
|
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
|
{
|
|
SurfaceDescriptionInputs output;
|
|
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
|
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#if VFX_USE_GRAPH_VALUES
|
|
uint instanceActiveIndex = asuint(UNITY_ACCESS_INSTANCED_PROP(PerInstance, _InstanceActiveIndex));
|
|
/* WARNING: $splice Could not find named fragment 'VFXLoadGraphValues' */
|
|
#endif
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// must use interpolated tangent, bitangent and normal before they are normalized in the pixel shader.
|
|
float3 unnormalizedNormalWS = input.normalWS;
|
|
const float renormFactor = 1.0 / length(unnormalizedNormalWS);
|
|
|
|
|
|
output.WorldSpaceNormal = renormFactor * input.normalWS.xyz; // we want a unit length Normal Vector node in shader graph
|
|
output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
|
|
|
|
|
|
output.WorldSpaceViewDirection = GetWorldSpaceNormalizeViewDir(input.positionWS);
|
|
output.ObjectSpacePosition = TransformWorldToObject(input.positionWS);
|
|
|
|
#if UNITY_UV_STARTS_AT_TOP
|
|
#else
|
|
#endif
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
output.TimeParameters = _TimeParameters.xyz; // This is mainly for LW as HD overwrite this value
|
|
#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;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Main
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/PBRForwardPass.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Visual Effect Vertex Invocations
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl"
|
|
#endif
|
|
|
|
ENDHLSL
|
|
}
|
|
Pass
|
|
{
|
|
Name "GBuffer"
|
|
Tags
|
|
{
|
|
"LightMode" = "UniversalGBuffer"
|
|
}
|
|
|
|
// Render State
|
|
Cull Back
|
|
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
|
|
ZTest LEqual
|
|
ZWrite Off
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 4.5
|
|
#pragma exclude_renderers gles gles3 glcore
|
|
#pragma multi_compile_instancing
|
|
#pragma multi_compile_fog
|
|
#pragma instancing_options renderinglayer
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// 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 _ _REFLECTION_PROBE_BLENDING
|
|
#pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION
|
|
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
|
#pragma multi_compile_fragment _ _SHADOWS_SOFT_LOW
|
|
#pragma multi_compile_fragment _ _SHADOWS_SOFT_MEDIUM
|
|
#pragma multi_compile_fragment _ _SHADOWS_SOFT_HIGH
|
|
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
|
|
#pragma multi_compile _ SHADOWS_SHADOWMASK
|
|
#pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
|
|
#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
|
|
#pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
|
|
#pragma multi_compile_fragment _ _RENDER_PASS_ENABLED
|
|
#pragma multi_compile_fragment _ DEBUG_DISPLAY
|
|
// GraphKeywords: <None>
|
|
|
|
// Defines
|
|
|
|
#define _NORMALMAP 1
|
|
#define _NORMAL_DROPOFF_TS 1
|
|
#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 VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
|
|
#define VARYINGS_NEED_SHADOW_COORD
|
|
#define FEATURES_GRAPH_VERTEX
|
|
/* WARNING: $splice Could not find named fragment 'PassInstancing' */
|
|
#define SHADERPASS SHADERPASS_GBUFFER
|
|
#define _FOG_FRAGMENT 1
|
|
#define _SURFACE_TYPE_TRANSPARENT 1
|
|
#define _SPECULAR_SETUP 1
|
|
#define _RECEIVE_SHADOWS_OFF 1
|
|
|
|
|
|
// custom interpolator pre-include
|
|
/* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */
|
|
|
|
// Includes
|
|
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
|
|
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
|
|
#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.universal/ShaderLibrary/Input.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Structs and Packing
|
|
|
|
// custom interpolators pre packing
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPrePacking' */
|
|
|
|
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 defined(LIGHTMAP_ON)
|
|
float2 staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
float2 dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
float3 sh;
|
|
#endif
|
|
float4 fogFactorAndVertexLight;
|
|
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
|
float4 shadowCoord;
|
|
#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 WorldSpaceNormal;
|
|
float3 TangentSpaceNormal;
|
|
float3 WorldSpaceViewDirection;
|
|
float3 ObjectSpacePosition;
|
|
float4 uv0;
|
|
float3 TimeParameters;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
float3 ObjectSpaceNormal;
|
|
float3 ObjectSpaceTangent;
|
|
float3 ObjectSpacePosition;
|
|
};
|
|
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
|
|
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
|
float4 shadowCoord : INTERP3;
|
|
#endif
|
|
float4 tangentWS : INTERP4;
|
|
float4 texCoord0 : INTERP5;
|
|
float4 fogFactorAndVertexLight : INTERP6;
|
|
float3 positionWS : INTERP7;
|
|
float3 normalWS : 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
|
|
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
|
output.shadowCoord = input.shadowCoord;
|
|
#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;
|
|
#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
|
|
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
|
output.shadowCoord = input.shadowCoord;
|
|
#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;
|
|
#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)
|
|
half4 _ColorEdge;
|
|
half4 _ColorBase;
|
|
half _Alpha;
|
|
float4 _Normal_TexelSize;
|
|
float4 _Tile_TexelSize;
|
|
half4 _RimTiling;
|
|
half _Fresnel;
|
|
half _Smoothness;
|
|
CBUFFER_END
|
|
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_Normal);
|
|
SAMPLER(sampler_Normal);
|
|
TEXTURE2D(_Tile);
|
|
SAMPLER(sampler_Tile);
|
|
|
|
// Graph Includes
|
|
// GraphIncludes: <None>
|
|
|
|
// -- Property used by ScenePickingPass
|
|
#ifdef SCENEPICKINGPASS
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
// -- Properties used by SceneSelectionPass
|
|
#ifdef SCENESELECTIONPASS
|
|
int _ObjectId;
|
|
int _PassValue;
|
|
#endif
|
|
|
|
// Graph Functions
|
|
|
|
void Unity_Multiply_float2_float2(float2 A, float2 B, out float2 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Divide_half(half A, half B, out half Out)
|
|
{
|
|
Out = A / B;
|
|
}
|
|
|
|
void Unity_Multiply_half2_half2(half2 A, half2 B, out half2 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Add_float2(float2 A, float2 B, out float2 Out)
|
|
{
|
|
Out = A + B;
|
|
}
|
|
|
|
void Unity_Subtract_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A - B;
|
|
}
|
|
|
|
void Unity_Saturate_float4(float4 In, out float4 Out)
|
|
{
|
|
Out = saturate(In);
|
|
}
|
|
|
|
void Unity_FresnelEffect_half(half3 Normal, half3 ViewDir, half Power, out half Out)
|
|
{
|
|
Out = pow((1.0 - saturate(dot(normalize(Normal), normalize(ViewDir)))), Power);
|
|
}
|
|
|
|
void Unity_Multiply_half4_half4(half4 A, half4 B, out half4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
// Custom interpolators pre vertex
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
half3 Position;
|
|
half3 Normal;
|
|
half3 Tangent;
|
|
};
|
|
|
|
VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
|
|
{
|
|
VertexDescription description = (VertexDescription)0;
|
|
description.Position = IN.ObjectSpacePosition;
|
|
description.Normal = IN.ObjectSpaceNormal;
|
|
description.Tangent = IN.ObjectSpaceTangent;
|
|
return description;
|
|
}
|
|
|
|
// Custom interpolators, pre surface
|
|
#ifdef FEATURES_GRAPH_VERTEX
|
|
Varyings CustomInterpolatorPassThroughFunc(inout Varyings output, VertexDescription input)
|
|
{
|
|
return output;
|
|
}
|
|
#define CUSTOMINTERPOLATOR_VARYPASSTHROUGH_FUNC
|
|
#endif
|
|
|
|
// Graph Pixel
|
|
struct SurfaceDescription
|
|
{
|
|
float3 BaseColor;
|
|
half3 NormalTS;
|
|
half3 Emission;
|
|
half3 Specular;
|
|
half Smoothness;
|
|
half Occlusion;
|
|
half Alpha;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
half4 _Property_0ca28f22f8fc4bb1a920c610ae9ee382_Out_0_Vector4 = _ColorBase;
|
|
UnityTexture2D _Property_9bf12734396842a5a6680213cdd8c6b5_Out_0_Texture2D = UnityBuildTexture2DStructNoScale(_Tile);
|
|
UnityTexture2D _Property_4cd8540b527e4e2aa5b294fc9c81afd1_Out_0_Texture2D = UnityBuildTexture2DStructNoScale(_Normal);
|
|
half4 _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4 = SAMPLE_TEXTURE2D(_Property_4cd8540b527e4e2aa5b294fc9c81afd1_Out_0_Texture2D.tex, _Property_4cd8540b527e4e2aa5b294fc9c81afd1_Out_0_Texture2D.samplerstate, _Property_4cd8540b527e4e2aa5b294fc9c81afd1_Out_0_Texture2D.GetTransformedUV(IN.uv0.xy) );
|
|
_SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.rgb = UnpackNormal(_SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4);
|
|
half _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_R_4_Float = _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.r;
|
|
half _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_G_5_Float = _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.g;
|
|
half _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_B_6_Float = _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.b;
|
|
half _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_A_7_Float = _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.a;
|
|
half2 _Vector2_8e1be6e93aa54bd08ebcdf4ad3fe6788_Out_0_Vector2 = half2(_SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_R_4_Float, _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_B_6_Float);
|
|
float _Split_dd1bfad4a644483bb3e9191b0b16994a_R_1_Float = IN.ObjectSpacePosition[0];
|
|
float _Split_dd1bfad4a644483bb3e9191b0b16994a_G_2_Float = IN.ObjectSpacePosition[1];
|
|
float _Split_dd1bfad4a644483bb3e9191b0b16994a_B_3_Float = IN.ObjectSpacePosition[2];
|
|
float _Split_dd1bfad4a644483bb3e9191b0b16994a_A_4_Float = 0;
|
|
float2 _Vector2_49487d61b6094bcab7b26db494f2cff5_Out_0_Vector2 = float2(_Split_dd1bfad4a644483bb3e9191b0b16994a_R_1_Float, _Split_dd1bfad4a644483bb3e9191b0b16994a_B_3_Float);
|
|
half4 _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4 = _RimTiling;
|
|
half _Split_63b683ee522c4572b36c77aa0b8c708c_R_1_Float = _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4[0];
|
|
half _Split_63b683ee522c4572b36c77aa0b8c708c_G_2_Float = _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4[1];
|
|
half _Split_63b683ee522c4572b36c77aa0b8c708c_B_3_Float = _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4[2];
|
|
half _Split_63b683ee522c4572b36c77aa0b8c708c_A_4_Float = _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4[3];
|
|
half2 _Vector2_5d63053287d34a23b442f5dec71562ce_Out_0_Vector2 = half2(_Split_63b683ee522c4572b36c77aa0b8c708c_R_1_Float, _Split_63b683ee522c4572b36c77aa0b8c708c_G_2_Float);
|
|
float2 _Multiply_29a974b89bea48419f0701b666cac1d4_Out_2_Vector2;
|
|
Unity_Multiply_float2_float2(_Vector2_49487d61b6094bcab7b26db494f2cff5_Out_0_Vector2, _Vector2_5d63053287d34a23b442f5dec71562ce_Out_0_Vector2, _Multiply_29a974b89bea48419f0701b666cac1d4_Out_2_Vector2);
|
|
half2 _Vector2_aa46889df8a4497089f0e7ae2f732a39_Out_0_Vector2 = half2(_Split_63b683ee522c4572b36c77aa0b8c708c_B_3_Float, _Split_63b683ee522c4572b36c77aa0b8c708c_A_4_Float);
|
|
half _Divide_06649e1447634e8489b60ca968f38135_Out_2_Float;
|
|
Unity_Divide_half(IN.TimeParameters.x, 20, _Divide_06649e1447634e8489b60ca968f38135_Out_2_Float);
|
|
half2 _Multiply_7dc204d8895546979c16e02f295e7fab_Out_2_Vector2;
|
|
Unity_Multiply_half2_half2(_Vector2_aa46889df8a4497089f0e7ae2f732a39_Out_0_Vector2, (_Divide_06649e1447634e8489b60ca968f38135_Out_2_Float.xx), _Multiply_7dc204d8895546979c16e02f295e7fab_Out_2_Vector2);
|
|
float2 _Add_51cb18f375dd4a5d8903182d5c53002b_Out_2_Vector2;
|
|
Unity_Add_float2(_Multiply_29a974b89bea48419f0701b666cac1d4_Out_2_Vector2, _Multiply_7dc204d8895546979c16e02f295e7fab_Out_2_Vector2, _Add_51cb18f375dd4a5d8903182d5c53002b_Out_2_Vector2);
|
|
float2 _Add_1cc8fe13fb4645ebba90a66d61a3f5e6_Out_2_Vector2;
|
|
Unity_Add_float2(_Vector2_8e1be6e93aa54bd08ebcdf4ad3fe6788_Out_0_Vector2, _Add_51cb18f375dd4a5d8903182d5c53002b_Out_2_Vector2, _Add_1cc8fe13fb4645ebba90a66d61a3f5e6_Out_2_Vector2);
|
|
float4 _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4 = SAMPLE_TEXTURE2D(_Property_9bf12734396842a5a6680213cdd8c6b5_Out_0_Texture2D.tex, _Property_9bf12734396842a5a6680213cdd8c6b5_Out_0_Texture2D.samplerstate, _Property_9bf12734396842a5a6680213cdd8c6b5_Out_0_Texture2D.GetTransformedUV(_Add_1cc8fe13fb4645ebba90a66d61a3f5e6_Out_2_Vector2) );
|
|
float _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_R_4_Float = _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4.r;
|
|
float _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_G_5_Float = _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4.g;
|
|
float _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_B_6_Float = _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4.b;
|
|
float _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_A_7_Float = _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4.a;
|
|
float4 _Subtract_984691ad39024b22aa1b8300c057ad32_Out_2_Vector4;
|
|
Unity_Subtract_float4(_Property_0ca28f22f8fc4bb1a920c610ae9ee382_Out_0_Vector4, _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4, _Subtract_984691ad39024b22aa1b8300c057ad32_Out_2_Vector4);
|
|
float4 _Saturate_41c1083715d648c2a61405c9fde0a155_Out_1_Vector4;
|
|
Unity_Saturate_float4(_Subtract_984691ad39024b22aa1b8300c057ad32_Out_2_Vector4, _Saturate_41c1083715d648c2a61405c9fde0a155_Out_1_Vector4);
|
|
half _Property_9a327d3062d0469dad9a63459adbb87d_Out_0_Float = _Fresnel;
|
|
half _FresnelEffect_85e026b6cc6d46ebb6f353e259d16bed_Out_3_Float;
|
|
Unity_FresnelEffect_half(IN.WorldSpaceNormal, IN.WorldSpaceViewDirection, _Property_9a327d3062d0469dad9a63459adbb87d_Out_0_Float, _FresnelEffect_85e026b6cc6d46ebb6f353e259d16bed_Out_3_Float);
|
|
half4 _Property_6a44294139264dd39a4ff874469689cf_Out_0_Vector4 = _ColorEdge;
|
|
half4 _Multiply_7c482092a5f0419fb7feb933fc1a3b14_Out_2_Vector4;
|
|
Unity_Multiply_half4_half4((_FresnelEffect_85e026b6cc6d46ebb6f353e259d16bed_Out_3_Float.xxxx), _Property_6a44294139264dd39a4ff874469689cf_Out_0_Vector4, _Multiply_7c482092a5f0419fb7feb933fc1a3b14_Out_2_Vector4);
|
|
half _Property_2ef90d8df10f486d960834f18befeb8a_Out_0_Float = _Smoothness;
|
|
half _Property_e1f45ea83ade48c986752cc481e9d0ba_Out_0_Float = _Alpha;
|
|
surface.BaseColor = (_Saturate_41c1083715d648c2a61405c9fde0a155_Out_1_Vector4.xyz);
|
|
surface.NormalTS = IN.TangentSpaceNormal;
|
|
surface.Emission = (_Multiply_7c482092a5f0419fb7feb933fc1a3b14_Out_2_Vector4.xyz);
|
|
surface.Specular = IsGammaSpace() ? half3(0.603, 0.603, 0.603) : SRGBToLinear(half3(0.603, 0.603, 0.603));
|
|
surface.Smoothness = _Property_2ef90d8df10f486d960834f18befeb8a_Out_0_Float;
|
|
surface.Occlusion = 1;
|
|
surface.Alpha = _Property_e1f45ea83ade48c986752cc481e9d0ba_Out_0_Float;
|
|
return surface;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Graph Inputs
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#define VFX_SRP_ATTRIBUTES Attributes
|
|
#define VFX_SRP_VARYINGS Varyings
|
|
#define VFX_SRP_SURFACE_INPUTS SurfaceDescriptionInputs
|
|
#endif
|
|
VertexDescriptionInputs BuildVertexDescriptionInputs(Attributes input)
|
|
{
|
|
VertexDescriptionInputs output;
|
|
ZERO_INITIALIZE(VertexDescriptionInputs, output);
|
|
|
|
output.ObjectSpaceNormal = input.normalOS;
|
|
output.ObjectSpaceTangent = input.tangentOS.xyz;
|
|
output.ObjectSpacePosition = input.positionOS;
|
|
|
|
return output;
|
|
}
|
|
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
|
{
|
|
SurfaceDescriptionInputs output;
|
|
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
|
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#if VFX_USE_GRAPH_VALUES
|
|
uint instanceActiveIndex = asuint(UNITY_ACCESS_INSTANCED_PROP(PerInstance, _InstanceActiveIndex));
|
|
/* WARNING: $splice Could not find named fragment 'VFXLoadGraphValues' */
|
|
#endif
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// must use interpolated tangent, bitangent and normal before they are normalized in the pixel shader.
|
|
float3 unnormalizedNormalWS = input.normalWS;
|
|
const float renormFactor = 1.0 / length(unnormalizedNormalWS);
|
|
|
|
|
|
output.WorldSpaceNormal = renormFactor * input.normalWS.xyz; // we want a unit length Normal Vector node in shader graph
|
|
output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
|
|
|
|
|
|
output.WorldSpaceViewDirection = GetWorldSpaceNormalizeViewDir(input.positionWS);
|
|
output.ObjectSpacePosition = TransformWorldToObject(input.positionWS);
|
|
|
|
#if UNITY_UV_STARTS_AT_TOP
|
|
#else
|
|
#endif
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
output.TimeParameters = _TimeParameters.xyz; // This is mainly for LW as HD overwrite this value
|
|
#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;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Main
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/PBRGBufferPass.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Visual Effect Vertex Invocations
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl"
|
|
#endif
|
|
|
|
ENDHLSL
|
|
}
|
|
Pass
|
|
{
|
|
Name "DepthNormals"
|
|
Tags
|
|
{
|
|
"LightMode" = "DepthNormals"
|
|
}
|
|
|
|
// Render State
|
|
Cull Back
|
|
ZTest LEqual
|
|
ZWrite On
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 2.0
|
|
#pragma multi_compile_instancing
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// Keywords
|
|
// PassKeywords: <None>
|
|
// GraphKeywords: <None>
|
|
|
|
// Defines
|
|
|
|
#define _NORMALMAP 1
|
|
#define _NORMAL_DROPOFF_TS 1
|
|
#define ATTRIBUTES_NEED_NORMAL
|
|
#define ATTRIBUTES_NEED_TANGENT
|
|
#define ATTRIBUTES_NEED_TEXCOORD1
|
|
#define VARYINGS_NEED_NORMAL_WS
|
|
#define VARYINGS_NEED_TANGENT_WS
|
|
#define FEATURES_GRAPH_VERTEX
|
|
/* WARNING: $splice Could not find named fragment 'PassInstancing' */
|
|
#define SHADERPASS SHADERPASS_DEPTHNORMALS
|
|
|
|
|
|
// custom interpolator pre-include
|
|
/* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */
|
|
|
|
// Includes
|
|
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
|
|
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
|
|
#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.universal/ShaderLibrary/Input.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"
|
|
|
|
// --------------------------------------------------
|
|
// Structs and Packing
|
|
|
|
// custom interpolators pre packing
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPrePacking' */
|
|
|
|
struct Attributes
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
float4 uv1 : TEXCOORD1;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : INSTANCEID_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct Varyings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float3 normalWS;
|
|
float4 tangentWS;
|
|
#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;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
float3 ObjectSpaceNormal;
|
|
float3 ObjectSpaceTangent;
|
|
float3 ObjectSpacePosition;
|
|
};
|
|
struct PackedVaryings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 tangentWS : INTERP0;
|
|
float3 normalWS : INTERP1;
|
|
#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.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.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)
|
|
half4 _ColorEdge;
|
|
half4 _ColorBase;
|
|
half _Alpha;
|
|
float4 _Normal_TexelSize;
|
|
float4 _Tile_TexelSize;
|
|
half4 _RimTiling;
|
|
half _Fresnel;
|
|
half _Smoothness;
|
|
CBUFFER_END
|
|
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_Normal);
|
|
SAMPLER(sampler_Normal);
|
|
TEXTURE2D(_Tile);
|
|
SAMPLER(sampler_Tile);
|
|
|
|
// Graph Includes
|
|
// GraphIncludes: <None>
|
|
|
|
// -- Property used by ScenePickingPass
|
|
#ifdef SCENEPICKINGPASS
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
// -- Properties used by SceneSelectionPass
|
|
#ifdef SCENESELECTIONPASS
|
|
int _ObjectId;
|
|
int _PassValue;
|
|
#endif
|
|
|
|
// Graph Functions
|
|
// GraphFunctions: <None>
|
|
|
|
// Custom interpolators pre vertex
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
half3 Position;
|
|
half3 Normal;
|
|
half3 Tangent;
|
|
};
|
|
|
|
VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
|
|
{
|
|
VertexDescription description = (VertexDescription)0;
|
|
description.Position = IN.ObjectSpacePosition;
|
|
description.Normal = IN.ObjectSpaceNormal;
|
|
description.Tangent = IN.ObjectSpaceTangent;
|
|
return description;
|
|
}
|
|
|
|
// Custom interpolators, pre surface
|
|
#ifdef FEATURES_GRAPH_VERTEX
|
|
Varyings CustomInterpolatorPassThroughFunc(inout Varyings output, VertexDescription input)
|
|
{
|
|
return output;
|
|
}
|
|
#define CUSTOMINTERPOLATOR_VARYPASSTHROUGH_FUNC
|
|
#endif
|
|
|
|
// Graph Pixel
|
|
struct SurfaceDescription
|
|
{
|
|
half3 NormalTS;
|
|
half Alpha;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
half _Property_e1f45ea83ade48c986752cc481e9d0ba_Out_0_Float = _Alpha;
|
|
surface.NormalTS = IN.TangentSpaceNormal;
|
|
surface.Alpha = _Property_e1f45ea83ade48c986752cc481e9d0ba_Out_0_Float;
|
|
return surface;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Graph Inputs
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#define VFX_SRP_ATTRIBUTES Attributes
|
|
#define VFX_SRP_VARYINGS Varyings
|
|
#define VFX_SRP_SURFACE_INPUTS SurfaceDescriptionInputs
|
|
#endif
|
|
VertexDescriptionInputs BuildVertexDescriptionInputs(Attributes input)
|
|
{
|
|
VertexDescriptionInputs output;
|
|
ZERO_INITIALIZE(VertexDescriptionInputs, output);
|
|
|
|
output.ObjectSpaceNormal = input.normalOS;
|
|
output.ObjectSpaceTangent = input.tangentOS.xyz;
|
|
output.ObjectSpacePosition = input.positionOS;
|
|
|
|
return output;
|
|
}
|
|
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
|
{
|
|
SurfaceDescriptionInputs output;
|
|
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
|
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#if VFX_USE_GRAPH_VALUES
|
|
uint instanceActiveIndex = asuint(UNITY_ACCESS_INSTANCED_PROP(PerInstance, _InstanceActiveIndex));
|
|
/* WARNING: $splice Could not find named fragment 'VFXLoadGraphValues' */
|
|
#endif
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
|
|
|
|
|
|
|
|
#if UNITY_UV_STARTS_AT_TOP
|
|
#else
|
|
#endif
|
|
|
|
|
|
#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;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Main
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/DepthNormalsOnlyPass.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Visual Effect Vertex Invocations
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl"
|
|
#endif
|
|
|
|
ENDHLSL
|
|
}
|
|
Pass
|
|
{
|
|
Name "Meta"
|
|
Tags
|
|
{
|
|
"LightMode" = "Meta"
|
|
}
|
|
|
|
// Render State
|
|
Cull Off
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 2.0
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// Keywords
|
|
#pragma shader_feature _ EDITOR_VISUALIZATION
|
|
// GraphKeywords: <None>
|
|
|
|
// Defines
|
|
|
|
#define _NORMALMAP 1
|
|
#define _NORMAL_DROPOFF_TS 1
|
|
#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_TEXCOORD0
|
|
#define VARYINGS_NEED_TEXCOORD1
|
|
#define VARYINGS_NEED_TEXCOORD2
|
|
#define FEATURES_GRAPH_VERTEX
|
|
/* WARNING: $splice Could not find named fragment 'PassInstancing' */
|
|
#define SHADERPASS SHADERPASS_META
|
|
#define _FOG_FRAGMENT 1
|
|
|
|
|
|
// custom interpolator pre-include
|
|
/* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */
|
|
|
|
// 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.universal/ShaderLibrary/Input.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/MetaInput.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Structs and Packing
|
|
|
|
// custom interpolators pre packing
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPrePacking' */
|
|
|
|
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 texCoord0;
|
|
float4 texCoord1;
|
|
float4 texCoord2;
|
|
#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 WorldSpaceNormal;
|
|
float3 WorldSpaceViewDirection;
|
|
float3 ObjectSpacePosition;
|
|
float4 uv0;
|
|
float3 TimeParameters;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
float3 ObjectSpaceNormal;
|
|
float3 ObjectSpaceTangent;
|
|
float3 ObjectSpacePosition;
|
|
};
|
|
struct PackedVaryings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 texCoord0 : INTERP0;
|
|
float4 texCoord1 : INTERP1;
|
|
float4 texCoord2 : INTERP2;
|
|
float3 positionWS : INTERP3;
|
|
float3 normalWS : INTERP4;
|
|
#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;
|
|
output.texCoord1.xyzw = input.texCoord1;
|
|
output.texCoord2.xyzw = input.texCoord2;
|
|
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.texCoord0 = input.texCoord0.xyzw;
|
|
output.texCoord1 = input.texCoord1.xyzw;
|
|
output.texCoord2 = input.texCoord2.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)
|
|
half4 _ColorEdge;
|
|
half4 _ColorBase;
|
|
half _Alpha;
|
|
float4 _Normal_TexelSize;
|
|
float4 _Tile_TexelSize;
|
|
half4 _RimTiling;
|
|
half _Fresnel;
|
|
half _Smoothness;
|
|
CBUFFER_END
|
|
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_Normal);
|
|
SAMPLER(sampler_Normal);
|
|
TEXTURE2D(_Tile);
|
|
SAMPLER(sampler_Tile);
|
|
|
|
// Graph Includes
|
|
// GraphIncludes: <None>
|
|
|
|
// -- Property used by ScenePickingPass
|
|
#ifdef SCENEPICKINGPASS
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
// -- Properties used by SceneSelectionPass
|
|
#ifdef SCENESELECTIONPASS
|
|
int _ObjectId;
|
|
int _PassValue;
|
|
#endif
|
|
|
|
// Graph Functions
|
|
|
|
void Unity_Multiply_float2_float2(float2 A, float2 B, out float2 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Divide_half(half A, half B, out half Out)
|
|
{
|
|
Out = A / B;
|
|
}
|
|
|
|
void Unity_Multiply_half2_half2(half2 A, half2 B, out half2 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Add_float2(float2 A, float2 B, out float2 Out)
|
|
{
|
|
Out = A + B;
|
|
}
|
|
|
|
void Unity_Subtract_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A - B;
|
|
}
|
|
|
|
void Unity_Saturate_float4(float4 In, out float4 Out)
|
|
{
|
|
Out = saturate(In);
|
|
}
|
|
|
|
void Unity_FresnelEffect_half(half3 Normal, half3 ViewDir, half Power, out half Out)
|
|
{
|
|
Out = pow((1.0 - saturate(dot(normalize(Normal), normalize(ViewDir)))), Power);
|
|
}
|
|
|
|
void Unity_Multiply_half4_half4(half4 A, half4 B, out half4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
// Custom interpolators pre vertex
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
half3 Position;
|
|
half3 Normal;
|
|
half3 Tangent;
|
|
};
|
|
|
|
VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
|
|
{
|
|
VertexDescription description = (VertexDescription)0;
|
|
description.Position = IN.ObjectSpacePosition;
|
|
description.Normal = IN.ObjectSpaceNormal;
|
|
description.Tangent = IN.ObjectSpaceTangent;
|
|
return description;
|
|
}
|
|
|
|
// Custom interpolators, pre surface
|
|
#ifdef FEATURES_GRAPH_VERTEX
|
|
Varyings CustomInterpolatorPassThroughFunc(inout Varyings output, VertexDescription input)
|
|
{
|
|
return output;
|
|
}
|
|
#define CUSTOMINTERPOLATOR_VARYPASSTHROUGH_FUNC
|
|
#endif
|
|
|
|
// Graph Pixel
|
|
struct SurfaceDescription
|
|
{
|
|
float3 BaseColor;
|
|
half3 Emission;
|
|
half Alpha;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
half4 _Property_0ca28f22f8fc4bb1a920c610ae9ee382_Out_0_Vector4 = _ColorBase;
|
|
UnityTexture2D _Property_9bf12734396842a5a6680213cdd8c6b5_Out_0_Texture2D = UnityBuildTexture2DStructNoScale(_Tile);
|
|
UnityTexture2D _Property_4cd8540b527e4e2aa5b294fc9c81afd1_Out_0_Texture2D = UnityBuildTexture2DStructNoScale(_Normal);
|
|
half4 _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4 = SAMPLE_TEXTURE2D(_Property_4cd8540b527e4e2aa5b294fc9c81afd1_Out_0_Texture2D.tex, _Property_4cd8540b527e4e2aa5b294fc9c81afd1_Out_0_Texture2D.samplerstate, _Property_4cd8540b527e4e2aa5b294fc9c81afd1_Out_0_Texture2D.GetTransformedUV(IN.uv0.xy) );
|
|
_SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.rgb = UnpackNormal(_SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4);
|
|
half _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_R_4_Float = _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.r;
|
|
half _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_G_5_Float = _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.g;
|
|
half _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_B_6_Float = _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.b;
|
|
half _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_A_7_Float = _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.a;
|
|
half2 _Vector2_8e1be6e93aa54bd08ebcdf4ad3fe6788_Out_0_Vector2 = half2(_SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_R_4_Float, _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_B_6_Float);
|
|
float _Split_dd1bfad4a644483bb3e9191b0b16994a_R_1_Float = IN.ObjectSpacePosition[0];
|
|
float _Split_dd1bfad4a644483bb3e9191b0b16994a_G_2_Float = IN.ObjectSpacePosition[1];
|
|
float _Split_dd1bfad4a644483bb3e9191b0b16994a_B_3_Float = IN.ObjectSpacePosition[2];
|
|
float _Split_dd1bfad4a644483bb3e9191b0b16994a_A_4_Float = 0;
|
|
float2 _Vector2_49487d61b6094bcab7b26db494f2cff5_Out_0_Vector2 = float2(_Split_dd1bfad4a644483bb3e9191b0b16994a_R_1_Float, _Split_dd1bfad4a644483bb3e9191b0b16994a_B_3_Float);
|
|
half4 _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4 = _RimTiling;
|
|
half _Split_63b683ee522c4572b36c77aa0b8c708c_R_1_Float = _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4[0];
|
|
half _Split_63b683ee522c4572b36c77aa0b8c708c_G_2_Float = _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4[1];
|
|
half _Split_63b683ee522c4572b36c77aa0b8c708c_B_3_Float = _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4[2];
|
|
half _Split_63b683ee522c4572b36c77aa0b8c708c_A_4_Float = _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4[3];
|
|
half2 _Vector2_5d63053287d34a23b442f5dec71562ce_Out_0_Vector2 = half2(_Split_63b683ee522c4572b36c77aa0b8c708c_R_1_Float, _Split_63b683ee522c4572b36c77aa0b8c708c_G_2_Float);
|
|
float2 _Multiply_29a974b89bea48419f0701b666cac1d4_Out_2_Vector2;
|
|
Unity_Multiply_float2_float2(_Vector2_49487d61b6094bcab7b26db494f2cff5_Out_0_Vector2, _Vector2_5d63053287d34a23b442f5dec71562ce_Out_0_Vector2, _Multiply_29a974b89bea48419f0701b666cac1d4_Out_2_Vector2);
|
|
half2 _Vector2_aa46889df8a4497089f0e7ae2f732a39_Out_0_Vector2 = half2(_Split_63b683ee522c4572b36c77aa0b8c708c_B_3_Float, _Split_63b683ee522c4572b36c77aa0b8c708c_A_4_Float);
|
|
half _Divide_06649e1447634e8489b60ca968f38135_Out_2_Float;
|
|
Unity_Divide_half(IN.TimeParameters.x, 20, _Divide_06649e1447634e8489b60ca968f38135_Out_2_Float);
|
|
half2 _Multiply_7dc204d8895546979c16e02f295e7fab_Out_2_Vector2;
|
|
Unity_Multiply_half2_half2(_Vector2_aa46889df8a4497089f0e7ae2f732a39_Out_0_Vector2, (_Divide_06649e1447634e8489b60ca968f38135_Out_2_Float.xx), _Multiply_7dc204d8895546979c16e02f295e7fab_Out_2_Vector2);
|
|
float2 _Add_51cb18f375dd4a5d8903182d5c53002b_Out_2_Vector2;
|
|
Unity_Add_float2(_Multiply_29a974b89bea48419f0701b666cac1d4_Out_2_Vector2, _Multiply_7dc204d8895546979c16e02f295e7fab_Out_2_Vector2, _Add_51cb18f375dd4a5d8903182d5c53002b_Out_2_Vector2);
|
|
float2 _Add_1cc8fe13fb4645ebba90a66d61a3f5e6_Out_2_Vector2;
|
|
Unity_Add_float2(_Vector2_8e1be6e93aa54bd08ebcdf4ad3fe6788_Out_0_Vector2, _Add_51cb18f375dd4a5d8903182d5c53002b_Out_2_Vector2, _Add_1cc8fe13fb4645ebba90a66d61a3f5e6_Out_2_Vector2);
|
|
float4 _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4 = SAMPLE_TEXTURE2D(_Property_9bf12734396842a5a6680213cdd8c6b5_Out_0_Texture2D.tex, _Property_9bf12734396842a5a6680213cdd8c6b5_Out_0_Texture2D.samplerstate, _Property_9bf12734396842a5a6680213cdd8c6b5_Out_0_Texture2D.GetTransformedUV(_Add_1cc8fe13fb4645ebba90a66d61a3f5e6_Out_2_Vector2) );
|
|
float _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_R_4_Float = _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4.r;
|
|
float _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_G_5_Float = _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4.g;
|
|
float _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_B_6_Float = _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4.b;
|
|
float _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_A_7_Float = _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4.a;
|
|
float4 _Subtract_984691ad39024b22aa1b8300c057ad32_Out_2_Vector4;
|
|
Unity_Subtract_float4(_Property_0ca28f22f8fc4bb1a920c610ae9ee382_Out_0_Vector4, _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4, _Subtract_984691ad39024b22aa1b8300c057ad32_Out_2_Vector4);
|
|
float4 _Saturate_41c1083715d648c2a61405c9fde0a155_Out_1_Vector4;
|
|
Unity_Saturate_float4(_Subtract_984691ad39024b22aa1b8300c057ad32_Out_2_Vector4, _Saturate_41c1083715d648c2a61405c9fde0a155_Out_1_Vector4);
|
|
half _Property_9a327d3062d0469dad9a63459adbb87d_Out_0_Float = _Fresnel;
|
|
half _FresnelEffect_85e026b6cc6d46ebb6f353e259d16bed_Out_3_Float;
|
|
Unity_FresnelEffect_half(IN.WorldSpaceNormal, IN.WorldSpaceViewDirection, _Property_9a327d3062d0469dad9a63459adbb87d_Out_0_Float, _FresnelEffect_85e026b6cc6d46ebb6f353e259d16bed_Out_3_Float);
|
|
half4 _Property_6a44294139264dd39a4ff874469689cf_Out_0_Vector4 = _ColorEdge;
|
|
half4 _Multiply_7c482092a5f0419fb7feb933fc1a3b14_Out_2_Vector4;
|
|
Unity_Multiply_half4_half4((_FresnelEffect_85e026b6cc6d46ebb6f353e259d16bed_Out_3_Float.xxxx), _Property_6a44294139264dd39a4ff874469689cf_Out_0_Vector4, _Multiply_7c482092a5f0419fb7feb933fc1a3b14_Out_2_Vector4);
|
|
half _Property_e1f45ea83ade48c986752cc481e9d0ba_Out_0_Float = _Alpha;
|
|
surface.BaseColor = (_Saturate_41c1083715d648c2a61405c9fde0a155_Out_1_Vector4.xyz);
|
|
surface.Emission = (_Multiply_7c482092a5f0419fb7feb933fc1a3b14_Out_2_Vector4.xyz);
|
|
surface.Alpha = _Property_e1f45ea83ade48c986752cc481e9d0ba_Out_0_Float;
|
|
return surface;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Graph Inputs
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#define VFX_SRP_ATTRIBUTES Attributes
|
|
#define VFX_SRP_VARYINGS Varyings
|
|
#define VFX_SRP_SURFACE_INPUTS SurfaceDescriptionInputs
|
|
#endif
|
|
VertexDescriptionInputs BuildVertexDescriptionInputs(Attributes input)
|
|
{
|
|
VertexDescriptionInputs output;
|
|
ZERO_INITIALIZE(VertexDescriptionInputs, output);
|
|
|
|
output.ObjectSpaceNormal = input.normalOS;
|
|
output.ObjectSpaceTangent = input.tangentOS.xyz;
|
|
output.ObjectSpacePosition = input.positionOS;
|
|
|
|
return output;
|
|
}
|
|
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
|
{
|
|
SurfaceDescriptionInputs output;
|
|
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
|
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#if VFX_USE_GRAPH_VALUES
|
|
uint instanceActiveIndex = asuint(UNITY_ACCESS_INSTANCED_PROP(PerInstance, _InstanceActiveIndex));
|
|
/* WARNING: $splice Could not find named fragment 'VFXLoadGraphValues' */
|
|
#endif
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// must use interpolated tangent, bitangent and normal before they are normalized in the pixel shader.
|
|
float3 unnormalizedNormalWS = input.normalWS;
|
|
const float renormFactor = 1.0 / length(unnormalizedNormalWS);
|
|
|
|
|
|
output.WorldSpaceNormal = renormFactor * input.normalWS.xyz; // we want a unit length Normal Vector node in shader graph
|
|
|
|
|
|
output.WorldSpaceViewDirection = GetWorldSpaceNormalizeViewDir(input.positionWS);
|
|
output.ObjectSpacePosition = TransformWorldToObject(input.positionWS);
|
|
|
|
#if UNITY_UV_STARTS_AT_TOP
|
|
#else
|
|
#endif
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
output.TimeParameters = _TimeParameters.xyz; // This is mainly for LW as HD overwrite this value
|
|
#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;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Main
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/LightingMetaPass.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Visual Effect Vertex Invocations
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl"
|
|
#endif
|
|
|
|
ENDHLSL
|
|
}
|
|
Pass
|
|
{
|
|
Name "SceneSelectionPass"
|
|
Tags
|
|
{
|
|
"LightMode" = "SceneSelectionPass"
|
|
}
|
|
|
|
// Render State
|
|
Cull Off
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 2.0
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// Keywords
|
|
// PassKeywords: <None>
|
|
// GraphKeywords: <None>
|
|
|
|
// Defines
|
|
|
|
#define _NORMALMAP 1
|
|
#define _NORMAL_DROPOFF_TS 1
|
|
#define ATTRIBUTES_NEED_NORMAL
|
|
#define ATTRIBUTES_NEED_TANGENT
|
|
#define FEATURES_GRAPH_VERTEX
|
|
/* WARNING: $splice Could not find named fragment 'PassInstancing' */
|
|
#define SHADERPASS SHADERPASS_DEPTHONLY
|
|
#define SCENESELECTIONPASS 1
|
|
#define ALPHA_CLIP_THRESHOLD 1
|
|
|
|
|
|
// custom interpolator pre-include
|
|
/* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */
|
|
|
|
// 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.universal/ShaderLibrary/Input.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"
|
|
|
|
// --------------------------------------------------
|
|
// Structs and Packing
|
|
|
|
// custom interpolators pre packing
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPrePacking' */
|
|
|
|
struct Attributes
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
#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
|
|
{
|
|
float3 ObjectSpaceNormal;
|
|
float3 ObjectSpaceTangent;
|
|
float3 ObjectSpacePosition;
|
|
};
|
|
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)
|
|
half4 _ColorEdge;
|
|
half4 _ColorBase;
|
|
half _Alpha;
|
|
float4 _Normal_TexelSize;
|
|
float4 _Tile_TexelSize;
|
|
half4 _RimTiling;
|
|
half _Fresnel;
|
|
half _Smoothness;
|
|
CBUFFER_END
|
|
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_Normal);
|
|
SAMPLER(sampler_Normal);
|
|
TEXTURE2D(_Tile);
|
|
SAMPLER(sampler_Tile);
|
|
|
|
// Graph Includes
|
|
// GraphIncludes: <None>
|
|
|
|
// -- Property used by ScenePickingPass
|
|
#ifdef SCENEPICKINGPASS
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
// -- Properties used by SceneSelectionPass
|
|
#ifdef SCENESELECTIONPASS
|
|
int _ObjectId;
|
|
int _PassValue;
|
|
#endif
|
|
|
|
// Graph Functions
|
|
// GraphFunctions: <None>
|
|
|
|
// Custom interpolators pre vertex
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
half3 Position;
|
|
half3 Normal;
|
|
half3 Tangent;
|
|
};
|
|
|
|
VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
|
|
{
|
|
VertexDescription description = (VertexDescription)0;
|
|
description.Position = IN.ObjectSpacePosition;
|
|
description.Normal = IN.ObjectSpaceNormal;
|
|
description.Tangent = IN.ObjectSpaceTangent;
|
|
return description;
|
|
}
|
|
|
|
// Custom interpolators, pre surface
|
|
#ifdef FEATURES_GRAPH_VERTEX
|
|
Varyings CustomInterpolatorPassThroughFunc(inout Varyings output, VertexDescription input)
|
|
{
|
|
return output;
|
|
}
|
|
#define CUSTOMINTERPOLATOR_VARYPASSTHROUGH_FUNC
|
|
#endif
|
|
|
|
// Graph Pixel
|
|
struct SurfaceDescription
|
|
{
|
|
half Alpha;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
half _Property_e1f45ea83ade48c986752cc481e9d0ba_Out_0_Float = _Alpha;
|
|
surface.Alpha = _Property_e1f45ea83ade48c986752cc481e9d0ba_Out_0_Float;
|
|
return surface;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Graph Inputs
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#define VFX_SRP_ATTRIBUTES Attributes
|
|
#define VFX_SRP_VARYINGS Varyings
|
|
#define VFX_SRP_SURFACE_INPUTS SurfaceDescriptionInputs
|
|
#endif
|
|
VertexDescriptionInputs BuildVertexDescriptionInputs(Attributes input)
|
|
{
|
|
VertexDescriptionInputs output;
|
|
ZERO_INITIALIZE(VertexDescriptionInputs, output);
|
|
|
|
output.ObjectSpaceNormal = input.normalOS;
|
|
output.ObjectSpaceTangent = input.tangentOS.xyz;
|
|
output.ObjectSpacePosition = input.positionOS;
|
|
|
|
return output;
|
|
}
|
|
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
|
{
|
|
SurfaceDescriptionInputs output;
|
|
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
|
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#if VFX_USE_GRAPH_VALUES
|
|
uint instanceActiveIndex = asuint(UNITY_ACCESS_INSTANCED_PROP(PerInstance, _InstanceActiveIndex));
|
|
/* WARNING: $splice Could not find named fragment 'VFXLoadGraphValues' */
|
|
#endif
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if UNITY_UV_STARTS_AT_TOP
|
|
#else
|
|
#endif
|
|
|
|
|
|
#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;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Main
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/SelectionPickingPass.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Visual Effect Vertex Invocations
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl"
|
|
#endif
|
|
|
|
ENDHLSL
|
|
}
|
|
Pass
|
|
{
|
|
Name "ScenePickingPass"
|
|
Tags
|
|
{
|
|
"LightMode" = "Picking"
|
|
}
|
|
|
|
// Render State
|
|
Cull Back
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 2.0
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// Keywords
|
|
// PassKeywords: <None>
|
|
// GraphKeywords: <None>
|
|
|
|
// Defines
|
|
|
|
#define _NORMALMAP 1
|
|
#define _NORMAL_DROPOFF_TS 1
|
|
#define ATTRIBUTES_NEED_NORMAL
|
|
#define ATTRIBUTES_NEED_TANGENT
|
|
#define FEATURES_GRAPH_VERTEX
|
|
/* WARNING: $splice Could not find named fragment 'PassInstancing' */
|
|
#define SHADERPASS SHADERPASS_DEPTHONLY
|
|
#define SCENEPICKINGPASS 1
|
|
#define ALPHA_CLIP_THRESHOLD 1
|
|
|
|
|
|
// custom interpolator pre-include
|
|
/* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */
|
|
|
|
// 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.universal/ShaderLibrary/Input.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"
|
|
|
|
// --------------------------------------------------
|
|
// Structs and Packing
|
|
|
|
// custom interpolators pre packing
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPrePacking' */
|
|
|
|
struct Attributes
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
#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
|
|
{
|
|
float3 ObjectSpaceNormal;
|
|
float3 ObjectSpaceTangent;
|
|
float3 ObjectSpacePosition;
|
|
};
|
|
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)
|
|
half4 _ColorEdge;
|
|
half4 _ColorBase;
|
|
half _Alpha;
|
|
float4 _Normal_TexelSize;
|
|
float4 _Tile_TexelSize;
|
|
half4 _RimTiling;
|
|
half _Fresnel;
|
|
half _Smoothness;
|
|
CBUFFER_END
|
|
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_Normal);
|
|
SAMPLER(sampler_Normal);
|
|
TEXTURE2D(_Tile);
|
|
SAMPLER(sampler_Tile);
|
|
|
|
// Graph Includes
|
|
// GraphIncludes: <None>
|
|
|
|
// -- Property used by ScenePickingPass
|
|
#ifdef SCENEPICKINGPASS
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
// -- Properties used by SceneSelectionPass
|
|
#ifdef SCENESELECTIONPASS
|
|
int _ObjectId;
|
|
int _PassValue;
|
|
#endif
|
|
|
|
// Graph Functions
|
|
// GraphFunctions: <None>
|
|
|
|
// Custom interpolators pre vertex
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
half3 Position;
|
|
half3 Normal;
|
|
half3 Tangent;
|
|
};
|
|
|
|
VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
|
|
{
|
|
VertexDescription description = (VertexDescription)0;
|
|
description.Position = IN.ObjectSpacePosition;
|
|
description.Normal = IN.ObjectSpaceNormal;
|
|
description.Tangent = IN.ObjectSpaceTangent;
|
|
return description;
|
|
}
|
|
|
|
// Custom interpolators, pre surface
|
|
#ifdef FEATURES_GRAPH_VERTEX
|
|
Varyings CustomInterpolatorPassThroughFunc(inout Varyings output, VertexDescription input)
|
|
{
|
|
return output;
|
|
}
|
|
#define CUSTOMINTERPOLATOR_VARYPASSTHROUGH_FUNC
|
|
#endif
|
|
|
|
// Graph Pixel
|
|
struct SurfaceDescription
|
|
{
|
|
half Alpha;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
half _Property_e1f45ea83ade48c986752cc481e9d0ba_Out_0_Float = _Alpha;
|
|
surface.Alpha = _Property_e1f45ea83ade48c986752cc481e9d0ba_Out_0_Float;
|
|
return surface;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Graph Inputs
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#define VFX_SRP_ATTRIBUTES Attributes
|
|
#define VFX_SRP_VARYINGS Varyings
|
|
#define VFX_SRP_SURFACE_INPUTS SurfaceDescriptionInputs
|
|
#endif
|
|
VertexDescriptionInputs BuildVertexDescriptionInputs(Attributes input)
|
|
{
|
|
VertexDescriptionInputs output;
|
|
ZERO_INITIALIZE(VertexDescriptionInputs, output);
|
|
|
|
output.ObjectSpaceNormal = input.normalOS;
|
|
output.ObjectSpaceTangent = input.tangentOS.xyz;
|
|
output.ObjectSpacePosition = input.positionOS;
|
|
|
|
return output;
|
|
}
|
|
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
|
{
|
|
SurfaceDescriptionInputs output;
|
|
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
|
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#if VFX_USE_GRAPH_VALUES
|
|
uint instanceActiveIndex = asuint(UNITY_ACCESS_INSTANCED_PROP(PerInstance, _InstanceActiveIndex));
|
|
/* WARNING: $splice Could not find named fragment 'VFXLoadGraphValues' */
|
|
#endif
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if UNITY_UV_STARTS_AT_TOP
|
|
#else
|
|
#endif
|
|
|
|
|
|
#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;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Main
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/SelectionPickingPass.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Visual Effect Vertex Invocations
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl"
|
|
#endif
|
|
|
|
ENDHLSL
|
|
}
|
|
Pass
|
|
{
|
|
// Name: <None>
|
|
Tags
|
|
{
|
|
"LightMode" = "Universal2D"
|
|
}
|
|
|
|
// Render State
|
|
Cull Back
|
|
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
|
|
ZTest LEqual
|
|
ZWrite Off
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 2.0
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// Keywords
|
|
// PassKeywords: <None>
|
|
// GraphKeywords: <None>
|
|
|
|
// Defines
|
|
|
|
#define _NORMALMAP 1
|
|
#define _NORMAL_DROPOFF_TS 1
|
|
#define ATTRIBUTES_NEED_NORMAL
|
|
#define ATTRIBUTES_NEED_TANGENT
|
|
#define ATTRIBUTES_NEED_TEXCOORD0
|
|
#define VARYINGS_NEED_POSITION_WS
|
|
#define VARYINGS_NEED_TEXCOORD0
|
|
#define FEATURES_GRAPH_VERTEX
|
|
/* WARNING: $splice Could not find named fragment 'PassInstancing' */
|
|
#define SHADERPASS SHADERPASS_2D
|
|
|
|
|
|
// custom interpolator pre-include
|
|
/* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */
|
|
|
|
// 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.universal/ShaderLibrary/Input.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"
|
|
|
|
// --------------------------------------------------
|
|
// Structs and Packing
|
|
|
|
// custom interpolators pre packing
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPrePacking' */
|
|
|
|
struct Attributes
|
|
{
|
|
float3 positionOS : POSITION;
|
|
float3 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
float4 uv0 : TEXCOORD0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : INSTANCEID_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct Varyings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float3 positionWS;
|
|
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 ObjectSpacePosition;
|
|
float4 uv0;
|
|
float3 TimeParameters;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
float3 ObjectSpaceNormal;
|
|
float3 ObjectSpaceTangent;
|
|
float3 ObjectSpacePosition;
|
|
};
|
|
struct PackedVaryings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 texCoord0 : INTERP0;
|
|
float3 positionWS : INTERP1;
|
|
#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;
|
|
output.positionWS.xyz = input.positionWS;
|
|
#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;
|
|
output.positionWS = input.positionWS.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)
|
|
half4 _ColorEdge;
|
|
half4 _ColorBase;
|
|
half _Alpha;
|
|
float4 _Normal_TexelSize;
|
|
float4 _Tile_TexelSize;
|
|
half4 _RimTiling;
|
|
half _Fresnel;
|
|
half _Smoothness;
|
|
CBUFFER_END
|
|
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_Normal);
|
|
SAMPLER(sampler_Normal);
|
|
TEXTURE2D(_Tile);
|
|
SAMPLER(sampler_Tile);
|
|
|
|
// Graph Includes
|
|
// GraphIncludes: <None>
|
|
|
|
// -- Property used by ScenePickingPass
|
|
#ifdef SCENEPICKINGPASS
|
|
float4 _SelectionID;
|
|
#endif
|
|
|
|
// -- Properties used by SceneSelectionPass
|
|
#ifdef SCENESELECTIONPASS
|
|
int _ObjectId;
|
|
int _PassValue;
|
|
#endif
|
|
|
|
// Graph Functions
|
|
|
|
void Unity_Multiply_float2_float2(float2 A, float2 B, out float2 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Divide_half(half A, half B, out half Out)
|
|
{
|
|
Out = A / B;
|
|
}
|
|
|
|
void Unity_Multiply_half2_half2(half2 A, half2 B, out half2 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
void Unity_Add_float2(float2 A, float2 B, out float2 Out)
|
|
{
|
|
Out = A + B;
|
|
}
|
|
|
|
void Unity_Subtract_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A - B;
|
|
}
|
|
|
|
void Unity_Saturate_float4(float4 In, out float4 Out)
|
|
{
|
|
Out = saturate(In);
|
|
}
|
|
|
|
// Custom interpolators pre vertex
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
half3 Position;
|
|
half3 Normal;
|
|
half3 Tangent;
|
|
};
|
|
|
|
VertexDescription VertexDescriptionFunction(VertexDescriptionInputs IN)
|
|
{
|
|
VertexDescription description = (VertexDescription)0;
|
|
description.Position = IN.ObjectSpacePosition;
|
|
description.Normal = IN.ObjectSpaceNormal;
|
|
description.Tangent = IN.ObjectSpaceTangent;
|
|
return description;
|
|
}
|
|
|
|
// Custom interpolators, pre surface
|
|
#ifdef FEATURES_GRAPH_VERTEX
|
|
Varyings CustomInterpolatorPassThroughFunc(inout Varyings output, VertexDescription input)
|
|
{
|
|
return output;
|
|
}
|
|
#define CUSTOMINTERPOLATOR_VARYPASSTHROUGH_FUNC
|
|
#endif
|
|
|
|
// Graph Pixel
|
|
struct SurfaceDescription
|
|
{
|
|
float3 BaseColor;
|
|
half Alpha;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
half4 _Property_0ca28f22f8fc4bb1a920c610ae9ee382_Out_0_Vector4 = _ColorBase;
|
|
UnityTexture2D _Property_9bf12734396842a5a6680213cdd8c6b5_Out_0_Texture2D = UnityBuildTexture2DStructNoScale(_Tile);
|
|
UnityTexture2D _Property_4cd8540b527e4e2aa5b294fc9c81afd1_Out_0_Texture2D = UnityBuildTexture2DStructNoScale(_Normal);
|
|
half4 _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4 = SAMPLE_TEXTURE2D(_Property_4cd8540b527e4e2aa5b294fc9c81afd1_Out_0_Texture2D.tex, _Property_4cd8540b527e4e2aa5b294fc9c81afd1_Out_0_Texture2D.samplerstate, _Property_4cd8540b527e4e2aa5b294fc9c81afd1_Out_0_Texture2D.GetTransformedUV(IN.uv0.xy) );
|
|
_SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.rgb = UnpackNormal(_SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4);
|
|
half _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_R_4_Float = _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.r;
|
|
half _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_G_5_Float = _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.g;
|
|
half _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_B_6_Float = _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.b;
|
|
half _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_A_7_Float = _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_RGBA_0_Vector4.a;
|
|
half2 _Vector2_8e1be6e93aa54bd08ebcdf4ad3fe6788_Out_0_Vector2 = half2(_SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_R_4_Float, _SampleTexture2D_21fec51e0975482eb39b17c378cdbc77_B_6_Float);
|
|
float _Split_dd1bfad4a644483bb3e9191b0b16994a_R_1_Float = IN.ObjectSpacePosition[0];
|
|
float _Split_dd1bfad4a644483bb3e9191b0b16994a_G_2_Float = IN.ObjectSpacePosition[1];
|
|
float _Split_dd1bfad4a644483bb3e9191b0b16994a_B_3_Float = IN.ObjectSpacePosition[2];
|
|
float _Split_dd1bfad4a644483bb3e9191b0b16994a_A_4_Float = 0;
|
|
float2 _Vector2_49487d61b6094bcab7b26db494f2cff5_Out_0_Vector2 = float2(_Split_dd1bfad4a644483bb3e9191b0b16994a_R_1_Float, _Split_dd1bfad4a644483bb3e9191b0b16994a_B_3_Float);
|
|
half4 _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4 = _RimTiling;
|
|
half _Split_63b683ee522c4572b36c77aa0b8c708c_R_1_Float = _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4[0];
|
|
half _Split_63b683ee522c4572b36c77aa0b8c708c_G_2_Float = _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4[1];
|
|
half _Split_63b683ee522c4572b36c77aa0b8c708c_B_3_Float = _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4[2];
|
|
half _Split_63b683ee522c4572b36c77aa0b8c708c_A_4_Float = _Property_46b72b78d66748b5a674cfa6e5be53ec_Out_0_Vector4[3];
|
|
half2 _Vector2_5d63053287d34a23b442f5dec71562ce_Out_0_Vector2 = half2(_Split_63b683ee522c4572b36c77aa0b8c708c_R_1_Float, _Split_63b683ee522c4572b36c77aa0b8c708c_G_2_Float);
|
|
float2 _Multiply_29a974b89bea48419f0701b666cac1d4_Out_2_Vector2;
|
|
Unity_Multiply_float2_float2(_Vector2_49487d61b6094bcab7b26db494f2cff5_Out_0_Vector2, _Vector2_5d63053287d34a23b442f5dec71562ce_Out_0_Vector2, _Multiply_29a974b89bea48419f0701b666cac1d4_Out_2_Vector2);
|
|
half2 _Vector2_aa46889df8a4497089f0e7ae2f732a39_Out_0_Vector2 = half2(_Split_63b683ee522c4572b36c77aa0b8c708c_B_3_Float, _Split_63b683ee522c4572b36c77aa0b8c708c_A_4_Float);
|
|
half _Divide_06649e1447634e8489b60ca968f38135_Out_2_Float;
|
|
Unity_Divide_half(IN.TimeParameters.x, 20, _Divide_06649e1447634e8489b60ca968f38135_Out_2_Float);
|
|
half2 _Multiply_7dc204d8895546979c16e02f295e7fab_Out_2_Vector2;
|
|
Unity_Multiply_half2_half2(_Vector2_aa46889df8a4497089f0e7ae2f732a39_Out_0_Vector2, (_Divide_06649e1447634e8489b60ca968f38135_Out_2_Float.xx), _Multiply_7dc204d8895546979c16e02f295e7fab_Out_2_Vector2);
|
|
float2 _Add_51cb18f375dd4a5d8903182d5c53002b_Out_2_Vector2;
|
|
Unity_Add_float2(_Multiply_29a974b89bea48419f0701b666cac1d4_Out_2_Vector2, _Multiply_7dc204d8895546979c16e02f295e7fab_Out_2_Vector2, _Add_51cb18f375dd4a5d8903182d5c53002b_Out_2_Vector2);
|
|
float2 _Add_1cc8fe13fb4645ebba90a66d61a3f5e6_Out_2_Vector2;
|
|
Unity_Add_float2(_Vector2_8e1be6e93aa54bd08ebcdf4ad3fe6788_Out_0_Vector2, _Add_51cb18f375dd4a5d8903182d5c53002b_Out_2_Vector2, _Add_1cc8fe13fb4645ebba90a66d61a3f5e6_Out_2_Vector2);
|
|
float4 _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4 = SAMPLE_TEXTURE2D(_Property_9bf12734396842a5a6680213cdd8c6b5_Out_0_Texture2D.tex, _Property_9bf12734396842a5a6680213cdd8c6b5_Out_0_Texture2D.samplerstate, _Property_9bf12734396842a5a6680213cdd8c6b5_Out_0_Texture2D.GetTransformedUV(_Add_1cc8fe13fb4645ebba90a66d61a3f5e6_Out_2_Vector2) );
|
|
float _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_R_4_Float = _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4.r;
|
|
float _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_G_5_Float = _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4.g;
|
|
float _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_B_6_Float = _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4.b;
|
|
float _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_A_7_Float = _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4.a;
|
|
float4 _Subtract_984691ad39024b22aa1b8300c057ad32_Out_2_Vector4;
|
|
Unity_Subtract_float4(_Property_0ca28f22f8fc4bb1a920c610ae9ee382_Out_0_Vector4, _SampleTexture2D_9d410f2862754a3298138116ceb20c3d_RGBA_0_Vector4, _Subtract_984691ad39024b22aa1b8300c057ad32_Out_2_Vector4);
|
|
float4 _Saturate_41c1083715d648c2a61405c9fde0a155_Out_1_Vector4;
|
|
Unity_Saturate_float4(_Subtract_984691ad39024b22aa1b8300c057ad32_Out_2_Vector4, _Saturate_41c1083715d648c2a61405c9fde0a155_Out_1_Vector4);
|
|
half _Property_e1f45ea83ade48c986752cc481e9d0ba_Out_0_Float = _Alpha;
|
|
surface.BaseColor = (_Saturate_41c1083715d648c2a61405c9fde0a155_Out_1_Vector4.xyz);
|
|
surface.Alpha = _Property_e1f45ea83ade48c986752cc481e9d0ba_Out_0_Float;
|
|
return surface;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Build Graph Inputs
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#define VFX_SRP_ATTRIBUTES Attributes
|
|
#define VFX_SRP_VARYINGS Varyings
|
|
#define VFX_SRP_SURFACE_INPUTS SurfaceDescriptionInputs
|
|
#endif
|
|
VertexDescriptionInputs BuildVertexDescriptionInputs(Attributes input)
|
|
{
|
|
VertexDescriptionInputs output;
|
|
ZERO_INITIALIZE(VertexDescriptionInputs, output);
|
|
|
|
output.ObjectSpaceNormal = input.normalOS;
|
|
output.ObjectSpaceTangent = input.tangentOS.xyz;
|
|
output.ObjectSpacePosition = input.positionOS;
|
|
|
|
return output;
|
|
}
|
|
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input)
|
|
{
|
|
SurfaceDescriptionInputs output;
|
|
ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
|
|
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#if VFX_USE_GRAPH_VALUES
|
|
uint instanceActiveIndex = asuint(UNITY_ACCESS_INSTANCED_PROP(PerInstance, _InstanceActiveIndex));
|
|
/* WARNING: $splice Could not find named fragment 'VFXLoadGraphValues' */
|
|
#endif
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output.ObjectSpacePosition = TransformWorldToObject(input.positionWS);
|
|
|
|
#if UNITY_UV_STARTS_AT_TOP
|
|
#else
|
|
#endif
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
output.TimeParameters = _TimeParameters.xyz; // This is mainly for LW as HD overwrite this value
|
|
#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;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Main
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/Varyings.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/PBR2DPass.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Visual Effect Vertex Invocations
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl"
|
|
#endif
|
|
|
|
ENDHLSL
|
|
}
|
|
}
|
|
CustomEditor "UnityEditor.ShaderGraph.GenericShaderGraphMaterialGUI"
|
|
CustomEditorForRenderPipeline "UnityEditor.ShaderGraphLitGUI" "UnityEngine.Rendering.Universal.UniversalRenderPipelineAsset"
|
|
FallBack "Hidden/Shader Graph/FallbackError"
|
|
}
|