Add see-through X-ray reveal overlay for players
Add a second, additive HDR emission color (_XRayColor) that reveals a player through walls as a pulsing energy glow, driven during matches: - Shader: XRayOverlay pass (ZTest Greater, additive) for occluded parts plus a matching additive term in the forward fragment for visible parts, so the glow shows everywhere and never double-blends. Exposes _XRayColor, _XRayPulseSpeed and _XRayPulseStrength for a breathing pulse. - Render it after opaques via a RenderObjects feature (custom XRayReveal light-mode tag) on both PC and Mobile renderers, so the through-wall test is depth-sort independent and no longer drops out at some camera angles/distances. - MeshPainter drives _XRayColor alpha through a framerate-independent fade (xrayFadeDuration) rather than a hard toggle. - Reveal is driven per avatar on every client: all remaining un-found hiders glow during the Resolution phase, and a hider whose ConcealmentMeter EmbeddedPercent exceeds MatchManager.embeddedRevealPercent glows via an owner-authoritative NetworkVariable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
d7104f9314
commit
c54e0cf502
8 files changed
+338
-13
No files matched your search
@@ -260,4 +260,19 @@ public partial class MeshPainter
|
||||
if (_materialInstance && _materialInstance.HasProperty(EmissionColorId))
|
||||
_materialInstance.SetColor(EmissionColorId, Color.white * Mathf.Max(0f, emissionIntensity));
|
||||
}
|
||||
|
||||
/// <summary>Eases the see-through X-ray glow's alpha toward its on/off target (<see cref="XRayRevealed"/>)
|
||||
/// at a constant rate, so the reveal fades in/out over <c>xrayFadeDuration</c> seconds instead of popping.
|
||||
/// Rgb is left untouched (the authored glow colour). Only writes the material on an actual change, and
|
||||
/// snaps instantly when the duration is 0.</summary>
|
||||
private void TickXRayFade()
|
||||
{
|
||||
if (!_materialInstance || !_materialInstance.HasProperty(XRayColorId)) return;
|
||||
Color c = _materialInstance.GetColor(XRayColorId);
|
||||
float step = xrayFadeDuration > 0f ? Time.deltaTime / xrayFadeDuration : 1f;
|
||||
float a = Mathf.MoveTowards(c.a, _xrayTarget, step);
|
||||
if (a == c.a) return; // already at target -> no material write
|
||||
c.a = a;
|
||||
_materialInstance.SetColor(XRayColorId, c);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user