Implementing Screen Space Glossy Reflections

Just added a new article to my small blog showing how to implement screen space cone tracing to simulate glossy reflections. Hopefully there's enough there to get anyone interested in implementing this or a similar technique up and running.

Link

Posted Jul 12, 2015, 5:16 PM UTC

535
mattdesl•

This looks like an awesome resource. I haven't had time to read through it fully; but it looks like it should be possible to implement in any standard real-time game engine? Is there any GitHub repo with all of the code?

Thanks for the writeup!

3
olej•

Yasin Uludag, the author of the article about SSR in new Mirror's Edge that u/willp based his implementation on, wrote in his conclusions that the whole algorithm takes ~0.75ms on GTX 670 in half-res (960x540) so it seems like a no brainer :)

2
willpOP•

Hey u/mattdesl,

The reason I left timings out of my post is that I have a very high end card, and since it's a hobby project I don't have a slew of PCs with varying specs to test on to get an accurate measurement. u/olej is correct, though, the implementation is based on Yasin Uludag's GPU Pro 5 article, and the timings he got for his implementation should at least be in the same ballpark as this implementation. I have Uludag's method implemented in my engine and can toggle between the two and the timings for both are typically very similar. Increasing stride length while decreasing the maximum number of steps is the biggest performance boost for this implementation, but you may need to add in a small binary search to the end of the trace if your stride gets really high. I typically leave the stride from 3 to 8 and the maximum steps around 80 to 150, though most rays will never need that much (and my hardware makes this non-insane :) ).

The code is in a private repository on BitBucket for now, but mainly because I'm currently trying to add DirectX 12 support and things are a little "interesting" at the moment. I went back to one of my tags and pulled out some client code that you're welcome to look at though. It should at least give you an idea of the steps necessary on the client side to get the effect running. I added a few comments about what certain classes are in my project, but if you have any questions, let me know and I'll be happy to answer them.

All the code is written in C++ and can be found here.

2
mattdesl•

Thanks for the reply! I will keep an eye on your blog since it seems to be a pretty great resource.

1
orost•

Programmer art notwithstanding, that's a really good article. When I have hardware capable of doing such things I'll definitely have a go at implementing the technique based on your post.

3