XaiJu
sonicether
sonicether

patreon


Dev News: Path Tracing Experiments!

So, you guys might remember me talking about how I was able to store block data in a volume texture, even off-screen blocks. Basically, I created a way to store all blocks in the scene (that are touching air or are within a certain distance).

This exciting new development opens up a whole new world of possibilities! Among those, and the most advanced of them all, is path-traced GI--a way of gathering light bounces by tracing and bouncing rays through the scene.

Those of you who are familiar enough with real-time path tracing will feel the way I did about it, "There's no way that's going to work. It'll either be too slow, or too noisy."

I just couldn't help myself, I had to give it a try, especially after seeing what could be done with just one path trace per-pixel here http://research.nvidia.com/publication/2017-07_Spatiotemporal-Variance-Guided-Filtering%3A

So, a few days ago I decided to give it a go.


The first result was a very ugly no-bounce tracing of emissive blocks (glowstone here). Still, I was surprised at how fast one sample per pixel rendered (total frame rendered at about 200 fps at 1440p on my GTX 1080). At this point I was naively blending previous frames to yield a higher effective sample count.


Next, I got one additional bounce working. The performance hit was pretty big to render an additional bounce, so I haven't bothered to trying to render more, since I think "path-traced arbitrary light sources with one bounce of GI, in real-time, in Minecraft" already sounds like a dream-come-true.


I improved temporal blending and fixed a math error, and it was looking pretty good, but still discouragingly noisy, and this was with very aggressive temporal blending that caused all sorts of psychedelic artifacts in motion.


Now I was ready to work on properly filtering the noise, something that would make or break this effect. I used the paper I linked above as a starting point, as well as my previous experience in filtering GI noise (working on voxel cone tracing).

First, I built a more robust temporal blending function that would outright reject previous samples that didn't match the current frame's depth, so that eliminated ghosting problems. Then, I ended up using a bilateral blur to smooth out the noise while keeping edges sharp. A standard bilateral blur ended up being way too slow, so I tried using fewer samples and applying random offets, hoping that my already existing Temporal Anti-Aliasing solution would clean up the remaining noise.


I was pretty surprised by the results!

The blur used to eliminate noise does blur out the detailed contact shadows near block edges, which I'd like to see what I can do about, but even if I can't solve it I'm more than happy with how it's turning out! These scenes were rendered at 50-60 fps at 1440p on my GTX 1080. That may improve, since it's in a pretty unoptimized state currently.

And once again, here's the input to the last image, one sample-per-pixel path traced GI:

Pretty crazy!

There are some limitations currently. Right now, non-full-block objects (stairs, fences, slabs, etc.) aren't considered. For that, I'll need to keep track of block data in the volume, and then do the final collision test with different bounding boxes instead of the full-sized one I'm using now. That doesn't seem too bad, since the most complex block is a fence, and that can be rendered with three bounding boxes, but there's no way to know for sure until I try it.

Secondly, I'm not doing anything special to try to efficiently skip empty space during tracing currently, so GI is limited to a radius of 20 blocks. If my idea for empty space skipping works, that radius should increase without too much of a performance impact.

Also, dynamic entities (mobs and players) can't contribute to GI, since there's no way to represent them in the volume. Screen-space tracing or SSAO might help that.

I'm curious to see if you guys are as excited about this as I am! I'll likely be uploading an experimental build with this so you can try it yourself soon.

Comments

where do i get the discord link

hpw do i get this

You're doing Herobrine's work sir! All you've done is so immensely impressive to me, it's like magic. Renewed is running so buttery for me on 1440p now, I've just been walking around climbing the next hill... and the next. And the water; I don't even, I keep drowning because my jaw keeps dropping. Any realistic way of improving UHD performance, or is rendering 4x 1080p just too heavy for ~GTX 1080?

Dose want.

Brendan George


More Creators