Make the x-ray pulse an asymmetric rising curve
Replace the symmetric sine with a raised cosine raised to _XRayPulseShape: a long near-zero plateau, a slow rise and a short full peak. Both shader halves use the identical formula to stay in phase. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
ff034870fc
commit
ae0e2de7cf
2 files changed
+20
-11
No files matched your search
@@ -55,7 +55,8 @@ float4 _OcclusionMap_TexelSize;
|
||||
// the separate XRayOverlay pass (SRPDefaultUnlit) covers the OCCLUDED parts. See CamoForwardFragment.
|
||||
half4 _XRayColor;
|
||||
half _XRayPulseSpeed; // 0 = steady; otherwise breathing pulse via _Time (see CamoForwardFragment)
|
||||
half _XRayPulseStrength; // modulation depth of the pulse around the authored intensity
|
||||
half _XRayPulseStrength; // modulation depth: how far the trough dims below the full-intensity peak
|
||||
half _XRayPulseShape; // >1 bends the pulse: longer near-off plateau, rising to a brief full peak
|
||||
|
||||
// Remaps the painted occlusion/height value into surface AO + a relief normal. Runs after URP's
|
||||
// InitializeStandardLitSurfaceData (uv is already parallax-displaced) and before InitializeInputData,
|
||||
@@ -298,9 +299,12 @@ void CamoForwardFragment(
|
||||
// same additive term here reveals the glow on the visible parts too. Visible (here) and occluded
|
||||
// (overlay, ZTest Greater) are mutually exclusive by depth => no double contribution. Added
|
||||
// post-fog to match the overlay, which outputs the raw color.
|
||||
// Breathing pulse (sin over _Time) on the glow master, matching the XRayOverlay pass exactly so the
|
||||
// visible and occluded halves stay in phase. Speed 0 => term is 1 => identical to no pulse.
|
||||
half xrayPulse = 1.0h + sin(_Time.y * _XRayPulseSpeed) * _XRayPulseStrength;
|
||||
// Asymmetric breathing pulse on the glow master, matching the XRayOverlay pass exactly so the visible
|
||||
// and occluded halves stay in phase. A raised cosine (0..1, peak once per cycle) raised to _XRayPulseShape
|
||||
// rises from a long near-off plateau to a brief peak; _XRayPulseStrength sets how deep the trough dims
|
||||
// (peak stays at the authored intensity). Speed 0 => cos term constant => steady glow.
|
||||
half xrayCurve = pow(0.5h - 0.5h * cos(_Time.y * _XRayPulseSpeed), _XRayPulseShape);
|
||||
half xrayPulse = 1.0h - _XRayPulseStrength * (1.0h - xrayCurve);
|
||||
color.rgb += _XRayColor.rgb * (_XRayColor.a * xrayPulse);
|
||||
|
||||
color.a = OutputAlpha(color.a, IsSurfaceTypeTransparent(_Surface));
|
||||
|
||||
Reference in new issue
Block a user