Progressing in Circles

Exploring shader based circular progress bars for Unity games

The Usual Suspects

Canvas Image

Unity Canvas Image progress bar
Image component settings and wireframe
Image Component overlap compositing artifacts compared to ideal result

Ring Mesh

High poly ring mesh with UV based bar
Wireframe of high poly ring mesh showing secondary UVs
Low poly ring mesh with UV based bar
Wireframe of low poly mesh progress bar edge kink
Mesh UV progress bar rotated 15 degrees counter clockwise showing artifacts

Arc Tangent

Arc tangent progress bar
Arc tangent progress bar rotated 15 degrees counter clockwise showing aliasing on the starting edge

Texture Gradient

Gradient texture progress bar
Gradient texture progress bar with a wide smoothstep() on the edge to show precision limitations
Linear angle gradient texture

Cheaper & Better?

Rotated Mask

Rotated mask progress bar
Re-enactment of paper based progress bar thought experiment
Re-enactment of paper based progress bar thought experiment
Rotated Mask progress bar with the 3 “UV” channel masks, before and after sharpening
Vertical mask * ring alpha
Diagonal mask * ring alpha
Vertical mask * diagonal mask * ring alpha
Whoops!
Re-enactment of the paper thought experiment showing the vertical line problem
Re-enactment of the paper thought experiment with the vertical line solution and the shader’s output

Feature Creep

Progress bar as an ~300 degree arc instead of a full circle
Arc progress bar with procedural width and outlines

Additional Thoughts

Signed Distance Fields

The SDF of an arced progress bar as produced by the final shader, using Inigo Quiles’s coloring code
SDFs using manually set derivatives on the left, and ddx_fine on the right

Other Methods

Shader Graph

Math vs Instruction Count vs Cycles

--

--

Tech Artist & Graphics Programmer lately focused on Unity VR game dev. https://ko-fi.com/bgolus

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store