Files
Caleb Sandford deQuincey 715fb68744 Initial commitment
2025-06-25 11:10:11 +01:00

1600 lines
67 KiB
GLSL

Shader "Fire Shader"
{
Properties
{
[NoScaleOffset]_MainTex("_MainTex", 2D) = "white" {}
_MaxFrames("MaxFrames", Float) = 5
_FPS("FPS", Float) = 18
[HideInInspector]_BUILTIN_QueueOffset("Float", Float) = 0
[HideInInspector]_BUILTIN_QueueControl("Float", Float) = -1
}
SubShader
{
Tags
{
// RenderPipeline: <None>
"RenderType"="Transparent"
"BuiltInMaterialType" = "Unlit"
"Queue"="Transparent"
"ShaderGraphShader"="true"
"ShaderGraphTargetId"="BuiltInUnlitSubTarget"
}
Pass
{
Name "Pass"
Tags
{
"LightMode" = "ForwardBase"
}
// Render State
Cull Back
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
ZTest LEqual
ZWrite Off
ColorMask RGB
// Debug
// <None>
// --------------------------------------------------
// Pass
HLSLPROGRAM
// Pragmas
#pragma target 3.0
#pragma multi_compile_instancing
#pragma multi_compile_fog
#pragma multi_compile_fwdbase
#pragma vertex vert
#pragma fragment frag
// DotsInstancingOptions: <None>
// HybridV1InjectedBuiltinProperties: <None>
// Keywords
// PassKeywords: <None>
// GraphKeywords: <None>
// Defines
#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_UNLIT
#define BUILTIN_TARGET_API 1
#define _BUILTIN_SURFACE_TYPE_TRANSPARENT 1
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
#ifdef _BUILTIN_SURFACE_TYPE_TRANSPARENT
#define _SURFACE_TYPE_TRANSPARENT _BUILTIN_SURFACE_TYPE_TRANSPARENT
#endif
#ifdef _BUILTIN_ALPHATEST_ON
#define _ALPHATEST_ON _BUILTIN_ALPHATEST_ON
#endif
#ifdef _BUILTIN_AlphaClip
#define _AlphaClip _BUILTIN_AlphaClip
#endif
#ifdef _BUILTIN_ALPHAPREMULTIPLY_ON
#define _ALPHAPREMULTIPLY_ON _BUILTIN_ALPHAPREMULTIPLY_ON
#endif
// custom interpolator pre-include
/* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */
// Includes
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/Shims.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/LegacySurfaceVertex.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/ShaderGraphFunctions.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;
float3 TimeParameters;
};
struct VertexDescriptionInputs
{
float3 ObjectSpaceNormal;
float3 ObjectSpaceTangent;
float3 ObjectSpacePosition;
};
struct PackedVaryings
{
float4 positionCS : SV_POSITION;
float4 interp0 : 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.interp0.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.interp0.xyzw;
#if UNITY_ANY_INSTANCING_ENABLED
output.instanceID = input.instanceID;
#endif
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
#endif
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
#endif
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
output.cullFace = input.cullFace;
#endif
return output;
}
// --------------------------------------------------
// Graph
// Graph Properties
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_TexelSize;
float _MaxFrames;
float _FPS;
CBUFFER_END
// Object and Global properties
SAMPLER(SamplerState_Linear_Repeat);
TEXTURE2D(_MainTex);
SAMPLER(sampler_MainTex);
// -- Property used by ScenePickingPass
#ifdef SCENEPICKINGPASS
float4 _SelectionID;
#endif
// -- Properties used by SceneSelectionPass
#ifdef SCENESELECTIONPASS
int _ObjectId;
int _PassValue;
#endif
// Graph Includes
// GraphIncludes: <None>
// Graph Functions
void Unity_Multiply_float_float(float A, float B, out float Out)
{
Out = A * B;
}
void Unity_Modulo_float(float A, float B, out float Out)
{
Out = fmod(A, B);
}
void Unity_Floor_float(float In, out float Out)
{
Out = floor(In);
}
void Unity_Flipbook_InvertXY_float (float2 UV, float Width, float Height, float Tile, float2 Invert, out float2 Out)
{
Tile = floor(fmod(Tile + float(0.00001), Width*Height));
float2 tileCount = float2(1.0, 1.0) / float2(Width, Height);
float tileX = (Invert.x * Width - ((Tile - Width * floor(Tile * tileCount.x)) + Invert.x * 1));
float tileY = (Invert.y * Height - (floor(Tile * tileCount.x) + Invert.y * 1));
Out = (UV + float2(tileX, tileY)) * tileCount;
}
// 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;
float Alpha;
};
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
{
SurfaceDescription surface = (SurfaceDescription)0;
UnityTexture2D _Property_8622bed71452496ab7aeb9dea24d42b5_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex);
float _Property_54d31d31bf63447cb40b4793ffbf1e60_Out_0 = _FPS;
float _Multiply_05f2fdcf8e83430ab1e4b927b4c19717_Out_2;
Unity_Multiply_float_float(IN.TimeParameters.x, _Property_54d31d31bf63447cb40b4793ffbf1e60_Out_0, _Multiply_05f2fdcf8e83430ab1e4b927b4c19717_Out_2);
float _Property_925bfba4e47e47b6a6c5262dcc4e8fe2_Out_0 = _MaxFrames;
float _Modulo_cdf955c54d454d49ae81ebdf4270fb56_Out_2;
Unity_Modulo_float(_Multiply_05f2fdcf8e83430ab1e4b927b4c19717_Out_2, _Property_925bfba4e47e47b6a6c5262dcc4e8fe2_Out_0, _Modulo_cdf955c54d454d49ae81ebdf4270fb56_Out_2);
float _Floor_28f406a829e84199aeba15d2eebb8823_Out_1;
Unity_Floor_float(_Modulo_cdf955c54d454d49ae81ebdf4270fb56_Out_2, _Floor_28f406a829e84199aeba15d2eebb8823_Out_1);
float2 _Flipbook_c1ccd2165c97414f928a556db7527f16_Out_4;
float2 _Flipbook_c1ccd2165c97414f928a556db7527f16_Invert = float2 (1, 1);
Unity_Flipbook_InvertXY_float(IN.uv0.xy, 5, 1, _Floor_28f406a829e84199aeba15d2eebb8823_Out_1, _Flipbook_c1ccd2165c97414f928a556db7527f16_Invert, _Flipbook_c1ccd2165c97414f928a556db7527f16_Out_4);
float4 _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0 = SAMPLE_TEXTURE2D(_Property_8622bed71452496ab7aeb9dea24d42b5_Out_0.tex, _Property_8622bed71452496ab7aeb9dea24d42b5_Out_0.samplerstate, _Property_8622bed71452496ab7aeb9dea24d42b5_Out_0.GetTransformedUV(_Flipbook_c1ccd2165c97414f928a556db7527f16_Out_4));
float _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_R_4 = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.r;
float _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_G_5 = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.g;
float _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_B_6 = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.b;
float _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_A_7 = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.a;
surface.BaseColor = (_SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.xyz);
surface.Alpha = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_A_7;
return surface;
}
// --------------------------------------------------
// Build Graph Inputs
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);
output.uv0 = input.texCoord0;
output.TimeParameters = _TimeParameters.xyz; // This is mainly for LW as HD overwrite this value
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
#else
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
#endif
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
return output;
}
void BuildAppDataFull(Attributes attributes, VertexDescription vertexDescription, inout appdata_full result)
{
result.vertex = float4(attributes.positionOS, 1);
result.tangent = attributes.tangentOS;
result.normal = attributes.normalOS;
result.texcoord = attributes.uv0;
result.vertex = float4(vertexDescription.Position, 1);
result.normal = vertexDescription.Normal;
result.tangent = float4(vertexDescription.Tangent, 0);
#if UNITY_ANY_INSTANCING_ENABLED
#endif
}
void VaryingsToSurfaceVertex(Varyings varyings, inout v2f_surf result)
{
result.pos = varyings.positionCS;
// World Tangent isn't an available input on v2f_surf
#if UNITY_ANY_INSTANCING_ENABLED
#endif
#if !defined(LIGHTMAP_ON)
#if UNITY_SHOULD_SAMPLE_SH
#endif
#endif
#if defined(LIGHTMAP_ON)
#endif
#ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
result.fogCoord = varyings.fogFactorAndVertexLight.x;
COPY_TO_LIGHT_COORDS(result, varyings.fogFactorAndVertexLight.yzw);
#endif
DEFAULT_UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(varyings, result);
}
void SurfaceVertexToVaryings(v2f_surf surfVertex, inout Varyings result)
{
result.positionCS = surfVertex.pos;
// viewDirectionWS is never filled out in the legacy pass' function. Always use the value computed by SRP
// World Tangent isn't an available input on v2f_surf
#if UNITY_ANY_INSTANCING_ENABLED
#endif
#if !defined(LIGHTMAP_ON)
#if UNITY_SHOULD_SAMPLE_SH
#endif
#endif
#if defined(LIGHTMAP_ON)
#endif
#ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
result.fogFactorAndVertexLight.x = surfVertex.fogCoord;
COPY_FROM_LIGHT_COORDS(result.fogFactorAndVertexLight.yzw, surfVertex);
#endif
DEFAULT_UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(surfVertex, result);
}
// --------------------------------------------------
// Main
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/Varyings.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/UnlitPass.hlsl"
ENDHLSL
}
Pass
{
Name "ShadowCaster"
Tags
{
"LightMode" = "ShadowCaster"
}
// Render State
Cull Back
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
ZTest LEqual
ZWrite On
ColorMask 0
// Debug
// <None>
// --------------------------------------------------
// Pass
HLSLPROGRAM
// Pragmas
#pragma target 3.0
#pragma multi_compile_shadowcaster
#pragma vertex vert
#pragma fragment frag
// DotsInstancingOptions: <None>
// HybridV1InjectedBuiltinProperties: <None>
// Keywords
#pragma multi_compile _ _CASTING_PUNCTUAL_LIGHT_SHADOW
// GraphKeywords: <None>
// Defines
#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_SHADOWCASTER
#define BUILTIN_TARGET_API 1
#define _BUILTIN_SURFACE_TYPE_TRANSPARENT 1
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
#ifdef _BUILTIN_SURFACE_TYPE_TRANSPARENT
#define _SURFACE_TYPE_TRANSPARENT _BUILTIN_SURFACE_TYPE_TRANSPARENT
#endif
#ifdef _BUILTIN_ALPHATEST_ON
#define _ALPHATEST_ON _BUILTIN_ALPHATEST_ON
#endif
#ifdef _BUILTIN_AlphaClip
#define _AlphaClip _BUILTIN_AlphaClip
#endif
#ifdef _BUILTIN_ALPHAPREMULTIPLY_ON
#define _ALPHAPREMULTIPLY_ON _BUILTIN_ALPHAPREMULTIPLY_ON
#endif
// custom interpolator pre-include
/* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */
// Includes
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/Shims.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/LegacySurfaceVertex.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/ShaderGraphFunctions.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;
float3 TimeParameters;
};
struct VertexDescriptionInputs
{
float3 ObjectSpaceNormal;
float3 ObjectSpaceTangent;
float3 ObjectSpacePosition;
};
struct PackedVaryings
{
float4 positionCS : SV_POSITION;
float4 interp0 : 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.interp0.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.interp0.xyzw;
#if UNITY_ANY_INSTANCING_ENABLED
output.instanceID = input.instanceID;
#endif
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
#endif
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
#endif
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
output.cullFace = input.cullFace;
#endif
return output;
}
// --------------------------------------------------
// Graph
// Graph Properties
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_TexelSize;
float _MaxFrames;
float _FPS;
CBUFFER_END
// Object and Global properties
SAMPLER(SamplerState_Linear_Repeat);
TEXTURE2D(_MainTex);
SAMPLER(sampler_MainTex);
// -- Property used by ScenePickingPass
#ifdef SCENEPICKINGPASS
float4 _SelectionID;
#endif
// -- Properties used by SceneSelectionPass
#ifdef SCENESELECTIONPASS
int _ObjectId;
int _PassValue;
#endif
// Graph Includes
// GraphIncludes: <None>
// Graph Functions
void Unity_Multiply_float_float(float A, float B, out float Out)
{
Out = A * B;
}
void Unity_Modulo_float(float A, float B, out float Out)
{
Out = fmod(A, B);
}
void Unity_Floor_float(float In, out float Out)
{
Out = floor(In);
}
void Unity_Flipbook_InvertXY_float (float2 UV, float Width, float Height, float Tile, float2 Invert, out float2 Out)
{
Tile = floor(fmod(Tile + float(0.00001), Width*Height));
float2 tileCount = float2(1.0, 1.0) / float2(Width, Height);
float tileX = (Invert.x * Width - ((Tile - Width * floor(Tile * tileCount.x)) + Invert.x * 1));
float tileY = (Invert.y * Height - (floor(Tile * tileCount.x) + Invert.y * 1));
Out = (UV + float2(tileX, tileY)) * tileCount;
}
// 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
{
float Alpha;
};
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
{
SurfaceDescription surface = (SurfaceDescription)0;
UnityTexture2D _Property_8622bed71452496ab7aeb9dea24d42b5_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex);
float _Property_54d31d31bf63447cb40b4793ffbf1e60_Out_0 = _FPS;
float _Multiply_05f2fdcf8e83430ab1e4b927b4c19717_Out_2;
Unity_Multiply_float_float(IN.TimeParameters.x, _Property_54d31d31bf63447cb40b4793ffbf1e60_Out_0, _Multiply_05f2fdcf8e83430ab1e4b927b4c19717_Out_2);
float _Property_925bfba4e47e47b6a6c5262dcc4e8fe2_Out_0 = _MaxFrames;
float _Modulo_cdf955c54d454d49ae81ebdf4270fb56_Out_2;
Unity_Modulo_float(_Multiply_05f2fdcf8e83430ab1e4b927b4c19717_Out_2, _Property_925bfba4e47e47b6a6c5262dcc4e8fe2_Out_0, _Modulo_cdf955c54d454d49ae81ebdf4270fb56_Out_2);
float _Floor_28f406a829e84199aeba15d2eebb8823_Out_1;
Unity_Floor_float(_Modulo_cdf955c54d454d49ae81ebdf4270fb56_Out_2, _Floor_28f406a829e84199aeba15d2eebb8823_Out_1);
float2 _Flipbook_c1ccd2165c97414f928a556db7527f16_Out_4;
float2 _Flipbook_c1ccd2165c97414f928a556db7527f16_Invert = float2 (1, 1);
Unity_Flipbook_InvertXY_float(IN.uv0.xy, 5, 1, _Floor_28f406a829e84199aeba15d2eebb8823_Out_1, _Flipbook_c1ccd2165c97414f928a556db7527f16_Invert, _Flipbook_c1ccd2165c97414f928a556db7527f16_Out_4);
float4 _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0 = SAMPLE_TEXTURE2D(_Property_8622bed71452496ab7aeb9dea24d42b5_Out_0.tex, _Property_8622bed71452496ab7aeb9dea24d42b5_Out_0.samplerstate, _Property_8622bed71452496ab7aeb9dea24d42b5_Out_0.GetTransformedUV(_Flipbook_c1ccd2165c97414f928a556db7527f16_Out_4));
float _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_R_4 = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.r;
float _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_G_5 = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.g;
float _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_B_6 = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.b;
float _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_A_7 = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.a;
surface.Alpha = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_A_7;
return surface;
}
// --------------------------------------------------
// Build Graph Inputs
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);
output.uv0 = input.texCoord0;
output.TimeParameters = _TimeParameters.xyz; // This is mainly for LW as HD overwrite this value
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
#else
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
#endif
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
return output;
}
void BuildAppDataFull(Attributes attributes, VertexDescription vertexDescription, inout appdata_full result)
{
result.vertex = float4(attributes.positionOS, 1);
result.tangent = attributes.tangentOS;
result.normal = attributes.normalOS;
result.texcoord = attributes.uv0;
result.vertex = float4(vertexDescription.Position, 1);
result.normal = vertexDescription.Normal;
result.tangent = float4(vertexDescription.Tangent, 0);
#if UNITY_ANY_INSTANCING_ENABLED
#endif
}
void VaryingsToSurfaceVertex(Varyings varyings, inout v2f_surf result)
{
result.pos = varyings.positionCS;
// World Tangent isn't an available input on v2f_surf
#if UNITY_ANY_INSTANCING_ENABLED
#endif
#if !defined(LIGHTMAP_ON)
#if UNITY_SHOULD_SAMPLE_SH
#endif
#endif
#if defined(LIGHTMAP_ON)
#endif
#ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
result.fogCoord = varyings.fogFactorAndVertexLight.x;
COPY_TO_LIGHT_COORDS(result, varyings.fogFactorAndVertexLight.yzw);
#endif
DEFAULT_UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(varyings, result);
}
void SurfaceVertexToVaryings(v2f_surf surfVertex, inout Varyings result)
{
result.positionCS = surfVertex.pos;
// viewDirectionWS is never filled out in the legacy pass' function. Always use the value computed by SRP
// World Tangent isn't an available input on v2f_surf
#if UNITY_ANY_INSTANCING_ENABLED
#endif
#if !defined(LIGHTMAP_ON)
#if UNITY_SHOULD_SAMPLE_SH
#endif
#endif
#if defined(LIGHTMAP_ON)
#endif
#ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
result.fogFactorAndVertexLight.x = surfVertex.fogCoord;
COPY_FROM_LIGHT_COORDS(result.fogFactorAndVertexLight.yzw, surfVertex);
#endif
DEFAULT_UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(surfVertex, result);
}
// --------------------------------------------------
// Main
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/Varyings.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/ShadowCasterPass.hlsl"
ENDHLSL
}
Pass
{
Name "SceneSelectionPass"
Tags
{
"LightMode" = "SceneSelectionPass"
}
// Render State
Cull Off
// Debug
// <None>
// --------------------------------------------------
// Pass
HLSLPROGRAM
// Pragmas
#pragma target 3.0
#pragma multi_compile_instancing
#pragma vertex vert
#pragma fragment frag
// DotsInstancingOptions: <None>
// HybridV1InjectedBuiltinProperties: <None>
// Keywords
// PassKeywords: <None>
// GraphKeywords: <None>
// Defines
#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 SceneSelectionPass
#define BUILTIN_TARGET_API 1
#define SCENESELECTIONPASS 1
#define _BUILTIN_SURFACE_TYPE_TRANSPARENT 1
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
#ifdef _BUILTIN_SURFACE_TYPE_TRANSPARENT
#define _SURFACE_TYPE_TRANSPARENT _BUILTIN_SURFACE_TYPE_TRANSPARENT
#endif
#ifdef _BUILTIN_ALPHATEST_ON
#define _ALPHATEST_ON _BUILTIN_ALPHATEST_ON
#endif
#ifdef _BUILTIN_AlphaClip
#define _AlphaClip _BUILTIN_AlphaClip
#endif
#ifdef _BUILTIN_ALPHAPREMULTIPLY_ON
#define _ALPHAPREMULTIPLY_ON _BUILTIN_ALPHAPREMULTIPLY_ON
#endif
// custom interpolator pre-include
/* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */
// Includes
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/Shims.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/LegacySurfaceVertex.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/ShaderGraphFunctions.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;
float3 TimeParameters;
};
struct VertexDescriptionInputs
{
float3 ObjectSpaceNormal;
float3 ObjectSpaceTangent;
float3 ObjectSpacePosition;
};
struct PackedVaryings
{
float4 positionCS : SV_POSITION;
float4 interp0 : 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.interp0.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.interp0.xyzw;
#if UNITY_ANY_INSTANCING_ENABLED
output.instanceID = input.instanceID;
#endif
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
#endif
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
#endif
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
output.cullFace = input.cullFace;
#endif
return output;
}
// --------------------------------------------------
// Graph
// Graph Properties
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_TexelSize;
float _MaxFrames;
float _FPS;
CBUFFER_END
// Object and Global properties
SAMPLER(SamplerState_Linear_Repeat);
TEXTURE2D(_MainTex);
SAMPLER(sampler_MainTex);
// -- Property used by ScenePickingPass
#ifdef SCENEPICKINGPASS
float4 _SelectionID;
#endif
// -- Properties used by SceneSelectionPass
#ifdef SCENESELECTIONPASS
int _ObjectId;
int _PassValue;
#endif
// Graph Includes
// GraphIncludes: <None>
// Graph Functions
void Unity_Multiply_float_float(float A, float B, out float Out)
{
Out = A * B;
}
void Unity_Modulo_float(float A, float B, out float Out)
{
Out = fmod(A, B);
}
void Unity_Floor_float(float In, out float Out)
{
Out = floor(In);
}
void Unity_Flipbook_InvertXY_float (float2 UV, float Width, float Height, float Tile, float2 Invert, out float2 Out)
{
Tile = floor(fmod(Tile + float(0.00001), Width*Height));
float2 tileCount = float2(1.0, 1.0) / float2(Width, Height);
float tileX = (Invert.x * Width - ((Tile - Width * floor(Tile * tileCount.x)) + Invert.x * 1));
float tileY = (Invert.y * Height - (floor(Tile * tileCount.x) + Invert.y * 1));
Out = (UV + float2(tileX, tileY)) * tileCount;
}
// 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
{
float Alpha;
};
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
{
SurfaceDescription surface = (SurfaceDescription)0;
UnityTexture2D _Property_8622bed71452496ab7aeb9dea24d42b5_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex);
float _Property_54d31d31bf63447cb40b4793ffbf1e60_Out_0 = _FPS;
float _Multiply_05f2fdcf8e83430ab1e4b927b4c19717_Out_2;
Unity_Multiply_float_float(IN.TimeParameters.x, _Property_54d31d31bf63447cb40b4793ffbf1e60_Out_0, _Multiply_05f2fdcf8e83430ab1e4b927b4c19717_Out_2);
float _Property_925bfba4e47e47b6a6c5262dcc4e8fe2_Out_0 = _MaxFrames;
float _Modulo_cdf955c54d454d49ae81ebdf4270fb56_Out_2;
Unity_Modulo_float(_Multiply_05f2fdcf8e83430ab1e4b927b4c19717_Out_2, _Property_925bfba4e47e47b6a6c5262dcc4e8fe2_Out_0, _Modulo_cdf955c54d454d49ae81ebdf4270fb56_Out_2);
float _Floor_28f406a829e84199aeba15d2eebb8823_Out_1;
Unity_Floor_float(_Modulo_cdf955c54d454d49ae81ebdf4270fb56_Out_2, _Floor_28f406a829e84199aeba15d2eebb8823_Out_1);
float2 _Flipbook_c1ccd2165c97414f928a556db7527f16_Out_4;
float2 _Flipbook_c1ccd2165c97414f928a556db7527f16_Invert = float2 (1, 1);
Unity_Flipbook_InvertXY_float(IN.uv0.xy, 5, 1, _Floor_28f406a829e84199aeba15d2eebb8823_Out_1, _Flipbook_c1ccd2165c97414f928a556db7527f16_Invert, _Flipbook_c1ccd2165c97414f928a556db7527f16_Out_4);
float4 _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0 = SAMPLE_TEXTURE2D(_Property_8622bed71452496ab7aeb9dea24d42b5_Out_0.tex, _Property_8622bed71452496ab7aeb9dea24d42b5_Out_0.samplerstate, _Property_8622bed71452496ab7aeb9dea24d42b5_Out_0.GetTransformedUV(_Flipbook_c1ccd2165c97414f928a556db7527f16_Out_4));
float _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_R_4 = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.r;
float _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_G_5 = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.g;
float _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_B_6 = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.b;
float _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_A_7 = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.a;
surface.Alpha = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_A_7;
return surface;
}
// --------------------------------------------------
// Build Graph Inputs
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);
output.uv0 = input.texCoord0;
output.TimeParameters = _TimeParameters.xyz; // This is mainly for LW as HD overwrite this value
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
#else
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
#endif
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
return output;
}
void BuildAppDataFull(Attributes attributes, VertexDescription vertexDescription, inout appdata_full result)
{
result.vertex = float4(attributes.positionOS, 1);
result.tangent = attributes.tangentOS;
result.normal = attributes.normalOS;
result.texcoord = attributes.uv0;
result.vertex = float4(vertexDescription.Position, 1);
result.normal = vertexDescription.Normal;
result.tangent = float4(vertexDescription.Tangent, 0);
#if UNITY_ANY_INSTANCING_ENABLED
#endif
}
void VaryingsToSurfaceVertex(Varyings varyings, inout v2f_surf result)
{
result.pos = varyings.positionCS;
// World Tangent isn't an available input on v2f_surf
#if UNITY_ANY_INSTANCING_ENABLED
#endif
#if !defined(LIGHTMAP_ON)
#if UNITY_SHOULD_SAMPLE_SH
#endif
#endif
#if defined(LIGHTMAP_ON)
#endif
#ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
result.fogCoord = varyings.fogFactorAndVertexLight.x;
COPY_TO_LIGHT_COORDS(result, varyings.fogFactorAndVertexLight.yzw);
#endif
DEFAULT_UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(varyings, result);
}
void SurfaceVertexToVaryings(v2f_surf surfVertex, inout Varyings result)
{
result.positionCS = surfVertex.pos;
// viewDirectionWS is never filled out in the legacy pass' function. Always use the value computed by SRP
// World Tangent isn't an available input on v2f_surf
#if UNITY_ANY_INSTANCING_ENABLED
#endif
#if !defined(LIGHTMAP_ON)
#if UNITY_SHOULD_SAMPLE_SH
#endif
#endif
#if defined(LIGHTMAP_ON)
#endif
#ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
result.fogFactorAndVertexLight.x = surfVertex.fogCoord;
COPY_FROM_LIGHT_COORDS(result.fogFactorAndVertexLight.yzw, surfVertex);
#endif
DEFAULT_UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(surfVertex, result);
}
// --------------------------------------------------
// Main
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/Varyings.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/DepthOnlyPass.hlsl"
ENDHLSL
}
Pass
{
Name "ScenePickingPass"
Tags
{
"LightMode" = "Picking"
}
// Render State
Cull Back
// Debug
// <None>
// --------------------------------------------------
// Pass
HLSLPROGRAM
// Pragmas
#pragma target 3.0
#pragma multi_compile_instancing
#pragma vertex vert
#pragma fragment frag
// DotsInstancingOptions: <None>
// HybridV1InjectedBuiltinProperties: <None>
// Keywords
// PassKeywords: <None>
// GraphKeywords: <None>
// Defines
#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 ScenePickingPass
#define BUILTIN_TARGET_API 1
#define SCENEPICKINGPASS 1
#define _BUILTIN_SURFACE_TYPE_TRANSPARENT 1
/* WARNING: $splice Could not find named fragment 'DotsInstancingVars' */
#ifdef _BUILTIN_SURFACE_TYPE_TRANSPARENT
#define _SURFACE_TYPE_TRANSPARENT _BUILTIN_SURFACE_TYPE_TRANSPARENT
#endif
#ifdef _BUILTIN_ALPHATEST_ON
#define _ALPHATEST_ON _BUILTIN_ALPHATEST_ON
#endif
#ifdef _BUILTIN_AlphaClip
#define _AlphaClip _BUILTIN_AlphaClip
#endif
#ifdef _BUILTIN_ALPHAPREMULTIPLY_ON
#define _ALPHAPREMULTIPLY_ON _BUILTIN_ALPHAPREMULTIPLY_ON
#endif
// custom interpolator pre-include
/* WARNING: $splice Could not find named fragment 'sgci_CustomInterpolatorPreInclude' */
// Includes
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Shim/Shims.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/LegacySurfaceVertex.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/ShaderGraphFunctions.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;
float3 TimeParameters;
};
struct VertexDescriptionInputs
{
float3 ObjectSpaceNormal;
float3 ObjectSpaceTangent;
float3 ObjectSpacePosition;
};
struct PackedVaryings
{
float4 positionCS : SV_POSITION;
float4 interp0 : 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.interp0.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.interp0.xyzw;
#if UNITY_ANY_INSTANCING_ENABLED
output.instanceID = input.instanceID;
#endif
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
output.stereoTargetEyeIndexAsBlendIdx0 = input.stereoTargetEyeIndexAsBlendIdx0;
#endif
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx;
#endif
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
output.cullFace = input.cullFace;
#endif
return output;
}
// --------------------------------------------------
// Graph
// Graph Properties
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_TexelSize;
float _MaxFrames;
float _FPS;
CBUFFER_END
// Object and Global properties
SAMPLER(SamplerState_Linear_Repeat);
TEXTURE2D(_MainTex);
SAMPLER(sampler_MainTex);
// -- Property used by ScenePickingPass
#ifdef SCENEPICKINGPASS
float4 _SelectionID;
#endif
// -- Properties used by SceneSelectionPass
#ifdef SCENESELECTIONPASS
int _ObjectId;
int _PassValue;
#endif
// Graph Includes
// GraphIncludes: <None>
// Graph Functions
void Unity_Multiply_float_float(float A, float B, out float Out)
{
Out = A * B;
}
void Unity_Modulo_float(float A, float B, out float Out)
{
Out = fmod(A, B);
}
void Unity_Floor_float(float In, out float Out)
{
Out = floor(In);
}
void Unity_Flipbook_InvertXY_float (float2 UV, float Width, float Height, float Tile, float2 Invert, out float2 Out)
{
Tile = floor(fmod(Tile + float(0.00001), Width*Height));
float2 tileCount = float2(1.0, 1.0) / float2(Width, Height);
float tileX = (Invert.x * Width - ((Tile - Width * floor(Tile * tileCount.x)) + Invert.x * 1));
float tileY = (Invert.y * Height - (floor(Tile * tileCount.x) + Invert.y * 1));
Out = (UV + float2(tileX, tileY)) * tileCount;
}
// 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
{
float Alpha;
};
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN)
{
SurfaceDescription surface = (SurfaceDescription)0;
UnityTexture2D _Property_8622bed71452496ab7aeb9dea24d42b5_Out_0 = UnityBuildTexture2DStructNoScale(_MainTex);
float _Property_54d31d31bf63447cb40b4793ffbf1e60_Out_0 = _FPS;
float _Multiply_05f2fdcf8e83430ab1e4b927b4c19717_Out_2;
Unity_Multiply_float_float(IN.TimeParameters.x, _Property_54d31d31bf63447cb40b4793ffbf1e60_Out_0, _Multiply_05f2fdcf8e83430ab1e4b927b4c19717_Out_2);
float _Property_925bfba4e47e47b6a6c5262dcc4e8fe2_Out_0 = _MaxFrames;
float _Modulo_cdf955c54d454d49ae81ebdf4270fb56_Out_2;
Unity_Modulo_float(_Multiply_05f2fdcf8e83430ab1e4b927b4c19717_Out_2, _Property_925bfba4e47e47b6a6c5262dcc4e8fe2_Out_0, _Modulo_cdf955c54d454d49ae81ebdf4270fb56_Out_2);
float _Floor_28f406a829e84199aeba15d2eebb8823_Out_1;
Unity_Floor_float(_Modulo_cdf955c54d454d49ae81ebdf4270fb56_Out_2, _Floor_28f406a829e84199aeba15d2eebb8823_Out_1);
float2 _Flipbook_c1ccd2165c97414f928a556db7527f16_Out_4;
float2 _Flipbook_c1ccd2165c97414f928a556db7527f16_Invert = float2 (1, 1);
Unity_Flipbook_InvertXY_float(IN.uv0.xy, 5, 1, _Floor_28f406a829e84199aeba15d2eebb8823_Out_1, _Flipbook_c1ccd2165c97414f928a556db7527f16_Invert, _Flipbook_c1ccd2165c97414f928a556db7527f16_Out_4);
float4 _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0 = SAMPLE_TEXTURE2D(_Property_8622bed71452496ab7aeb9dea24d42b5_Out_0.tex, _Property_8622bed71452496ab7aeb9dea24d42b5_Out_0.samplerstate, _Property_8622bed71452496ab7aeb9dea24d42b5_Out_0.GetTransformedUV(_Flipbook_c1ccd2165c97414f928a556db7527f16_Out_4));
float _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_R_4 = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.r;
float _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_G_5 = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.g;
float _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_B_6 = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.b;
float _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_A_7 = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_RGBA_0.a;
surface.Alpha = _SampleTexture2D_189866dcd5154670b7824dbc9ca4256e_A_7;
return surface;
}
// --------------------------------------------------
// Build Graph Inputs
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);
output.uv0 = input.texCoord0;
output.TimeParameters = _TimeParameters.xyz; // This is mainly for LW as HD overwrite this value
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false);
#else
#define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
#endif
#undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN
return output;
}
void BuildAppDataFull(Attributes attributes, VertexDescription vertexDescription, inout appdata_full result)
{
result.vertex = float4(attributes.positionOS, 1);
result.tangent = attributes.tangentOS;
result.normal = attributes.normalOS;
result.texcoord = attributes.uv0;
result.vertex = float4(vertexDescription.Position, 1);
result.normal = vertexDescription.Normal;
result.tangent = float4(vertexDescription.Tangent, 0);
#if UNITY_ANY_INSTANCING_ENABLED
#endif
}
void VaryingsToSurfaceVertex(Varyings varyings, inout v2f_surf result)
{
result.pos = varyings.positionCS;
// World Tangent isn't an available input on v2f_surf
#if UNITY_ANY_INSTANCING_ENABLED
#endif
#if !defined(LIGHTMAP_ON)
#if UNITY_SHOULD_SAMPLE_SH
#endif
#endif
#if defined(LIGHTMAP_ON)
#endif
#ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
result.fogCoord = varyings.fogFactorAndVertexLight.x;
COPY_TO_LIGHT_COORDS(result, varyings.fogFactorAndVertexLight.yzw);
#endif
DEFAULT_UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(varyings, result);
}
void SurfaceVertexToVaryings(v2f_surf surfVertex, inout Varyings result)
{
result.positionCS = surfVertex.pos;
// viewDirectionWS is never filled out in the legacy pass' function. Always use the value computed by SRP
// World Tangent isn't an available input on v2f_surf
#if UNITY_ANY_INSTANCING_ENABLED
#endif
#if !defined(LIGHTMAP_ON)
#if UNITY_SHOULD_SAMPLE_SH
#endif
#endif
#if defined(LIGHTMAP_ON)
#endif
#ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
result.fogFactorAndVertexLight.x = surfVertex.fogCoord;
COPY_FROM_LIGHT_COORDS(result.fogFactorAndVertexLight.yzw, surfVertex);
#endif
DEFAULT_UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(surfVertex, result);
}
// --------------------------------------------------
// Main
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/Varyings.hlsl"
#include "Packages/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/DepthOnlyPass.hlsl"
ENDHLSL
}
}
CustomEditorForRenderPipeline "UnityEditor.Rendering.BuiltIn.ShaderGraph.BuiltInUnlitGUI" ""
CustomEditor "UnityEditor.ShaderGraph.GenericShaderGraphMaterialGUI"
FallBack "Hidden/Shader Graph/FallbackError"
}