All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Technical Implementation of Ray Marching Soft Shadows in 2D Graphics Using Distance Fields

By

memalign

6mo ago· 7 min readen

Summary

This article explains the technical implementation of ray marching soft shadows in 2D graphics, focusing on distance fields and WebGL techniques. The author, a software engineer at Figma, shares insights from a personal graphics project that gained attention on social media. The content covers the fundamentals of distance fields, how they're used to create soft shadows, and the specific WebGL implementation details for achieving the visual effects shown in the demo.

Key quotes

· 5 pulled
A couple of weeks ago I tweeted a video of a toy graphics project (below). It's not done, but a lot of people liked it which was surprising and fun!
Under the hood it uses something called a distance field. A distance field is an image like the one below that tells you how far each pixel is from your shape.
Light grey pixels are close to the shape and dark grey pixels are far from it.
Disclaimer: the demos on this page use WebGL features that aren't available on some mobile devices.
A few people asked how it works, so that's what this post is about.
Snippet from the RSS feed
Software Engineer at Figma. Previously at Dropbox. Studied Math/CS at Brown University.

You might also wanna read