block improvements, autolock improvements and auto off, block button auto on/off, recoil anim improvement
This commit is contained in:
@@ -1,20 +1,79 @@
|
||||
Shader "Unlit/DepthPrepassTransparent"
|
||||
{
|
||||
|
||||
Properties
|
||||
{
|
||||
// This property is necessary to receive the texture from the main material
|
||||
_MainTex("Texture", 2D) = "white" {}
|
||||
// This property is necessary to receive the alpha cutoff value from the main material
|
||||
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
|
||||
Tags {
|
||||
"Queue" = "Transparent"
|
||||
"RenderType" = "Transparent"
|
||||
"RenderPipeline" = "UniversalPipeline"
|
||||
}
|
||||
|
||||
// This pass is for the depth pre-pass.
|
||||
// It writes depth for transparent objects that need it.
|
||||
Tags { "RenderType" = "TransparentCutout" "RenderPipeline" = "UniversalPipeline" }
|
||||
|
||||
Pass
|
||||
{
|
||||
// Use the "DepthOnly" LightMode for URP to identify this as a depth pass.
|
||||
Name "DepthOnly"
|
||||
Tags { "LightMode" = "DepthOnly" }
|
||||
|
||||
// Write to the depth buffer
|
||||
ZWrite On
|
||||
// Do not write to any color channels
|
||||
ColorMask 0
|
||||
}
|
||||
// Standard back-face culling
|
||||
Cull Back
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
// Includes for URP core functionality
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
// Match the properties block
|
||||
TEXTURE2D(_MainTex);
|
||||
SAMPLER(sampler_MainTex);
|
||||
half _Cutoff;
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
Varyings vert(Attributes input)
|
||||
{
|
||||
Varyings output;
|
||||
// Standard vertex transformation
|
||||
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
|
||||
output.uv = input.uv;
|
||||
return output;
|
||||
}
|
||||
|
||||
half4 frag(Varyings input) : SV_TARGET
|
||||
{
|
||||
// Sample the texture to get the alpha value
|
||||
half alpha = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv).a;
|
||||
|
||||
// Perform alpha clipping. Discard the fragment if its alpha is below the cutoff.
|
||||
// This ensures the depth shape matches the visible shape.
|
||||
clip(alpha - _Cutoff);
|
||||
|
||||
// We don't need to return a color as ColorMask is 0,
|
||||
// but the function must return something.
|
||||
return 0;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -377,12 +377,3 @@ MonoBehaviour:
|
||||
BlurQuality: 2
|
||||
Falloff: 30
|
||||
SampleCount: -1
|
||||
m_BlueNoise256Textures:
|
||||
- {fileID: 2800000, guid: 36f118343fc974119bee3d09e2111500, type: 3}
|
||||
- {fileID: 2800000, guid: 4b7b083e6b6734e8bb2838b0b50a0bc8, type: 3}
|
||||
- {fileID: 2800000, guid: c06cc21c692f94f5fb5206247191eeee, type: 3}
|
||||
- {fileID: 2800000, guid: cb76dd40fa7654f9587f6a344f125c9a, type: 3}
|
||||
- {fileID: 2800000, guid: e32226222ff144b24bf3a5a451de54bc, type: 3}
|
||||
- {fileID: 2800000, guid: 3302065f671a8450b82c9ddf07426f3a, type: 3}
|
||||
- {fileID: 2800000, guid: 56a77a3e8d64f47b6afe9e3c95cb57d5, type: 3}
|
||||
m_Shader: {fileID: 4800000, guid: 0849e84e3d62649e8882e9d6f056a017, type: 3}
|
||||
|
||||
Reference in New Issue
Block a user