You are browsing as a guest. Sign up (or log in) to start making projects!

SDF Ray Tracing

  • 3 Devlogs
  • 7 Total hours

Ray tracing engine which uses Signed Distance Fields

Open comments for this post

1h 8m 43s logged

Added shadows, another ray is just traced from the original hit towards the “sun”, and if it passes close to objects or hits objects, the colour is multiplied by some kind of factor. It was a great pain stopping the shadow ray intersecting the shape that was hit instantly, making everything look dark, as the start position must be moved out of the shape, but that can cause artifacts. This was fixed with a “bias” variable, which determines how steep the intersection was, and moves the position out of the shape accordingly.

0
0
8
Open comments for this post

1h 2m 56s logged

Not much progress this time, just normals for lighting, but I discovered the SDF of a ‘Mandelbulb’; a 3D version of a Mandelbrot fractal. I don’t really understand the function, but it produces the image underneath.

0
0
4
Open comments for this post

4h 30m 14s logged

I have set up WGPU with Rust to run a compute shader to render to a texture, which is then rendered to the screen. The compute shader ray traces using signed distance functions, stepping as far as the closest object at a time.
There is also a simple, FPS-style camera implementation, so the scene can be looked around.
Next, I plan to improve the graphics, with basic lighting and shadows, and perhaps materials instead of colours.
I’m not sure where this project will go, but hopefully something interesting will come of it.
The picture shows a sphere and long cuboid, a smin function used on them, with different parameters, causes them to blend. This is only one of the many interesting properties of SDFs.

0
0
5

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…