Radial Stamina was our replacement for the old stamina system in Operation Starfall.
Built using ShaderGraph, this was my first hands-on shader project.
Developed collaboratively with
J5X.
Creating this stamina system meant stepping out of my comfort zone and diving into shaders. Instead of a code-only approach, I explored how to build gameplay features through visual scripting. I pair-programmed parts of the stamina logic with another developer, while focusing on ShaderGraph with pointers from both the art and technical directors.
Gif of the Radial
It was inspired by the stamina radial in Zelda: BotW.
At first, grasping how shaders manipulate graphics was a challenge. Trial, error, and lots of debugging slowly revealed how to control colors, masks, and timing. Eventually, the system clicked: it felt less like abstract math and more like designing a visual feature. Seeing the radial animate correctly in-game was a rewarding payoff for the effort.
Functions from the script.
In the snippet above you can see the code of when the stamina bar is depleted and how long it takes to regenerate the stamina back.
How the radial would look in game
As seen above the stamina radial goes empty when running and when it hits 0, it plays an
animations and then regenerates the stamina back over time.
By leveraging shaders, we created a stamina system that was both functional and visually aligned with the game’s style. For me, this feature was a turning point — from seeing shaders as intimidating, to recognizing them as a powerful tool for gameplay and atmosphere.
Full Shader Graph Overview:
This graph uses a radial mask to visualize stamina, with time-based fade logic and dynamic alpha blending based on gameplay inputs.
The Shader is split into three key sections, each responsible for a part of the stamina ring's visual behavior.
This section manages fade-in and fade-out behavior based on stamina events.
Fade-In:
StaminaUpdateTime from Time to get the time since the last update.Sign and Saturate to convert it into a clean 0–1 fade-in value.Fade-Out:
Time from (StaminaUpdateTime + MaxStaminaTime + FadeTime).FadeTime, then clamp using Sign and Saturate.
We multiply the fade-in and fade-out values to produce the final Alpha visibility.
This section handles the visual texture of the ring:
MainTexture's RGBA output with the MainColor parameter.This section shapes the ring using a radial threshold mask:
Left: Radial gradient input mask provided by the artist. Right: The radial texture used for the stamina ring’s shape.
MaskTexture, subtract 1.0, and add StaminaPercentage.Sign and Saturate to create a clean radial cutoff.MainTexture to preserve soft edges.Combined Result: These three sections work together to render a clean radial stamina bar, blending soft transitions, dynamic visibility, and clear mask-driven shaping.