ScratchData LogoScratchData
Back to CasTur's profile

Ray Marching visualized

CACasTur•Created June 12, 2021
Ray Marching visualized
89
52
741 views
View on Scratch

Instructions

Greetings, Scratcher Move with the arrow keys. Change the slider that appears when you hover your mouse over the top of the canvas to change the number of objects in the scene. Ray Marching finds where the ray (blue) collides with an object (white). It does this by calculating the shortest distance to the objects in the scene (orange) and then moves along the ray with that distance. This ensures that the ray never goes past said intersection. Ray marching is often used to simulate light in photorealistic rendering. Ray casting works the same way with the exception that the step size is constant; ray marching is therefore generally faster.

Description

All code by me, @CasTur Kind of inspired by Jamie Wong: http://jamie-wong.com/2016/07/15/ray-marching-signed-distance-functions/

Project Details

Project ID543694030
CreatedJune 12, 2021
Last ModifiedJune 12, 2021
SharedJune 12, 2021
Visibilityvisible
CommentsAllowed