Hunter shot: replicated laser beam + X-ray hit flash; snapshot apply in-place reseed
- Laser.shader + HunterLaserBeam: additive HDR beam, fade in/out over opacity and thickness, code-driven LineRenderer, tunable emission multiplier. - FirstPersonMode: TryShoot computes world endpoint, fires beam with lateral muzzle offset (right) so it isn't dead-center from hunter view. - NetworkPlayerSetup: shot relay RPCs (owner->server->all) + hit-flash RPC (server->all), flash OR-branch in ComputeXRay. - MatchManager: hit reveal broadcasts X-ray flash first, delays hider removal by hitRevealDelay so the glow is visible before the body vanishes. - MeshPainter reseed: in-place fast path avoids full GPU backend teardown on snapshot apply (no ~70MB RT churn), fixes spawn/paint-load hitch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
5b95cb7f56
commit
9290ef650b
10 files changed
+403
-23
No files matched your search
@@ -0,0 +1,67 @@
|
||||
Shader "Chameleon/Laser"
|
||||
{
|
||||
// Unlit additive beam for the hunter's shot LineRenderer. The animated fade (opacity) is carried by the
|
||||
// per-vertex colour alpha the HunterLaserBeam writes each frame; _Color is the constant HDR tint.
|
||||
Properties
|
||||
{
|
||||
[HDR] _Color ("Color", Color) = (1, 0.25, 0.18, 1)
|
||||
_Softness ("Edge Softness", Range(0, 1)) = 1
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "RenderPipeline" = "UniversalPipeline" "IgnoreProjector" = "True" }
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "LaserAdditive"
|
||||
Blend One One // pure additive glow (vertex-alpha folded into rgb below)
|
||||
ZWrite Off
|
||||
Cull Off
|
||||
ZTest LEqual // the beam is occluded by nearer opaque geometry
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionHCS : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
half4 _Color;
|
||||
half _Softness;
|
||||
|
||||
Varyings vert (Attributes IN)
|
||||
{
|
||||
Varyings OUT;
|
||||
OUT.positionHCS = TransformObjectToHClip(IN.positionOS.xyz);
|
||||
OUT.color = IN.color;
|
||||
OUT.uv = IN.uv;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
half4 frag (Varyings IN) : SV_Target
|
||||
{
|
||||
// LineRenderer maps UV.y across the strip width (0..1): bright core, soft edges.
|
||||
half across = abs(IN.uv.y * 2.0h - 1.0h);
|
||||
half edge = lerp(1.0h, saturate(1.0h - across), saturate(_Softness));
|
||||
half intensity = IN.color.a * edge; // vertex alpha = animated fade envelope
|
||||
half3 rgb = _Color.rgb * IN.color.rgb * intensity;
|
||||
return half4(rgb, 1.0h); // additive (Blend One One) -> alpha unused
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
Fallback Off
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e868169b3164c042b31a3312f865345
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user