ScratchData LogoScratchData
Back to ABC124816's profile

Raymarcher Physics - Spheres

ABABC124816•Created July 27, 2024
Raymarcher Physics - Spheres
4
3
24 views
View on Scratch

Instructions

Turbo mode or turbowarp recommended (though not necessary.) Arrow keys to move. Mouse to aim light. Range slider to adjust how wide your field of vision is. (For high values use turbowarp.)

Description

So I heard about raymarching and how we can create 3D scenes much faster using it (This project is a start, not 3D yet!) by calculating the exact mathematical distance from the closest point in a scene, in order to move the rays while ray-casting much faster, effectively 'marching' them closer to a collision. It also gives collision detection for free (though my implementation has a few bugs) as well as making objects into holes and creating special effects. In this project, we first calculate the distance of a point from a sphere, since that's the easiest one I can think of, as it is so symmetrical (the rectangle has many edge cases around the corners so it will be a bit complicated, especially if we extend it to 3D cuboids.) To render multiple objects, we just calculate the distance to the closest point on each of them and take the smallest value.

Project Details

Project ID1050200357
CreatedJuly 27, 2024
Last ModifiedAugust 3, 2024
SharedAugust 3, 2024
Visibilityvisible
CommentsAllowed