r/GraphicsProgramming • • 18m ago

Video Ray marched planets!

Heyo! This is partly a showcase of the early stages of my project, but also a sanity check if I'm on the right track or not with this.

I've had this idea for quite a while of rendering whole planets using ray marching SDF's, both from afar and up close, and now I've got this little demo of it. Not to go too far into it, here's a little rundown

  • Planetary surfaces are rendered using sphere assisted ray marching. It marches as closely as it can, and once it's within a tolerance, it computes the normal. This needs a lot more work, especially the SDF. Should bake something better than stock godot noise textures (which are 8 bit, among other issues).
  • Atmosphere is rendered by stepping through the atmosphere at small steps, and accumulating rayleigh and mie scattering for the final albedo and alpha.
  • Both of them use box meshes as their bounds, and those then have fragment shaders (this is also something I'm unsure about, as I've heard compute shaders might give more control; not sure if I need that control but anyway). One for the surface and one for the atmosphere.
  • I want to add clouds later but haven't looked into how yet.

At this point, without having optimized at all, it's running at around 0.75-1ms per frame, which is...fine? But there are so many bells and whistles left to add that I'm afraid the performance cost is gonna balloon, but at the same time I know there's a lot of performance magic to be done, so I thought I'd consult the wizards.

As far as I've been able to tell, there aren't really any big commercial games that go for this approach, and I'm beginning to doubt myself a tiny bit here whether this was the right approach (even though I think it looks really nice already from afar, even with just stock godot noise textures).

1 Upvotes

1 comment sorted by

•

u/AutoModerator 18m ago

Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:

  • No showcases.
  • Disclose AI usage in post or project.
  • Present a topic to talk about, e.g. how something works.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.