Jump to content
  • Advertisement
Sign in to follow this  
grizu

Deferred reflection probes

Recommended Posts

Hello everyone,

I currently play around with reflection probes in a deferred renderer and I'm a bit stuck on how to apply the probes. I have one global skybox and several local probes with bounding boxes, which may overlap. So - my questions are:

1) In a forward renderer I would bind all the probes, find the ones that influence the current object and blend them somehow. For deferred I would basically render the probes' volumes, but how can I calculate individual weights if I just render volume after volume? I've read through this article and some of the references, but couldn't find anything, sorry if I overlooked something.

2) Low resolution reflection probes should not contain the skybox. I would like to use the high resolution skybox as reflection source for any pixel that reflects the sky. Would this work / does this make sense? Maybe with using the stencil buffer somehow to mask those "unrendered" areas?

I'm touching this subject for the first time, so any help or pointers in the right direction is greatly appreciated. Thanks! 

Share this post


Link to post
Share on other sites
Advertisement
5 hours ago, grizu said:

but how can I calculate individual weights if I just render volume after volume?

I guess you have to sum up the contribution from all volumes and finally divide by that. (Likely your volumes have soft transition borders so their contribution varies.)

I don't know how the article handles this.

 

5 hours ago, grizu said:

Would this work / does this make sense? Maybe with using the stencil buffer somehow to mask those "unrendered" areas?

You could use an alpha of zero in the low res probes where they show the sky, and multiply their contribution by that alpha. Then the high res sky should show up automatically.

Not sure if it looks good the distant sky is sharper than the closer reflection from the local probes, but worth a try.

Share this post


Link to post
Share on other sites
12 hours ago, JoeJ said:

I guess you have to sum up the contribution from all volumes and finally divide by that. (Likely your volumes have soft transition borders so their contribution varies.)

I don't know how the article handles this.

The article doesn't describe this step. I can't simply sum and divide, because there may be areas where a probe completely overrides another (local probe overriding the skybox), and also a border region where the probes blend.

I just got the idea - I could use simple transparent blending (srcAlpha - OneMinusSrcAlpha) to effectively lerp between the current probe and what is already in the reflection buffer. Not sure if the calculation would be 100% correct, and I guess this would lead to plopping if the order of the probes changes.

I'm just curious how others do this :) I also stepped through the unity frame debugger, and they seem to do something with the stencil buffer, but I haven't yet figured out what.

12 hours ago, JoeJ said:

Not sure if it looks good the distant sky is sharper than the closer reflection from the local probes, but worth a try.

That came to my mind as well :) Thanks for the suggestion!

Share this post


Link to post
Share on other sites
30 minutes ago, grizu said:

I can't simply sum and divide, because there may be areas where a probe completely overrides another (local probe overriding the skybox), and also a border region where the probes blend

I would exclude the global sky from the accumulation, and only if the final sum is less than one add the sky by (1-sum)

Share this post


Link to post
Share on other sites
On 11/28/2018 at 1:37 PM, JoeJ said:

I would exclude the global sky from the accumulation, and only if the final sum is less than one add the sky by (1-sum)

Ok!
Thanks for your help. For now I've got enough to play around with :)

Share this post


Link to post
Share on other sites

I'll mention that your blending capabilities are limited if you have to rely on the hardware's blend mode. This changes are if you are able to do it in a single draw call by iterating over a light list in your shader. This generally requires you to go to a tiled approach to reduce cost, but depending on your use case it might be fast enough just to loop through all the lights and reject them based off of bounds.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!