2
0
Fork 0

实体消融shader

master
cd 2 years ago
parent 62be5e82c9
commit d6596e06f8

@ -21,6 +21,6 @@ MonoBehaviour:
mLastUsedPackagesHash: 1177269412 mLastUsedPackagesHash: 1177269412
mLastUsedPackagesCount: 1 mLastUsedPackagesCount: 1
mLastBuildCode: 1 mLastBuildCode: 1
mLastEditorStartupTimeTicks: 638214577828442584 mLastEditorStartupTimeTicks: 638214577847877530
mNewVersionAvailable: 1 mNewVersionAvailable: 1
mLastAttachedFlowPlayerValue: 0 mLastAttachedFlowPlayerValue: 0

@ -43,6 +43,10 @@ Material:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _FadingTex:
m_Texture: {fileID: 2800000, guid: 98b64212b777b704896163bb7d44c346, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex: - _MainTex:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
@ -51,6 +55,10 @@ Material:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _NoiseTex:
m_Texture: {fileID: 2800000, guid: 98b64212b777b704896163bb7d44c346, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap: - _OcclusionMap:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
@ -84,6 +92,7 @@ Material:
- _DetailNormalMapScale: 1 - _DetailNormalMapScale: 1
- _DstBlend: 0 - _DstBlend: 0
- _EnableExternalAlpha: 0 - _EnableExternalAlpha: 0
- _FadingWidth: 0.1
- _Flash: 0 - _Flash: 0
- _GlossMapScale: 1 - _GlossMapScale: 1
- _Glossiness: 0.358 - _Glossiness: 0.358
@ -113,6 +122,7 @@ Material:
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1}
- _Direction: {r: 2, g: 1, b: 0, a: 0} - _Direction: {r: 2, g: 1, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FadingColor: {r: 1, g: 1, b: 0.5518868, a: 1}
- _FlashColor: {r: 1, g: 1, b: 1, a: 1} - _FlashColor: {r: 1, g: 1, b: 1, a: 1}
- _Flip: {r: 1, g: 1, b: 1, a: 1} - _Flip: {r: 1, g: 1, b: 1, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1} - _RendererColor: {r: 1, g: 1, b: 1, a: 1}

@ -67,6 +67,10 @@ Material:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _NoiseTex:
m_Texture: {fileID: 2800000, guid: 89aee6e5903b6a343b5d3533c4a48949, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Normal: - _Normal:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
@ -119,7 +123,7 @@ Material:
- _UVSec: 0 - _UVSec: 0
- _UseUIAlphaClip: 0 - _UseUIAlphaClip: 0
- _Use_Gradient: 1 - _Use_Gradient: 1
- _Width: 4 - _Width: 1
- _ZWrite: 1 - _ZWrite: 1
- _cutoff: 0 - _cutoff: 0
m_Colors: m_Colors:

@ -13,6 +13,9 @@ Shader "Custom/Character"
_Direction ("Direction", Vector) = (0, 1, 0, 0) _Direction ("Direction", Vector) = (0, 1, 0, 0)
_Intensity ("Intensity", Range(0.0, 1.0)) = 0 _Intensity ("Intensity", Range(0.0, 1.0)) = 0
_UV ("UV", Vector) = (0, 0, 0, 0)//uv中心xyuv边界 _UV ("UV", Vector) = (0, 0, 0, 0)//uv中心xyuv边界
_FadingTex ("FadingTex", 2D) = "white" {}
_FadingColor ("FadingColor", Color) = (1,1,1,1)
_FadingWidth ("FadingWidth", Range(0,1)) = 0
} }
SubShader SubShader
{ {
@ -30,6 +33,7 @@ Shader "Custom/Character"
sampler2D _MainTex; sampler2D _MainTex;
sampler2D _PaletteTex; sampler2D _PaletteTex;
sampler2D _ReplaceTex; sampler2D _ReplaceTex;
sampler2D _FadingTex;
fixed4 _Color; fixed4 _Color;
fixed _Flash; fixed _Flash;
fixed4 _FlashColor; fixed4 _FlashColor;
@ -38,6 +42,8 @@ Shader "Custom/Character"
fixed4 _Direction; fixed4 _Direction;
fixed _Intensity; fixed _Intensity;
fixed4 _UV; fixed4 _UV;
fixed4 _FadingColor;
fixed _FadingWidth;
struct Input struct Input
{ {
@ -81,8 +87,25 @@ Shader "Custom/Character"
{ {
rgb = rgb * (_Flash + 1) * _FlashColor; rgb = rgb * (_Flash + 1) * _FlashColor;
} }
//消融
fixed2 nioseUV = fixed2((bound.x + uv.x) / (bound.y - bound.x), (bound.z + uv.y) / (bound.w - bound.z));
fixed4 noise = tex2D(_FadingTex, nioseUV * 40);
if (_Alpha < noise.r - _FadingWidth)
{
discard;
}
if (_Alpha < noise.r)
{
o.Albedo = _FadingColor;
o.Emission = _FadingColor;
}
else
{
o.Albedo = rgb * _Color; o.Albedo = rgb * _Color;
o.Alpha = _Alpha * c.a; }
o.Alpha = c.a;
clip(o.Alpha - 0.5); clip(o.Alpha - 0.5);
} }
ENDCG ENDCG

@ -2,25 +2,27 @@ Shader "Custom/DeadBody"
{ {
Properties Properties
{ {
_Color ("Color", Color) = (1,1,1,1)
[PerRendererData]_MainTex ("Sprite Texture", 2D) = "white" {} [PerRendererData]_MainTex ("Sprite Texture", 2D) = "white" {}
_NoiseTex ("Noise Texture", 2D) = "white" {}
_Alpha ("_Alpha", Range(0,1)) = 1 _Alpha ("_Alpha", Range(0,1)) = 1
_Width ("_Width", Range(0,1)) = 1
} }
SubShader { SubShader {
Tags {"Queue" = "Transparent" "RenderType"="Transparent" } Tags
{
ZWrite Off "Queue" = "Geometry"
}
Cull Off Cull Off
ZWrite On
CGPROGRAM CGPROGRAM
#pragma surface surf Lambert alpha:fade #pragma surface surf Lambert addshadow fullforwardshadows
#pragma target 3.0 #pragma target 3.0
sampler2D _MainTex; sampler2D _MainTex;
fixed4 _Color; sampler2D _NoiseTex;
fixed _Cutoff;
fixed _Flash;
fixed _Alpha; fixed _Alpha;
fixed _Width;
struct Input struct Input
{ {
@ -28,10 +30,11 @@ Shader "Custom/DeadBody"
}; };
void surf (Input IN, inout SurfaceOutput o) { void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color; fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
fixed3 rgb = (_Color.rgb*(_Flash+1))*(c.rgb); fixed4 noise = tex2D(_NoiseTex, IN.uv_MainTex);
o.Albedo = rgb; o.Albedo = c;
o.Alpha = _Alpha*c.a; o.Alpha = c.a;
clip(o.Alpha - 0.5);
} }
ENDCG ENDCG
} }

@ -47,7 +47,7 @@ public class DieSystem : IExecuteSystem, IInitializeSystem
else else
{ {
//创建尸体特效 //创建尸体特效
entity.CastShadow(2000, ECastShadowType.DeadBody); entity.CastShadow(1000, ECastShadowType.DeadBody);
//掉落pt //掉落pt
CreatePt(entity.Pos()); CreatePt(entity.Pos());
//死亡事件通知 //死亡事件通知

@ -104,8 +104,6 @@ namespace Game
{ {
info.Continue = true; info.Continue = true;
} }
Util.Print(info.Continue);
skill.HitInfo.Enqueue(info); skill.HitInfo.Enqueue(info);
} }
} }

@ -50,7 +50,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
- {fileID: 2100000, guid: 673285d80149b5c4e914c503fa048f1b, type: 2} - {fileID: 2100000, guid: 8b75e4f77efb4b942bff540369576f7d, type: 2}
m_StaticBatchInfo: m_StaticBatchInfo:
firstSubMesh: 0 firstSubMesh: 0
subMeshCount: 0 subMeshCount: 0
@ -71,13 +71,13 @@ SpriteRenderer:
m_SortingLayerID: -248419617 m_SortingLayerID: -248419617
m_SortingLayer: 3 m_SortingLayer: 3
m_SortingOrder: -1 m_SortingOrder: -1
m_Sprite: {fileID: 9044786021765537137, guid: 8142b0399fe09a14c929e8dfcba09863, m_Sprite: {fileID: -6357392960514800984, guid: 51ef05ddfb1119e40b42882a835844a9,
type: 3} type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
m_DrawMode: 0 m_DrawMode: 0
m_Size: {x: 2, y: 1} m_Size: {x: 2, y: 2}
m_AdaptiveModeThreshold: 0.5 m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0 m_SpriteTileMode: 0
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1

@ -1,9 +1,9 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 98b64212b777b704896163bb7d44c346 guid: 98b64212b777b704896163bb7d44c346
TextureImporter: TextureImporter:
fileIDToRecycleName: {} internalIDToNameTable: []
externalObjects: {} externalObjects: {}
serializedVersion: 9 serializedVersion: 11
mipmaps: mipmaps:
mipMapMode: 0 mipMapMode: 0
enableMipMap: 0 enableMipMap: 0
@ -23,6 +23,7 @@ TextureImporter:
isReadable: 0 isReadable: 0
streamingMipmaps: 0 streamingMipmaps: 0
streamingMipmapsPriority: 0 streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0 grayScaleToAlpha: 0
generateCubemap: 6 generateCubemap: 6
cubemapConvolution: 0 cubemapConvolution: 0
@ -31,7 +32,7 @@ TextureImporter:
maxTextureSize: 2048 maxTextureSize: 2048
textureSettings: textureSettings:
serializedVersion: 2 serializedVersion: 2
filterMode: -1 filterMode: 0
aniso: -1 aniso: -1
mipBias: -100 mipBias: -100
wrapU: -1 wrapU: -1
@ -54,21 +55,38 @@ TextureImporter:
textureType: 0 textureType: 0
textureShape: 1 textureShape: 1
singleChannelComponent: 0 singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0 maxTextureSizeSet: 0
compressionQualitySet: 0 compressionQualitySet: 0
textureFormatSet: 0 textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 1
platformSettings: platformSettings:
- serializedVersion: 2 - serializedVersion: 3
buildTarget: DefaultTexturePlatform buildTarget: DefaultTexturePlatform
maxTextureSize: 2048 maxTextureSize: 2048
resizeAlgorithm: 0 resizeAlgorithm: 0
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 0
compressionQuality: 50 compressionQuality: 50
crunchedCompression: 0 crunchedCompression: 0
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
androidETC2FallbackOverride: 0 androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []
@ -76,10 +94,12 @@ TextureImporter:
physicsShape: [] physicsShape: []
bones: [] bones: []
spriteID: spriteID:
internalID: 0
vertices: [] vertices: []
indices: indices:
edges: [] edges: []
weights: [] weights: []
secondaryTextures: []
spritePackingTag: spritePackingTag:
pSDRemoveMatte: 0 pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0 pSDShowRemoveMatteOption: 0

Loading…
Cancel
Save