<p>Are you trying to make your own rendering engine?   </p>

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

<p>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.  </p>

<p>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).<br>
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.<br>
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.<br>
You would therefore need to have a rather complex logic to handle those cases...  </p>

<p>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.</p>

CC BY-SA 3.0
2017-05-08T18:43:25.410Z
2017-05-08T18:43:25.410Z
wip
<p>I have multiple reflection cube map that's prebaked before a scene.</p>

<p>However I am being confused as to which one to choose.</p>

<p>I am told I need to choose "closest cube map" then use it.</p>

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

<p>I looked at Unity to get some ideas as well.</p>

<p>Unity chooses a reflection probe based off of distance and area probe affects the object.</p>

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

<reflection>
How to choose which reflection probe to use?
Blue Bug
# How to choose which reflection probe to use?

(Asked by: username_0 on 2017-05-06)

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.

**Tags:** reflection


---

## 1 answers

### Answer by username_1 on 2017-05-08. Score: 4 | Accepted answer

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.


---

