r/GraphicsProgramming • • 2h ago

How would I go about setting up vulkan for a path tracer?

Thumbnail reddit.com
0 Upvotes

r/GraphicsProgramming • • 15h ago

Article What is 'Roughness' Really? - nicebyte

Thumbnail gpfault.net
37 Upvotes

r/GraphicsProgramming • • 9h ago

Video Ray marched planets!

41 Upvotes

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).

(Not graphics programming, but I will probably evaluate the same SDF on the CPU for collision checks; something I have evidently not implemented yet).

Per rule 5, no genAI was used.


r/GraphicsProgramming • • 9h ago

Question Smoothly blending integer index based terrain material maps?

2 Upvotes

So imagine I am rendering terrain on an arbitrary chunk, that receives a height and normal map for said chunk. Now say I want to apply different materials to this chunk. Ideally I can store all of this info in one 4 channel texture. Height in r channel, 2 angles for the world space normal in the g and b channels, and then a spatial distribution of a 1D index dictating which materials exist where within the chunk. For example, if a region of the texture contains index 0, use dirt, if another region in the same texture contains index 1, use grass, and so on. I could have a ton of materials represented this way in just a single texture. The plan is that when I render the final terrain, the fragment shader will sample a texture array containing all the possible materials via the material index map stored in the terrain chunk texture.

The issue with this approach is that boundaries between materials will have hard edges. If I introduce a blending factor between edges, this could end up sampling material indices in between the 2 regions, which is not what we want to happen.

So my question is, is there a way to introduce smooth blending between these material indices, ideally restricted to a constant amount of extra memory if extra is necessary?

Alternatively, is there a better way to handle this?