Skip to content

Bloodloss desaturation overlay with species blood colors, configurable intensity ramp, and vision ZIndex ordering#4303

Open
teecoding wants to merge 2 commits intonew-frontiers-14:masterfrom
teecoding:feat/bloodloss-species-colors
Open

Bloodloss desaturation overlay with species blood colors, configurable intensity ramp, and vision ZIndex ordering#4303
teecoding wants to merge 2 commits intonew-frontiers-14:masterfrom
teecoding:feat/bloodloss-species-colors

Conversation

@teecoding
Copy link

About the PR

Replaces the hardcoded red-only bloodloss drunkenness effect with a fullscreen desaturation shader that preserves the species' actual blood color. The world fades to grayscale as you lose blood, but your species' blood color stays vivid on screen.

Why / Balance

  • Species identity: Previously all species saw red preserved during bloodloss, even if their blood is blue (Arachnid), olive (Moth), or green (Slime). Now each species sees their own blood color preserved.
  • Earlier feedback: Linear ramp meant you had to lose ~50% blood for 50% desaturation. The square root curve gives ~32% desaturation at just 10% blood loss, making the warning noticeable sooner.
  • Cleaner visual: Desaturation is a cleaner bloodloss indicator than the drunkenness wobble, which was confusing and overlapped with actual intoxication effects.
  • Overlay ordering: Without a ZIndex, bloodloss could render behind species vision overlays (e.g., Harpy UltraVision). Now it always layers on top.

Technical details

  • bloodloss.swsl: New uniforms bloodColor (vec3) and intensityPower (float). Converts both pixel and blood color to HSV, uses min(|diff|, 360-|diff|) for circular hue distance within 15-degree tolerance. Applies pow(intensity, intensityPower) for the ramp curve.
  • shaders.yml: Added Bloodloss shader prototype with intensityPower: 0.5 default param.
  • BloodlossOverlay.cs: Added BloodColor field (default #800000), passes it as vec3 to shader. Set ZIndex = 5.
  • BloodlossOverlaySystem.cs: Added IPrototypeManager dependency. Each frame looks up BloodstreamComponent.BloodReagent -> ReagentPrototype.SubstanceColor to set the overlay's blood color.
  • SharedBloodstreamSystem.cs: Commented out _drunkSystem calls for bloodloss with Frontier markers. Stutter effect is preserved.

How to test

  1. Spawn as a Human. Lose blood, confirm world desaturates while red stays vivid. Effect should be noticeable by ~80% blood remaining.
  2. Spawn as any non-red blood species (Moth, Arachnid, Slime). Confirm their blood color is the one preserved.
  3. Modify intensityPower in shaders.yml to 1.0 (linear) or 0.3 (aggressive). Confirm the ramp changes accordingly.
  4. Spawn as a Harpy (has UltraVision overlay at ZIndex 0). Lose blood, confirm bloodloss desaturation layers correctly on top of the vision overlay.
  5. Die. Confirm the overlay fades out (other overlays handle death visuals).
  6. Confirm no drunkenness wobble from bloodloss (stutter should still occur).

Media

image image

Requirements

Breaking changes

None.

Changelog

🆑

  • tweak: Bloodloss now causes screen desaturation instead of drunkenness wobble while preserving species' blood color

…onfigurable intensity ramp, and vision ZIndex ordering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blood loss shader needs to be a fade to gray

1 participant