147 lines
3.9 KiB
Plaintext
147 lines
3.9 KiB
Plaintext
Shader "Universal Render Pipeline/2D/Mesh2D-Lit-Default"
|
|
{
|
|
Properties
|
|
{
|
|
_MainTex("Diffuse", 2D) = "white" {}
|
|
_MaskTex("Mask", 2D) = "white" {}
|
|
_NormalMap("Normal Map", 2D) = "bump" {}
|
|
[HideInInspector] _White("Tint", Color) = (1,1,1,1) // Added to break SRP batching. Work around for issue with SRP Batching
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
Tags {"Queue" = "Transparent" "RenderType" = "Transparent" "RenderPipeline" = "UniversalPipeline" }
|
|
|
|
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
|
|
Cull Back
|
|
ZWrite On
|
|
|
|
Stencil
|
|
{
|
|
Ref 128 // Put this in the last bit of our stencil value for maximum compatibility with sprite mask
|
|
Comp always
|
|
Pass replace
|
|
}
|
|
|
|
Pass
|
|
{
|
|
Tags { "LightMode" = "Universal2D" }
|
|
|
|
HLSLPROGRAM
|
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl"
|
|
|
|
#pragma vertex LitVertex
|
|
#pragma fragment LitFragment
|
|
|
|
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/ShapeLightShared.hlsl"
|
|
|
|
// GPU Instancing
|
|
#pragma multi_compile_instancing
|
|
#pragma multi_compile _ DEBUG_DISPLAY
|
|
|
|
struct Attributes
|
|
{
|
|
COMMON_2D_INPUTS
|
|
};
|
|
|
|
struct Varyings
|
|
{
|
|
COMMON_2D_LIT_OUTPUTS
|
|
};
|
|
|
|
float4 _White;
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Lit2DCommon.hlsl"
|
|
|
|
Varyings LitVertex(Attributes input)
|
|
{
|
|
return CommonLitVertex(input);
|
|
}
|
|
|
|
half4 LitFragment(Varyings input) : SV_Target
|
|
{
|
|
return CommonLitFragment(input, _White);
|
|
}
|
|
ENDHLSL
|
|
}
|
|
|
|
Pass
|
|
{
|
|
Tags { "LightMode" = "NormalsRendering"}
|
|
|
|
HLSLPROGRAM
|
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl"
|
|
|
|
#pragma vertex NormalsRenderingVertex
|
|
#pragma fragment NormalsRenderingFragment
|
|
|
|
// GPU Instancing
|
|
#pragma multi_compile_instancing
|
|
|
|
struct Attributes
|
|
{
|
|
COMMON_2D_NORMALS_INPUTS
|
|
};
|
|
|
|
struct Varyings
|
|
{
|
|
COMMON_2D_NORMALS_OUTPUTS
|
|
};
|
|
|
|
float4 _White;
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Normals2DCommon.hlsl"
|
|
|
|
Varyings NormalsRenderingVertex(Attributes input)
|
|
{
|
|
return CommonNormalsVertex(input);
|
|
}
|
|
|
|
half4 NormalsRenderingFragment(Varyings input) : SV_Target
|
|
{
|
|
return CommonNormalsFragment(input, _White);
|
|
}
|
|
ENDHLSL
|
|
}
|
|
|
|
Pass
|
|
{
|
|
Tags { "LightMode" = "UniversalForward" "Queue"="Transparent" "RenderType"="Transparent"}
|
|
|
|
HLSLPROGRAM
|
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl"
|
|
|
|
#pragma vertex UnlitVertex
|
|
#pragma fragment UnlitFragment
|
|
|
|
// GPU Instancing
|
|
#pragma multi_compile_instancing
|
|
|
|
struct Attributes
|
|
{
|
|
COMMON_2D_INPUTS
|
|
};
|
|
|
|
struct Varyings
|
|
{
|
|
COMMON_2D_OUTPUTS
|
|
};
|
|
|
|
float4 _White;
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/2DCommon.hlsl"
|
|
|
|
Varyings UnlitVertex(Attributes input)
|
|
{
|
|
return CommonUnlitVertex(input);
|
|
}
|
|
|
|
half4 UnlitFragment(Varyings input) : SV_Target
|
|
{
|
|
return CommonUnlitFragment(input, _White);
|
|
}
|
|
ENDHLSL
|
|
}
|
|
}
|
|
}
|