5578 lines
208 KiB
GLSL
5578 lines
208 KiB
GLSL
// This is a convenience shader for non-avatar objects in the Meta Avatars SDK example scenes. It is provided so that these
|
|
// objects will render with URP and built-in pipeline without further configuration. This shader is only intended to be used
|
|
// in the examples and Meta does not recommend it for any other usage. Once you have decided on a pipeline, you should use
|
|
// the Unity provided standard shaders instead.
|
|
|
|
|
|
Shader "Avatar/ExampleLit"
|
|
{
|
|
Properties
|
|
{
|
|
_Color ("Color", Color) = (1,1,1,1)
|
|
_MainTex ("Albedo (RGB)", 2D) = "white" {}
|
|
_Glossiness ("Smoothness", Range(0,1)) = 0.5
|
|
_Metallic ("Metallic", Range(0,1)) = 0.0
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
PackageRequirements
|
|
{
|
|
"com.unity.render-pipelines.universal" : "10.1.0"
|
|
}
|
|
Tags
|
|
{
|
|
"RenderPipeline"="UniversalPipeline"
|
|
"RenderType"="Opaque"
|
|
"UniversalMaterialType" = "Lit"
|
|
"Queue"="Geometry"
|
|
"ShaderGraphShader"="true"
|
|
"ShaderGraphTargetId"="UniversalLitSubTarget"
|
|
}
|
|
Pass
|
|
{
|
|
Name "Universal Forward"
|
|
Tags
|
|
{
|
|
"LightMode" = "UniversalForward"
|
|
}
|
|
|
|
// Render State
|
|
Cull Back
|
|
Blend One Zero
|
|
ZTest LEqual
|
|
ZWrite On
|
|
|
|
// 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 multi_compile _ DOTS_INSTANCING_ON
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// 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 _ 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 _ _CLUSTERED_RENDERING
|
|
// 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_VIEWDIRECTION_WS
|
|
#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
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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;
|
|
float3 viewDirectionWS;
|
|
#if defined(LIGHTMAP_ON)
|
|
float2 staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
float2 dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
float3 sh;
|
|
#endif
|
|
float4 fogFactorAndVertexLight;
|
|
#if 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 TangentSpaceNormal;
|
|
float4 uv0;
|
|
};
|
|
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;
|
|
float3 viewDirectionWS : INTERP9;
|
|
#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;
|
|
output.viewDirectionWS.xyz = input.viewDirectionWS;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
Varyings UnpackVaryings (PackedVaryings input)
|
|
{
|
|
Varyings output;
|
|
output.positionCS = input.positionCS;
|
|
#if defined(LIGHTMAP_ON)
|
|
output.staticLightmapUV = input.staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
output.dynamicLightmapUV = input.dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
output.sh = input.sh;
|
|
#endif
|
|
#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;
|
|
output.viewDirectionWS = input.viewDirectionWS.xyz;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
|
|
// --------------------------------------------------
|
|
// Graph
|
|
|
|
// Graph Properties
|
|
CBUFFER_START(UnityPerMaterial)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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_float4_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
// Custom interpolators pre vertex
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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;
|
|
float3 NormalTS;
|
|
float3 Emission;
|
|
float Metallic;
|
|
float Smoothness;
|
|
float Occlusion;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
UnityTexture2D _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex);
|
|
float4 _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0 = SAMPLE_TEXTURE2D(_Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.tex, _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.samplerstate, _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_R_4 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.r;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_G_5 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.g;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_B_6 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.b;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_A_7 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.a;
|
|
float4 _Property_172d4d320ea54260a36f5eba1dbc2342_Out_0 = _Color;
|
|
float4 _Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2;
|
|
Unity_Multiply_float4_float4(_SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0, _Property_172d4d320ea54260a36f5eba1dbc2342_Out_0, _Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2);
|
|
float _Property_4075b0c5de614d87976d9c1523a72ca8_Out_0 = _Metallic;
|
|
float _Property_647b6f332638401eaa8278b4f1ebc43b_Out_0 = _Glossiness;
|
|
surface.BaseColor = (_Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2.xyz);
|
|
surface.NormalTS = IN.TangentSpaceNormal;
|
|
surface.Emission = float3(0, 0, 0);
|
|
surface.Metallic = _Property_4075b0c5de614d87976d9c1523a72ca8_Out_0;
|
|
surface.Smoothness = _Property_647b6f332638401eaa8278b4f1ebc43b_Out_0;
|
|
surface.Occlusion = 1;
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
|
#else
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
#endif
|
|
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
|
|
return output;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// 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 One Zero
|
|
ZTest LEqual
|
|
ZWrite On
|
|
|
|
// 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 multi_compile _ DOTS_INSTANCING_ON
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// 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 _ LIGHTMAP_SHADOW_MIXING
|
|
#pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
|
|
#pragma multi_compile _ SHADOWS_SHADOWMASK
|
|
#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
|
|
#pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
|
|
#pragma multi_compile_fragment _ _LIGHT_LAYERS
|
|
#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_VIEWDIRECTION_WS
|
|
#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
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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;
|
|
float3 viewDirectionWS;
|
|
#if defined(LIGHTMAP_ON)
|
|
float2 staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
float2 dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
float3 sh;
|
|
#endif
|
|
float4 fogFactorAndVertexLight;
|
|
#if 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 TangentSpaceNormal;
|
|
float4 uv0;
|
|
};
|
|
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;
|
|
float3 viewDirectionWS : INTERP9;
|
|
#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;
|
|
output.viewDirectionWS.xyz = input.viewDirectionWS;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
Varyings UnpackVaryings (PackedVaryings input)
|
|
{
|
|
Varyings output;
|
|
output.positionCS = input.positionCS;
|
|
#if defined(LIGHTMAP_ON)
|
|
output.staticLightmapUV = input.staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
output.dynamicLightmapUV = input.dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
output.sh = input.sh;
|
|
#endif
|
|
#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;
|
|
output.viewDirectionWS = input.viewDirectionWS.xyz;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
|
|
// --------------------------------------------------
|
|
// Graph
|
|
|
|
// Graph Properties
|
|
CBUFFER_START(UnityPerMaterial)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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_float4_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
// Custom interpolators pre vertex
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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;
|
|
float3 NormalTS;
|
|
float3 Emission;
|
|
float Metallic;
|
|
float Smoothness;
|
|
float Occlusion;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
UnityTexture2D _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex);
|
|
float4 _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0 = SAMPLE_TEXTURE2D(_Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.tex, _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.samplerstate, _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_R_4 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.r;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_G_5 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.g;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_B_6 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.b;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_A_7 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.a;
|
|
float4 _Property_172d4d320ea54260a36f5eba1dbc2342_Out_0 = _Color;
|
|
float4 _Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2;
|
|
Unity_Multiply_float4_float4(_SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0, _Property_172d4d320ea54260a36f5eba1dbc2342_Out_0, _Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2);
|
|
float _Property_4075b0c5de614d87976d9c1523a72ca8_Out_0 = _Metallic;
|
|
float _Property_647b6f332638401eaa8278b4f1ebc43b_Out_0 = _Glossiness;
|
|
surface.BaseColor = (_Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2.xyz);
|
|
surface.NormalTS = IN.TangentSpaceNormal;
|
|
surface.Emission = float3(0, 0, 0);
|
|
surface.Metallic = _Property_4075b0c5de614d87976d9c1523a72ca8_Out_0;
|
|
surface.Smoothness = _Property_647b6f332638401eaa8278b4f1ebc43b_Out_0;
|
|
surface.Occlusion = 1;
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
|
#else
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
#endif
|
|
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
|
|
return output;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// 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 "ShadowCaster"
|
|
Tags
|
|
{
|
|
"LightMode" = "ShadowCaster"
|
|
}
|
|
|
|
// Render State
|
|
Cull Back
|
|
ZTest LEqual
|
|
ZWrite On
|
|
ColorMask 0
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 4.5
|
|
#pragma exclude_renderers gles gles3 glcore
|
|
#pragma multi_compile_instancing
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// Keywords
|
|
#pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
|
|
// GraphKeywords: <None>
|
|
|
|
// Defines
|
|
|
|
#define _NORMALMAP 1
|
|
#define _NORMAL_DROPOFF_TS 1
|
|
#define ATTRIBUTES_NEED_NORMAL
|
|
#define ATTRIBUTES_NEED_TANGENT
|
|
#define VARYINGS_NEED_NORMAL_WS
|
|
#define FEATURES_GRAPH_VERTEX
|
|
/* WARNING: $splice Could not find named fragment 'PassInstancing' */
|
|
#define SHADERPASS SHADERPASS_SHADOWCASTER
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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;
|
|
float3 normalWS;
|
|
#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;
|
|
float3 normalWS : INTERP0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
PackedVaryings PackVaryings (Varyings input)
|
|
{
|
|
PackedVaryings output;
|
|
ZERO_INITIALIZE(PackedVaryings, output);
|
|
output.positionCS = input.positionCS;
|
|
output.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.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)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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
|
|
{
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#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/ShadowCasterPass.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Visual Effect Vertex Invocations
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl"
|
|
#endif
|
|
|
|
ENDHLSL
|
|
}
|
|
Pass
|
|
{
|
|
Name "DepthOnly"
|
|
Tags
|
|
{
|
|
"LightMode" = "DepthOnly"
|
|
}
|
|
|
|
// Render State
|
|
Cull Back
|
|
ZTest LEqual
|
|
ZWrite On
|
|
ColorMask 0
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 4.5
|
|
#pragma exclude_renderers gles gles3 glcore
|
|
#pragma multi_compile_instancing
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// 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
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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
|
|
{
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#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/DepthOnlyPass.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 4.5
|
|
#pragma exclude_renderers gles gles3 glcore
|
|
#pragma multi_compile_instancing
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// 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
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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 NormalTS;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
surface.NormalTS = IN.TangentSpaceNormal;
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
|
|
|
|
|
|
#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 4.5
|
|
#pragma exclude_renderers gles gles3 glcore
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// 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_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
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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;
|
|
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
|
|
{
|
|
float4 uv0;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
float3 ObjectSpaceNormal;
|
|
float3 ObjectSpaceTangent;
|
|
float3 ObjectSpacePosition;
|
|
};
|
|
struct PackedVaryings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 texCoord0 : INTERP0;
|
|
float4 texCoord1 : INTERP1;
|
|
float4 texCoord2 : INTERP2;
|
|
#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;
|
|
#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;
|
|
#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)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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_float4_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
// Custom interpolators pre vertex
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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;
|
|
float3 Emission;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
UnityTexture2D _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex);
|
|
float4 _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0 = SAMPLE_TEXTURE2D(_Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.tex, _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.samplerstate, _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_R_4 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.r;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_G_5 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.g;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_B_6 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.b;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_A_7 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.a;
|
|
float4 _Property_172d4d320ea54260a36f5eba1dbc2342_Out_0 = _Color;
|
|
float4 _Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2;
|
|
Unity_Multiply_float4_float4(_SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0, _Property_172d4d320ea54260a36f5eba1dbc2342_Out_0, _Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2);
|
|
surface.BaseColor = (_Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2.xyz);
|
|
surface.Emission = float3(0, 0, 0);
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
|
#else
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
#endif
|
|
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
|
|
return output;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// 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 4.5
|
|
#pragma exclude_renderers gles gles3 glcore
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// 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
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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
|
|
{
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#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 4.5
|
|
#pragma exclude_renderers gles gles3 glcore
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// 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
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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
|
|
{
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#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 One Zero
|
|
ZTest LEqual
|
|
ZWrite On
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 4.5
|
|
#pragma exclude_renderers gles gles3 glcore
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// 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_TEXCOORD0
|
|
#define FEATURES_GRAPH_VERTEX
|
|
/* WARNING: $splice Could not find named fragment 'PassInstancing' */
|
|
#define SHADERPASS SHADERPASS_2D
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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;
|
|
float4 texCoord0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct SurfaceDescriptionInputs
|
|
{
|
|
float4 uv0;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
float3 ObjectSpaceNormal;
|
|
float3 ObjectSpaceTangent;
|
|
float3 ObjectSpacePosition;
|
|
};
|
|
struct PackedVaryings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 texCoord0 : INTERP0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
PackedVaryings PackVaryings (Varyings input)
|
|
{
|
|
PackedVaryings output;
|
|
ZERO_INITIALIZE(PackedVaryings, output);
|
|
output.positionCS = input.positionCS;
|
|
output.texCoord0.xyzw = input.texCoord0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
Varyings UnpackVaryings (PackedVaryings input)
|
|
{
|
|
Varyings output;
|
|
output.positionCS = input.positionCS;
|
|
output.texCoord0 = input.texCoord0.xyzw;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
|
|
// --------------------------------------------------
|
|
// Graph
|
|
|
|
// Graph Properties
|
|
CBUFFER_START(UnityPerMaterial)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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_float4_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
// Custom interpolators pre vertex
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
UnityTexture2D _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex);
|
|
float4 _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0 = SAMPLE_TEXTURE2D(_Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.tex, _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.samplerstate, _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_R_4 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.r;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_G_5 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.g;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_B_6 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.b;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_A_7 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.a;
|
|
float4 _Property_172d4d320ea54260a36f5eba1dbc2342_Out_0 = _Color;
|
|
float4 _Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2;
|
|
Unity_Multiply_float4_float4(_SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0, _Property_172d4d320ea54260a36f5eba1dbc2342_Out_0, _Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2);
|
|
surface.BaseColor = (_Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2.xyz);
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
|
#else
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
#endif
|
|
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
|
|
return output;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// 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
|
|
}
|
|
}
|
|
SubShader
|
|
{
|
|
PackageRequirements
|
|
{
|
|
"com.unity.render-pipelines.universal" : "10.1.0"
|
|
}
|
|
Tags
|
|
{
|
|
"RenderPipeline"="UniversalPipeline"
|
|
"RenderType"="Opaque"
|
|
"UniversalMaterialType" = "Lit"
|
|
"Queue"="Geometry"
|
|
"ShaderGraphShader"="true"
|
|
"ShaderGraphTargetId"="UniversalLitSubTarget"
|
|
}
|
|
Pass
|
|
{
|
|
Name "Universal Forward"
|
|
Tags
|
|
{
|
|
"LightMode" = "UniversalForward"
|
|
}
|
|
|
|
// Render State
|
|
Cull Back
|
|
Blend One Zero
|
|
ZTest LEqual
|
|
ZWrite On
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 2.0
|
|
#pragma only_renderers gles gles3 glcore d3d11
|
|
#pragma multi_compile_instancing
|
|
#pragma multi_compile_fog
|
|
#pragma instancing_options renderinglayer
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// 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 _ 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 _ _CLUSTERED_RENDERING
|
|
// 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_VIEWDIRECTION_WS
|
|
#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
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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;
|
|
float3 viewDirectionWS;
|
|
#if defined(LIGHTMAP_ON)
|
|
float2 staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
float2 dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
float3 sh;
|
|
#endif
|
|
float4 fogFactorAndVertexLight;
|
|
#if 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 TangentSpaceNormal;
|
|
float4 uv0;
|
|
};
|
|
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;
|
|
float3 viewDirectionWS : INTERP9;
|
|
#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;
|
|
output.viewDirectionWS.xyz = input.viewDirectionWS;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
Varyings UnpackVaryings (PackedVaryings input)
|
|
{
|
|
Varyings output;
|
|
output.positionCS = input.positionCS;
|
|
#if defined(LIGHTMAP_ON)
|
|
output.staticLightmapUV = input.staticLightmapUV;
|
|
#endif
|
|
#if defined(DYNAMICLIGHTMAP_ON)
|
|
output.dynamicLightmapUV = input.dynamicLightmapUV;
|
|
#endif
|
|
#if !defined(LIGHTMAP_ON)
|
|
output.sh = input.sh;
|
|
#endif
|
|
#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;
|
|
output.viewDirectionWS = input.viewDirectionWS.xyz;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
|
|
// --------------------------------------------------
|
|
// Graph
|
|
|
|
// Graph Properties
|
|
CBUFFER_START(UnityPerMaterial)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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_float4_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
// Custom interpolators pre vertex
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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;
|
|
float3 NormalTS;
|
|
float3 Emission;
|
|
float Metallic;
|
|
float Smoothness;
|
|
float Occlusion;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
UnityTexture2D _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex);
|
|
float4 _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0 = SAMPLE_TEXTURE2D(_Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.tex, _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.samplerstate, _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_R_4 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.r;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_G_5 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.g;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_B_6 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.b;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_A_7 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.a;
|
|
float4 _Property_172d4d320ea54260a36f5eba1dbc2342_Out_0 = _Color;
|
|
float4 _Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2;
|
|
Unity_Multiply_float4_float4(_SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0, _Property_172d4d320ea54260a36f5eba1dbc2342_Out_0, _Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2);
|
|
float _Property_4075b0c5de614d87976d9c1523a72ca8_Out_0 = _Metallic;
|
|
float _Property_647b6f332638401eaa8278b4f1ebc43b_Out_0 = _Glossiness;
|
|
surface.BaseColor = (_Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2.xyz);
|
|
surface.NormalTS = IN.TangentSpaceNormal;
|
|
surface.Emission = float3(0, 0, 0);
|
|
surface.Metallic = _Property_4075b0c5de614d87976d9c1523a72ca8_Out_0;
|
|
surface.Smoothness = _Property_647b6f332638401eaa8278b4f1ebc43b_Out_0;
|
|
surface.Occlusion = 1;
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
|
#else
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
#endif
|
|
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
|
|
return output;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// 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 "ShadowCaster"
|
|
Tags
|
|
{
|
|
"LightMode" = "ShadowCaster"
|
|
}
|
|
|
|
// Render State
|
|
Cull Back
|
|
ZTest LEqual
|
|
ZWrite On
|
|
ColorMask 0
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 2.0
|
|
#pragma only_renderers gles gles3 glcore d3d11
|
|
#pragma multi_compile_instancing
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// Keywords
|
|
#pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
|
|
// GraphKeywords: <None>
|
|
|
|
// Defines
|
|
|
|
#define _NORMALMAP 1
|
|
#define _NORMAL_DROPOFF_TS 1
|
|
#define ATTRIBUTES_NEED_NORMAL
|
|
#define ATTRIBUTES_NEED_TANGENT
|
|
#define VARYINGS_NEED_NORMAL_WS
|
|
#define FEATURES_GRAPH_VERTEX
|
|
/* WARNING: $splice Could not find named fragment 'PassInstancing' */
|
|
#define SHADERPASS SHADERPASS_SHADOWCASTER
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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;
|
|
float3 normalWS;
|
|
#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;
|
|
float3 normalWS : INTERP0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
PackedVaryings PackVaryings (Varyings input)
|
|
{
|
|
PackedVaryings output;
|
|
ZERO_INITIALIZE(PackedVaryings, output);
|
|
output.positionCS = input.positionCS;
|
|
output.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.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)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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
|
|
{
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#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/ShadowCasterPass.hlsl"
|
|
|
|
// --------------------------------------------------
|
|
// Visual Effect Vertex Invocations
|
|
#ifdef HAVE_VFX_MODIFICATION
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/VisualEffectVertex.hlsl"
|
|
#endif
|
|
|
|
ENDHLSL
|
|
}
|
|
Pass
|
|
{
|
|
Name "DepthOnly"
|
|
Tags
|
|
{
|
|
"LightMode" = "DepthOnly"
|
|
}
|
|
|
|
// Render State
|
|
Cull Back
|
|
ZTest LEqual
|
|
ZWrite On
|
|
ColorMask 0
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 2.0
|
|
#pragma only_renderers gles gles3 glcore d3d11
|
|
#pragma multi_compile_instancing
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// 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
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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
|
|
{
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#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/DepthOnlyPass.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 only_renderers gles gles3 glcore d3d11
|
|
#pragma multi_compile_instancing
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// 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
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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 NormalTS;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
surface.NormalTS = IN.TangentSpaceNormal;
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
output.TangentSpaceNormal = float3(0.0f, 0.0f, 1.0f);
|
|
|
|
|
|
#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 only_renderers gles gles3 glcore d3d11
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// 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_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
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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;
|
|
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
|
|
{
|
|
float4 uv0;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
float3 ObjectSpaceNormal;
|
|
float3 ObjectSpaceTangent;
|
|
float3 ObjectSpacePosition;
|
|
};
|
|
struct PackedVaryings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 texCoord0 : INTERP0;
|
|
float4 texCoord1 : INTERP1;
|
|
float4 texCoord2 : INTERP2;
|
|
#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;
|
|
#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;
|
|
#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)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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_float4_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
// Custom interpolators pre vertex
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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;
|
|
float3 Emission;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
UnityTexture2D _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex);
|
|
float4 _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0 = SAMPLE_TEXTURE2D(_Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.tex, _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.samplerstate, _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_R_4 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.r;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_G_5 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.g;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_B_6 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.b;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_A_7 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.a;
|
|
float4 _Property_172d4d320ea54260a36f5eba1dbc2342_Out_0 = _Color;
|
|
float4 _Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2;
|
|
Unity_Multiply_float4_float4(_SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0, _Property_172d4d320ea54260a36f5eba1dbc2342_Out_0, _Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2);
|
|
surface.BaseColor = (_Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2.xyz);
|
|
surface.Emission = float3(0, 0, 0);
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
|
#else
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
#endif
|
|
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
|
|
return output;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// 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 only_renderers gles gles3 glcore d3d11
|
|
#pragma multi_compile_instancing
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// 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
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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
|
|
{
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#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 only_renderers gles gles3 glcore d3d11
|
|
#pragma multi_compile_instancing
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// 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
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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
|
|
{
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#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 One Zero
|
|
ZTest LEqual
|
|
ZWrite On
|
|
|
|
// Debug
|
|
// <None>
|
|
|
|
// --------------------------------------------------
|
|
// Pass
|
|
|
|
HLSLPROGRAM
|
|
|
|
// Pragmas
|
|
#pragma target 2.0
|
|
#pragma only_renderers gles gles3 glcore d3d11
|
|
#pragma multi_compile_instancing
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
// DotsInstancingOptions: <None>
|
|
// HybridV1InjectedBuiltinProperties: <None>
|
|
|
|
// 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_TEXCOORD0
|
|
#define FEATURES_GRAPH_VERTEX
|
|
/* WARNING: $splice Could not find named fragment 'PassInstancing' */
|
|
#define SHADERPASS SHADERPASS_2D
|
|
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
|
|
|
|
|
|
// 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.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;
|
|
float4 texCoord0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
struct SurfaceDescriptionInputs
|
|
{
|
|
float4 uv0;
|
|
};
|
|
struct VertexDescriptionInputs
|
|
{
|
|
float3 ObjectSpaceNormal;
|
|
float3 ObjectSpaceTangent;
|
|
float3 ObjectSpacePosition;
|
|
};
|
|
struct PackedVaryings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float4 texCoord0 : INTERP0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
uint instanceID : CUSTOM_INSTANCE_ID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
|
|
#endif
|
|
};
|
|
|
|
PackedVaryings PackVaryings (Varyings input)
|
|
{
|
|
PackedVaryings output;
|
|
ZERO_INITIALIZE(PackedVaryings, output);
|
|
output.positionCS = input.positionCS;
|
|
output.texCoord0.xyzw = input.texCoord0;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
Varyings UnpackVaryings (PackedVaryings input)
|
|
{
|
|
Varyings output;
|
|
output.positionCS = input.positionCS;
|
|
output.texCoord0 = input.texCoord0.xyzw;
|
|
#if UNITY_ANY_INSTANCING_ENABLED
|
|
output.instanceID = input.instanceID;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
|
|
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
|
|
#endif
|
|
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
|
|
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
|
|
#endif
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
output.cullFace = input.cullFace;
|
|
#endif
|
|
return output;
|
|
}
|
|
|
|
|
|
// --------------------------------------------------
|
|
// Graph
|
|
|
|
// Graph Properties
|
|
CBUFFER_START(UnityPerMaterial)
|
|
float _Glossiness;
|
|
float4 _Color;
|
|
float _Metallic;
|
|
float4 _MainTex_TexelSize;
|
|
CBUFFER_END
|
|
|
|
// Object and Global properties
|
|
SAMPLER(SamplerState_Linear_Repeat);
|
|
TEXTURE2D(_MainTex);
|
|
SAMPLER(sampler_MainTex);
|
|
|
|
// 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_float4_float4(float4 A, float4 B, out float4 Out)
|
|
{
|
|
Out = A * B;
|
|
}
|
|
|
|
// Custom interpolators pre vertex
|
|
/* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */
|
|
|
|
// Graph Vertex
|
|
struct VertexDescription
|
|
{
|
|
float3 Position;
|
|
float3 Normal;
|
|
float3 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;
|
|
};
|
|
|
|
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
|
|
{
|
|
SurfaceDescription surface = (SurfaceDescription)0;
|
|
UnityTexture2D _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex);
|
|
float4 _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0 = SAMPLE_TEXTURE2D(_Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.tex, _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.samplerstate, _Property_f74e82aa1b5e47a7b90c8b280cdcde78_Out_0.GetTransformedUV(IN.uv0.xy));
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_R_4 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.r;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_G_5 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.g;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_B_6 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.b;
|
|
float _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_A_7 = _SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0.a;
|
|
float4 _Property_172d4d320ea54260a36f5eba1dbc2342_Out_0 = _Color;
|
|
float4 _Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2;
|
|
Unity_Multiply_float4_float4(_SampleTexture2D_824c07f5036647e4806452b959a2d1f6_RGBA_0, _Property_172d4d320ea54260a36f5eba1dbc2342_Out_0, _Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2);
|
|
surface.BaseColor = (_Multiply_e7da41438eb142b3a3241acbcbeaf316_Out_2.xyz);
|
|
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
|
|
// FragInputs from VFX come from two places: Interpolator or CBuffer.
|
|
/* WARNING: $splice Could not find named fragment 'VFXSetFragInputs' */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output.uv0 = input.texCoord0;
|
|
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
|
|
#else
|
|
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
#endif
|
|
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
|
|
|
|
return output;
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// 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
|
|
}
|
|
}
|
|
SubShader
|
|
{
|
|
Tags { "RenderType"="Opaque" }
|
|
LOD 200
|
|
|
|
CGPROGRAM
|
|
// Physically based Standard lighting model, and enable shadows on all light types
|
|
#pragma surface surf Standard fullforwardshadows
|
|
|
|
// Use shader model 3.0 target, to get nicer looking lighting
|
|
#pragma target 3.0
|
|
|
|
sampler2D _MainTex;
|
|
|
|
struct Input
|
|
{
|
|
float2 uv_MainTex;
|
|
};
|
|
|
|
half _Glossiness;
|
|
half _Metallic;
|
|
fixed4 _Color;
|
|
|
|
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
|
|
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
|
|
// #pragma instancing_options assumeuniformscaling
|
|
UNITY_INSTANCING_BUFFER_START(Props)
|
|
// put more per-instance properties here
|
|
UNITY_INSTANCING_BUFFER_END(Props)
|
|
|
|
void surf (Input IN, inout SurfaceOutputStandard o)
|
|
{
|
|
// Albedo comes from a texture tinted by color
|
|
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
|
|
o.Albedo = c.rgb;
|
|
// Metallic and smoothness come from slider variables
|
|
o.Metallic = _Metallic;
|
|
o.Smoothness = _Glossiness;
|
|
o.Alpha = c.a;
|
|
}
|
|
ENDCG
|
|
}
|
|
FallBack "Diffuse"
|
|
}
|