Created
September 6, 2020 01:59
-
-
Save smkplus/5d595949f4cf6a04943eec4158fe49be to your computer and use it in GitHub Desktop.
URP 2D Lit Template - Sprite Lit Master
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Sprite Lit Master" | |
{ | |
Properties | |
{ | |
[NoScaleOffset]_MainTex("MainText", 2D) = "white" {} | |
_Color("Color", Color) = (0, 0, 0, 0) | |
} | |
SubShader | |
{ | |
Tags | |
{ | |
"RenderPipeline"="UniversalPipeline" | |
"RenderType"="Transparent" | |
"Queue"="Transparent+0" | |
} | |
Pass | |
{ | |
Name "Sprite Lit" | |
Tags | |
{ | |
"LightMode" = "Universal2D" | |
} | |
// Render State | |
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha | |
Cull Off | |
ZTest LEqual | |
ZWrite Off | |
// ColorMask: <None> | |
HLSLPROGRAM | |
#pragma vertex vert | |
#pragma fragment frag | |
// Debug | |
// <None> | |
// -------------------------------------------------- | |
// Pass | |
// Pragmas | |
#pragma prefer_hlslcc gles | |
#pragma exclude_renderers d3d11_9x | |
#pragma target 2.0 | |
// Keywords | |
#pragma multi_compile _ ETC1_EXTERNAL_ALPHA | |
#pragma multi_compile _ USE_SHAPE_LIGHT_TYPE_0 | |
#pragma multi_compile _ USE_SHAPE_LIGHT_TYPE_1 | |
#pragma multi_compile _ USE_SHAPE_LIGHT_TYPE_2 | |
#pragma multi_compile _ USE_SHAPE_LIGHT_TYPE_3 | |
// GraphKeywords: <None> | |
// Defines | |
#define _SURFACE_TYPE_TRANSPARENT 1 | |
#define ATTRIBUTES_NEED_NORMAL | |
#define ATTRIBUTES_NEED_TANGENT | |
#define ATTRIBUTES_NEED_TEXCOORD0 | |
#define ATTRIBUTES_NEED_COLOR | |
#define VARYINGS_NEED_TEXCOORD0 | |
#define VARYINGS_NEED_COLOR | |
#define VARYINGS_NEED_SCREENPOSITION | |
#define SHADERPASS_SPRITELIT | |
// Includes | |
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" | |
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" | |
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" | |
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" | |
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/LightingUtility.hlsl" | |
// -------------------------------------------------- | |
// Graph | |
// Graph Properties | |
CBUFFER_START(UnityPerMaterial) | |
float4 _Color; | |
CBUFFER_END | |
TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex); float4 _MainTex_TexelSize; | |
SAMPLER(_SampleTexture2D_2BA12186_Sampler_3_Linear_Repeat); | |
// Graph Functions | |
// GraphFunctions: <None> | |
// Graph Vertex | |
// GraphVertex: <None> | |
// Graph Pixel | |
struct SurfaceDescriptionInputs | |
{ | |
float4 uv0; | |
}; | |
struct SurfaceDescription | |
{ | |
float4 Color; | |
float4 Mask; | |
}; | |
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN) | |
{ | |
SurfaceDescription surface = (SurfaceDescription)0; | |
float4 _Property_B6960D2C_Out_0 = _Color; | |
float4 _SampleTexture2D_2BA12186_RGBA_0 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, IN.uv0.xy); | |
float _SampleTexture2D_2BA12186_R_4 = _SampleTexture2D_2BA12186_RGBA_0.r; | |
float _SampleTexture2D_2BA12186_G_5 = _SampleTexture2D_2BA12186_RGBA_0.g; | |
float _SampleTexture2D_2BA12186_B_6 = _SampleTexture2D_2BA12186_RGBA_0.b; | |
float _SampleTexture2D_2BA12186_A_7 = _SampleTexture2D_2BA12186_RGBA_0.a; | |
surface.Color = _Property_B6960D2C_Out_0; | |
surface.Mask = _SampleTexture2D_2BA12186_RGBA_0; | |
return surface; | |
} | |
// -------------------------------------------------- | |
// Structs and Packing | |
// Generated Type: Attributes | |
struct Attributes | |
{ | |
float3 positionOS : POSITION; | |
float3 normalOS : NORMAL; | |
float4 tangentOS : TANGENT; | |
float4 uv0 : TEXCOORD0; | |
float4 color : COLOR; | |
#if UNITY_ANY_INSTANCING_ENABLED | |
uint instanceID : INSTANCEID_SEMANTIC; | |
#endif | |
}; | |
// Generated Type: Varyings | |
struct Varyings | |
{ | |
float4 positionCS : SV_POSITION; | |
float4 texCoord0; | |
float4 color; | |
float4 screenPosition; | |
#if UNITY_ANY_INSTANCING_ENABLED | |
uint instanceID : CUSTOM_INSTANCE_ID; | |
#endif | |
#if (defined(UNITY_STEREO_INSTANCING_ENABLED)) | |
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; | |
#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(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) | |
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; | |
#endif | |
}; | |
// Generated Type: PackedVaryings | |
struct PackedVaryings | |
{ | |
float4 positionCS : SV_POSITION; | |
#if UNITY_ANY_INSTANCING_ENABLED | |
uint instanceID : CUSTOM_INSTANCE_ID; | |
#endif | |
float4 interp00 : TEXCOORD0; | |
float4 interp01 : TEXCOORD1; | |
float4 interp02 : TEXCOORD2; | |
#if (defined(UNITY_STEREO_INSTANCING_ENABLED)) | |
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; | |
#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(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) | |
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; | |
#endif | |
}; | |
// Packed Type: Varyings | |
PackedVaryings PackVaryings(Varyings input) | |
{ | |
PackedVaryings output = (PackedVaryings)0; | |
output.positionCS = input.positionCS; | |
output.interp00.xyzw = input.texCoord0; | |
output.interp01.xyzw = input.color; | |
output.interp02.xyzw = input.screenPosition; | |
#if UNITY_ANY_INSTANCING_ENABLED | |
output.instanceID = input.instanceID; | |
#endif | |
#if (defined(UNITY_STEREO_INSTANCING_ENABLED)) | |
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; | |
#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(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) | |
output.cullFace = input.cullFace; | |
#endif | |
return output; | |
} | |
// Unpacked Type: Varyings | |
Varyings UnpackVaryings(PackedVaryings input) | |
{ | |
Varyings output = (Varyings)0; | |
output.positionCS = input.positionCS; | |
output.texCoord0 = input.interp00.xyzw; | |
output.color = input.interp01.xyzw; | |
output.screenPosition = input.interp02.xyzw; | |
#if UNITY_ANY_INSTANCING_ENABLED | |
output.instanceID = input.instanceID; | |
#endif | |
#if (defined(UNITY_STEREO_INSTANCING_ENABLED)) | |
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; | |
#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(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) | |
output.cullFace = input.cullFace; | |
#endif | |
return output; | |
} | |
// -------------------------------------------------- | |
// Build Graph Inputs | |
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input) | |
{ | |
SurfaceDescriptionInputs output; | |
ZERO_INITIALIZE(SurfaceDescriptionInputs, output); | |
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/SpriteLitPass.hlsl" | |
ENDHLSL | |
} | |
Pass | |
{ | |
Name "Sprite Normal" | |
Tags | |
{ | |
"LightMode" = "NormalsRendering" | |
} | |
// Render State | |
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha | |
Cull Off | |
ZTest LEqual | |
ZWrite Off | |
// ColorMask: <None> | |
HLSLPROGRAM | |
#pragma vertex vert | |
#pragma fragment frag | |
// Debug | |
// <None> | |
// -------------------------------------------------- | |
// Pass | |
// Pragmas | |
#pragma prefer_hlslcc gles | |
#pragma exclude_renderers d3d11_9x | |
#pragma target 2.0 | |
// Keywords | |
// PassKeywords: <None> | |
// GraphKeywords: <None> | |
// Defines | |
#define _SURFACE_TYPE_TRANSPARENT 1 | |
#define ATTRIBUTES_NEED_NORMAL | |
#define ATTRIBUTES_NEED_TANGENT | |
#define VARYINGS_NEED_NORMAL_WS | |
#define VARYINGS_NEED_TANGENT_WS | |
#define SHADERPASS_SPRITENORMAL | |
// Includes | |
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" | |
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" | |
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" | |
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" | |
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/NormalsRenderingShared.hlsl" | |
// -------------------------------------------------- | |
// Graph | |
// Graph Properties | |
CBUFFER_START(UnityPerMaterial) | |
float4 _Color; | |
CBUFFER_END | |
TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex); float4 _MainTex_TexelSize; | |
// Graph Functions | |
// GraphFunctions: <None> | |
// Graph Vertex | |
// GraphVertex: <None> | |
// Graph Pixel | |
struct SurfaceDescriptionInputs | |
{ | |
}; | |
struct SurfaceDescription | |
{ | |
float4 Color; | |
float3 Normal; | |
}; | |
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN) | |
{ | |
SurfaceDescription surface = (SurfaceDescription)0; | |
float4 _Property_B6960D2C_Out_0 = _Color; | |
surface.Color = _Property_B6960D2C_Out_0; | |
surface.Normal = float3 (0, 0, 1); | |
return surface; | |
} | |
// -------------------------------------------------- | |
// Structs and Packing | |
// Generated Type: Attributes | |
struct Attributes | |
{ | |
float3 positionOS : POSITION; | |
float3 normalOS : NORMAL; | |
float4 tangentOS : TANGENT; | |
#if UNITY_ANY_INSTANCING_ENABLED | |
uint instanceID : INSTANCEID_SEMANTIC; | |
#endif | |
}; | |
// Generated Type: Varyings | |
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_INSTANCING_ENABLED)) | |
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; | |
#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(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) | |
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; | |
#endif | |
}; | |
// Generated Type: PackedVaryings | |
struct PackedVaryings | |
{ | |
float4 positionCS : SV_POSITION; | |
#if UNITY_ANY_INSTANCING_ENABLED | |
uint instanceID : CUSTOM_INSTANCE_ID; | |
#endif | |
float3 interp00 : TEXCOORD0; | |
float4 interp01 : TEXCOORD1; | |
#if (defined(UNITY_STEREO_INSTANCING_ENABLED)) | |
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; | |
#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(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) | |
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; | |
#endif | |
}; | |
// Packed Type: Varyings | |
PackedVaryings PackVaryings(Varyings input) | |
{ | |
PackedVaryings output = (PackedVaryings)0; | |
output.positionCS = input.positionCS; | |
output.interp00.xyz = input.normalWS; | |
output.interp01.xyzw = input.tangentWS; | |
#if UNITY_ANY_INSTANCING_ENABLED | |
output.instanceID = input.instanceID; | |
#endif | |
#if (defined(UNITY_STEREO_INSTANCING_ENABLED)) | |
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; | |
#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(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) | |
output.cullFace = input.cullFace; | |
#endif | |
return output; | |
} | |
// Unpacked Type: Varyings | |
Varyings UnpackVaryings(PackedVaryings input) | |
{ | |
Varyings output = (Varyings)0; | |
output.positionCS = input.positionCS; | |
output.normalWS = input.interp00.xyz; | |
output.tangentWS = input.interp01.xyzw; | |
#if UNITY_ANY_INSTANCING_ENABLED | |
output.instanceID = input.instanceID; | |
#endif | |
#if (defined(UNITY_STEREO_INSTANCING_ENABLED)) | |
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; | |
#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(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) | |
output.cullFace = input.cullFace; | |
#endif | |
return output; | |
} | |
// -------------------------------------------------- | |
// Build Graph Inputs | |
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input) | |
{ | |
SurfaceDescriptionInputs output; | |
ZERO_INITIALIZE(SurfaceDescriptionInputs, output); | |
#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/SpriteNormalPass.hlsl" | |
ENDHLSL | |
} | |
Pass | |
{ | |
Name "Sprite Forward" | |
Tags | |
{ | |
"LightMode" = "UniversalForward" | |
} | |
// Render State | |
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha | |
Cull Off | |
ZTest LEqual | |
ZWrite Off | |
// ColorMask: <None> | |
HLSLPROGRAM | |
#pragma vertex vert | |
#pragma fragment frag | |
// Debug | |
// <None> | |
// -------------------------------------------------- | |
// Pass | |
// Pragmas | |
#pragma prefer_hlslcc gles | |
#pragma exclude_renderers d3d11_9x | |
#pragma target 2.0 | |
// Keywords | |
#pragma multi_compile _ ETC1_EXTERNAL_ALPHA | |
// GraphKeywords: <None> | |
// Defines | |
#define _SURFACE_TYPE_TRANSPARENT 1 | |
#define ATTRIBUTES_NEED_NORMAL | |
#define ATTRIBUTES_NEED_TANGENT | |
#define ATTRIBUTES_NEED_TEXCOORD0 | |
#define ATTRIBUTES_NEED_COLOR | |
#define VARYINGS_NEED_TEXCOORD0 | |
#define VARYINGS_NEED_COLOR | |
#define SHADERPASS_SPRITEFORWARD | |
// Includes | |
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" | |
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" | |
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" | |
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" | |
// -------------------------------------------------- | |
// Graph | |
// Graph Properties | |
CBUFFER_START(UnityPerMaterial) | |
float4 _Color; | |
CBUFFER_END | |
TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex); float4 _MainTex_TexelSize; | |
// Graph Functions | |
// GraphFunctions: <None> | |
// Graph Vertex | |
// GraphVertex: <None> | |
// Graph Pixel | |
struct SurfaceDescriptionInputs | |
{ | |
}; | |
struct SurfaceDescription | |
{ | |
float4 Color; | |
float3 Normal; | |
}; | |
SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN) | |
{ | |
SurfaceDescription surface = (SurfaceDescription)0; | |
float4 _Property_B6960D2C_Out_0 = _Color; | |
surface.Color = _Property_B6960D2C_Out_0; | |
surface.Normal = float3 (0, 0, 1); | |
return surface; | |
} | |
// -------------------------------------------------- | |
// Structs and Packing | |
// Generated Type: Attributes | |
struct Attributes | |
{ | |
float3 positionOS : POSITION; | |
float3 normalOS : NORMAL; | |
float4 tangentOS : TANGENT; | |
float4 uv0 : TEXCOORD0; | |
float4 color : COLOR; | |
#if UNITY_ANY_INSTANCING_ENABLED | |
uint instanceID : INSTANCEID_SEMANTIC; | |
#endif | |
}; | |
// Generated Type: Varyings | |
struct Varyings | |
{ | |
float4 positionCS : SV_POSITION; | |
float4 texCoord0; | |
float4 color; | |
#if UNITY_ANY_INSTANCING_ENABLED | |
uint instanceID : CUSTOM_INSTANCE_ID; | |
#endif | |
#if (defined(UNITY_STEREO_INSTANCING_ENABLED)) | |
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; | |
#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(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) | |
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; | |
#endif | |
}; | |
// Generated Type: PackedVaryings | |
struct PackedVaryings | |
{ | |
float4 positionCS : SV_POSITION; | |
#if UNITY_ANY_INSTANCING_ENABLED | |
uint instanceID : CUSTOM_INSTANCE_ID; | |
#endif | |
float4 interp00 : TEXCOORD0; | |
float4 interp01 : TEXCOORD1; | |
#if (defined(UNITY_STEREO_INSTANCING_ENABLED)) | |
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; | |
#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(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) | |
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; | |
#endif | |
}; | |
// Packed Type: Varyings | |
PackedVaryings PackVaryings(Varyings input) | |
{ | |
PackedVaryings output = (PackedVaryings)0; | |
output.positionCS = input.positionCS; | |
output.interp00.xyzw = input.texCoord0; | |
output.interp01.xyzw = input.color; | |
#if UNITY_ANY_INSTANCING_ENABLED | |
output.instanceID = input.instanceID; | |
#endif | |
#if (defined(UNITY_STEREO_INSTANCING_ENABLED)) | |
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; | |
#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(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) | |
output.cullFace = input.cullFace; | |
#endif | |
return output; | |
} | |
// Unpacked Type: Varyings | |
Varyings UnpackVaryings(PackedVaryings input) | |
{ | |
Varyings output = (Varyings)0; | |
output.positionCS = input.positionCS; | |
output.texCoord0 = input.interp00.xyzw; | |
output.color = input.interp01.xyzw; | |
#if UNITY_ANY_INSTANCING_ENABLED | |
output.instanceID = input.instanceID; | |
#endif | |
#if (defined(UNITY_STEREO_INSTANCING_ENABLED)) | |
output.stereoTargetEyeIndexAsRTArrayIdx = input.stereoTargetEyeIndexAsRTArrayIdx; | |
#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(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) | |
output.cullFace = input.cullFace; | |
#endif | |
return output; | |
} | |
// -------------------------------------------------- | |
// Build Graph Inputs | |
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input) | |
{ | |
SurfaceDescriptionInputs output; | |
ZERO_INITIALIZE(SurfaceDescriptionInputs, output); | |
#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/SpriteForwardPass.hlsl" | |
ENDHLSL | |
} | |
} | |
FallBack "Hidden/Shader Graph/FallbackError" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment