5
$\begingroup$

I have multiple reflection cube map that's prebaked before a scene.

However I am being confused as to which one to choose.

I am told I need to choose "closest cube map" then use it.

However it is unclear to me that whether I should do that based off of per pixel or per object(object's position).

I looked at Unity to get some ideas as well.

Unity chooses a reflection probe based off of distance and area probe affects the object.

However there is no clear "do this". So I am tentative and left unsure.

$\endgroup$
4
$\begingroup$

Are you trying to make your own rendering engine?

Here is a solution that prioritizes visual quality ; it is slightly more complex than the object-based solution you are referring to.
For better visual quality your shading should be on a per-pixel basis.
(If you highly prioritize performance, or do not require detailed reflections, you should probably stick to the object-based solution though).

If you are doing deferred rendering, instead of selecting only a single cubemap for each pixel, you can use a formula that combines all the cubemaps that are close enough to a pixel.

A trick sometimes used to achieve this is to add a pass that computes the number of cubemaps that affect a single pixel (so you can do averages in the final shading pass).
If you are doing forward rendering for transparent objects for example, I think it might be a bit trickier to compute the average of cubemaps.
That's because you need to have pixel positions already available before shading ; you might think it could be possible to do it if you had a kind of depth pre-pass buffer for that purpose, however for transparent objects you usually do not want to write their depth in that buffer, because this leads to artifacts when transparent objects are overlapping.
You would therefore need to have a rather complex logic to handle those cases...

However even with forward rendering you can still select the closest cubemap on a per-pixel basis, although without the "averaging" formula the transitions between the boundaries of two cubemap influence zones will be very visible and reflections will not look realistic.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.