2.5 update
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15742ab19bee47f5aed31542be146166
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
Shader "BumpCombat/Cyclone Body Mask"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Existing orbit 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
|
||||
_BodyTex ("Current player sprite", 2D) = "white" {}
|
||||
_BodyMaskEnabled ("Protect player body", Float) = 0
|
||||
_BodyRect ("Body texture rectangle", Vector) = (0,0,1,1)
|
||||
_BodyPixels ("Body pivot and size in pixels", Vector) = (0,0,1,1)
|
||||
_BodyFlip ("Body flip", Vector) = (1,1,0,0)
|
||||
_BodyPPU ("Body pixels per unit", Float) = 32
|
||||
_BodyMinY ("Unmasked feet boundary", Float) = 0
|
||||
_BodyOpacity ("Body opacity", Float) = 1
|
||||
_BodyAlphaCutoff ("Body alpha clip", Float) = 0.4
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="TransparentCutout" "Queue"="AlphaTest" }
|
||||
Pass
|
||||
{
|
||||
Name "CycloneUnlitBodyMask"
|
||||
Tags { "LightMode"="UniversalForward" }
|
||||
Cull Off
|
||||
ZTest LEqual
|
||||
ZWrite [_ZWrite]
|
||||
Blend [_SrcBlend] [_DstBlend]
|
||||
HLSLPROGRAM
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Frag
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float3 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
half4 color : COLOR;
|
||||
};
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float3 positionWS : TEXCOORD1;
|
||||
half4 color : COLOR;
|
||||
};
|
||||
TEXTURE2D(_MainTex);
|
||||
SAMPLER(sampler_MainTex);
|
||||
TEXTURE2D(_BodyTex);
|
||||
SAMPLER(sampler_BodyTex);
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
half4 _BaseColor;
|
||||
half _Cutoff;
|
||||
float4x4 _BodyWorldToLocal;
|
||||
float4 _BodyRect;
|
||||
float4 _BodyPixels;
|
||||
float4 _BodyFlip;
|
||||
float _BodyPPU;
|
||||
float _BodyMinY;
|
||||
float _BodyMaskEnabled;
|
||||
half _BodyOpacity;
|
||||
half _BodyAlphaCutoff;
|
||||
CBUFFER_END
|
||||
|
||||
Varyings Vert(Attributes input)
|
||||
{
|
||||
Varyings output;
|
||||
output.positionWS = TransformObjectToWorld(input.positionOS);
|
||||
output.positionCS = TransformWorldToHClip(output.positionWS);
|
||||
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);
|
||||
if (_BodyMaskEnabled > 0.5)
|
||||
{
|
||||
// The comparison uses an orthographic camera and a camera-facing
|
||||
// sprite. Its local XY is the screen projection, independent of
|
||||
// the orbit's depth. Only opaque body pixels above the feet mask it.
|
||||
float2 bodyLocal = mul(_BodyWorldToLocal, float4(input.positionWS, 1)).xy;
|
||||
float2 bodyUV = (bodyLocal * _BodyFlip.xy * _BodyPPU + _BodyPixels.xy) / _BodyPixels.zw;
|
||||
if (bodyLocal.y >= _BodyMinY && all(bodyUV >= 0) && all(bodyUV <= 1))
|
||||
{
|
||||
half alpha = SAMPLE_TEXTURE2D(_BodyTex, sampler_BodyTex,
|
||||
_BodyRect.xy + bodyUV * _BodyRect.zw).a * _BodyOpacity;
|
||||
clip(_BodyAlphaCutoff - alpha - 0.0001);
|
||||
}
|
||||
}
|
||||
return color;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52bb6d7d538b49bba7e8ebd9eead2f32
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 584 B |
+38
@@ -0,0 +1,38 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 889dfaf808b74e839917845c076951e0
|
||||
TextureImporter:
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
alphaSource: 1
|
||||
alphaIsTransparency: 1
|
||||
textureCompression: 0
|
||||
spriteMode: 1
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 0
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
isReadable: 1
|
||||
streamingMipmaps: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user