2.5d test
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
Shader "BumpCombat/Comparison Sprite Depth"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex ("Existing sprite texture", 2D) = "white" {}
|
||||
_BaseColor ("Tint", Color) = (1,1,1,1)
|
||||
_Cutoff ("Alpha clip", Range(0,1)) = 0.4
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Source blend", Float) = 1
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Destination blend", Float) = 0
|
||||
[Toggle] _ZWrite ("Depth write", Float) = 1
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="TransparentCutout" "Queue"="AlphaTest" }
|
||||
Pass
|
||||
{
|
||||
Name "ComparisonUnlit"
|
||||
Tags { "LightMode"="UniversalForward" }
|
||||
Cull Off
|
||||
ZTest LEqual
|
||||
ZWrite [_ZWrite]
|
||||
Blend [_SrcBlend] [_DstBlend]
|
||||
HLSLPROGRAM
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Frag
|
||||
#pragma multi_compile_instancing
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl"
|
||||
struct Attributes
|
||||
{
|
||||
float3 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
half4 color : COLOR;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
struct Varyings { float4 positionCS : SV_POSITION; float2 uv : TEXCOORD0; half4 color : COLOR; };
|
||||
TEXTURE2D(_MainTex);
|
||||
SAMPLER(sampler_MainTex);
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
half4 _BaseColor;
|
||||
half _Cutoff;
|
||||
CBUFFER_END
|
||||
Varyings Vert(Attributes input)
|
||||
{
|
||||
Varyings output;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
SetUpSpriteInstanceProperties();
|
||||
input.positionOS = UnityFlipSprite(input.positionOS, unity_SpriteProps.xy);
|
||||
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
|
||||
output.uv = input.uv;
|
||||
output.color = input.color;
|
||||
return output;
|
||||
}
|
||||
half4 Frag(Varyings input) : SV_Target
|
||||
{
|
||||
half4 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv) * input.color * _BaseColor;
|
||||
clip(color.a - _Cutoff);
|
||||
return color;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user