Screen space reflections

Graham

Hello :-)
Veteran
Supporter
So I had an idea tonight...

Could you do screen space reflections.
Well, I'll get to the point: You can! :)

My implementation is hacky, nasty, buggy and - well - ugly. But it proves it's a workable technique.

Basically, it works like this:
For each pixel, you have position/normal. Given the vector to the pixel, you can work out the reflection vector from the surface normal.

So... Then it's a matter of taking that reflection vector and sample it at a bunch of intelligent points.
Work out where those samples project to into screen space.
For each sample, check it's depth, if the depth is closer than the sample point - then the reflection ray has impacted some screen space geometry.

Yay! Simple. Slow, but simple.
I'm sure there are a zillion ways it could be optimised.


Anywho. Here are some proof of concept pics:

*NOTE THESE ARE PROOF OF CONCEPT*

*I know they have visual issues!*

ref2.jpg


As you can see, lots of glitches :p

Here are some more (even more glitches!)

ref4.jpg

ref0.jpg
 
Now that's an interesting technique you developed there, Graham. Do you plan on ironing it out and have something useable, or did you just want to get the idea out?

Also, how does it look in motion? Usually, the screen space effects limitations really show when in motion.

And more importantly, is it cheaper than having a render target cubemap for each of these primitives?
 
Well. Now the fun part is over (seeing if it works) I'm not so keen on improving it :devilish: :mrgreen:

Then again, there are much smarter people out there who could do a much better job.
One thing which would make sense is using lower LODS on the position / colour texture the further you sample - which (in theory) would produce fake soft reflections, and require less samples and be faster :) I would do this, but XNA only allows point filtering for autogenerated mipmaps - which looks a bit naf - but does make it much faster.

It's actually not too bad in motion. It's the flickery glitch pixels obviously pop out. It's actually very stable otherwise.

As for expense, this implementation is *horribly* expensive :mrgreen:
 
Can you share any code? I'd love to improve on this. Main application would be water surfaces. By taking a reflected image and use your method to create more accurate UV of the reflected scene we should be able to get much better results. Also, for pixels outside the view or far away we can use a cube map.
 
Interesting, might be usable for some games, depending how fast the implementation can be made.
 
Interesting, but you really wouldn't want a reflective surface pointing right back at the camera. The thing I'd think this would be most useful for would be something like water reflections.
 
how would it look if you`d lift one of those objects in the air far enough so that you should see part of the bottom-side in the reflections?
This quite reminds me of old 2D-Games which draw the reflection by merely mirroring the horizontal pixel rows above it. Probably usefull for those 2.5D Games =)
 
Interesting approach, but the question is if this technique is faster than doing an actual reflection pass. Reflection passes don't need to be very expensive since they usually don't necessarily have to be very accurate.
 
Interesting approach, but the question is if this technique is faster than doing an actual reflection pass. Reflection passes don't need to be very expensive since they usually don't necessarily have to be very accurate.
Indeed, although this effect might be usefull for a self reflection/occlusion cases.
 
I remember watching this algorithm in Call of Juarez: Bound in blood.

They used it for a scene where its raining and everything is wet. It worked quite nice, you could see reflections in characters bodies, but the main problem were the objects near the camera being reflected in far away objects, like the gun being held by the player.

Anyway, nice approach.
 
I have managed create an approximation of this and what was described at Siggraph by crytek... I was wondering, when you say, "intelligently derived samples", were you referring to Secant searching?
 
I'm glad this thread was resurrected. When I heard Crytek was doing SSR I knew I'd seen the technique somewhere before.

The problem with screen space reflections is that they are screen space. Very often shiny objects are reflecting things that are not already on the screen. In fact the whole point of a mirror is to show something that you cannot presently see from your viewpoint.
 
I'm glad this thread was resurrected. When I heard Crytek was doing SSR I knew I'd seen the technique somewhere before.

The problem with screen space reflections is that they are screen space. Very often shiny objects are reflecting things that are not already on the screen. In fact the whole point of a mirror is to show something that you cannot presently see from your viewpoint.
True, but they can add some very nice visual cues and same time work as a specular mask for cubemap.

Specular AO is pretty much something I hope that all games would use as it fixes a big problem with IBL. (IE, characters tongue or eyes are lighted by light coming from behind his head, specular ssao (sssao?) or SSR would fix this easily.)
It also reduces highly aliasing edges as many of them are occluded in some way.
 
Back
Top