Inspiration

We wanted to make a graphics project using Rust that would show off our strengths within the graphics category while also incorporating some more traditional programming.

What it does

Models a solar system using ray marching, with randomly generated planets that orbit a central sun. The planets interact with each other, changing their orbits. You can even pan around the scene to get a better look!

How we built it

We used wgpu and a variety of Rust libraries, including winit and nalgebra. For the physics, a numerical model of the solar system and some algebra libraries did the trick. For our shader pipeline, we adapted some GLSL shaders to WGSL to enable our ray marching algorithm as well as lighting, coloring, and shadows.

Challenges we ran into

Rendering stuff is really hard. We didn't get anything coherent rendering to the screen until the second day, where our progress was steady until around 11PM where everything fell into place. Version conflicts in packages also created issues.

Accomplishments that we're proud of

We got a lot more than we bargained for; the lighting works solidly, the physics work as expected, and the performance isn't even half bad for something that is sending out nearly 100 million rays per second without using any specialized hardware.

What we learned

Sometimes, something clicks and everything just falls into place.

What's next for Celestial Simulator

There's a lot of polishing we can do: we have plans to add a GUI to allow you to create custom planets to add to the simulation, we want to also texture the planets rather than having them just be a solid color, and there's always the performance problem to fix.

Built With

  • imgui
  • nalgebra
  • rust
  • wgpu
  • wgsl
Share this project:

Updates