<p>If there is only a few flat mirrored surfaces the solution is to render the scene again for each mirror, once normally. Afterwards you use stencils to mark the area where the mirror is visible.</p>
<p>Then only drawing into that area you render the scene again for each mirror but mirror it around the mirror's plane and cull any geometry on the wrong side of the mirror.</p>

CC BY-SA 3.0
2017-03-20T12:36:39.603Z
I will keep that in mind but I was talking about generalised methods
newin
CC BY-SA 3.0
2017-03-20T20:49:48.910Z
@newin When you say generalised, do you mean non-flat surfaces, or multiple flat surfaces? Do you require distortion of the reflections? Multiple reflections of mirrors in other mirrors? It would help to edit the question to specify what you do need and what you don't need, then answers can take that into account and focus on just what is necessary.
trichoplax is on Codidact now
CC BY-SA 3.0
2017-03-20T22:13:49.327Z
@trichoplax I edited my question with much more precisions I hope that's enough.
newin
CC BY-SA 4.0
2017-03-20T09:12:07.217Z
2024-08-22T06:00:37.093Z
2024-08-22T06:00:37.093Z
ratchet freak
<p>If you want a real-time solution (no baking), and only need one reflection bounce, you can try to generate (or update) a cubemap of the scene every frame, as described in this <a href="http://www.adriancourreges.com/blog/2015/11/02/gta-v-graphics-study/" rel="nofollow noreferrer">graphics study of GTA5</a>  .</p>

<p>This solution should work in general cases (be sure to handle cases when the cubemap probe would be in an object of the scene).  </p>

<p>If rendering the six faces of the cube every frame seems too heavy, you can try for example to update only one face at a time. You can then use some kind of average function when updating the faces so that the change between each frame looks smoother.  </p>

<p>It is only an idea, there are many other solutions that one can think of.</p>

CC BY-SA 4.0
2024-08-24T17:23:27.057Z
It can also be done as a single camera placed in the scene at the correct angle and location to capture what the "mirror" would see given the current main camera's position. Render and lookup in a fashion similar to shadow maps, but this time get actual colors, transparency becomes a function of the normal for the triangle being rendered. This works for basic mirrors/windows/water. The rendering is done at a low resolution (half or 1/4) this gives blurry reflections, if the scene allows the size can be increased and clear reflections can be done.
pmw1234
CC BY-SA 3.0
2017-03-23T16:56:42.633Z
2018-03-04T19:55:29.637Z
2018-03-04T19:55:29.637Z
wip
<p>I'm working on my own engine and I'm struggling to find any techniques that give okay-ish reflections in realtime on dynamic scene.
So far the only technique I found that work in real time on dynamic scene is SSR but it's really heavy and have a lot of bias.</p>

<p>The idea of having multiple cubemaps and updating them in real time crossed my mind but because that mean re-rasterising the scene that also mean that every cubemap updated in realtime is a shadow casting that I can't do.</p>

<p>So my question is: is there another technique other than reflection probe (cubemap) or Screen Space Reflections ?</p>

<p>The artstyle of the game where the engine will be used is based on a lot of "almost mirror" reflections and it's not PBR.</p>

<p>[Edit]
To be a bit more precise with what I'm searching:</p>

<ul>
<li>I do not need more than one bounce.</li>
<li>I do not want any baking that cannot be done at "loading time".</li>
<li>I prefer if the technique work with a per-pixel normal but if you
know a technique that work with a per-vertex normal I am also open.</li>
<li>I am open to techniques that only work in specific cases (like tiny
scene, deferred rendering only etc...) as long as it meet other
requirements.</li>
<li>If your technique is a feature of a global illumination technique I am
also open but I would prefer if it work stand alone.</li>
<li>If it can easily support GGX it's better but not required.</li>
<li>Inaccuracy is not a problem as long as it is predictable by the
artist</li>
</ul>

<opengl><reflection>
realtime dynamic reflections, which way to go?
newin
# realtime dynamic reflections, which way to go?

(Asked by: username_0 on 2017-03-20)

I'm working on my own engine and I'm struggling to find any techniques that give okay-ish reflections in realtime on dynamic scene.
So far the only technique I found that work in real time on dynamic scene is SSR but it's really heavy and have a lot of bias.

The idea of having multiple cubemaps and updating them in real time crossed my mind but because that mean re-rasterising the scene that also mean that every cubemap updated in realtime is a shadow casting that I can't do.

So my question is: is there another technique other than reflection probe (cubemap) or Screen Space Reflections ?

The artstyle of the game where the engine will be used is based on a lot of "almost mirror" reflections and it's not PBR.

[Edit]
To be a bit more precise with what I'm searching:

* I do not need more than one bounce.
* I do not want any baking that cannot be done at "loading time".
* I prefer if the technique work with a per-pixel normal but if you
  know a technique that work with a per-vertex normal I am also open.
* I am open to techniques that only work in specific cases (like tiny
  scene, deferred rendering only etc...) as long as it meet other
  requirements.
* If your technique is a feature of a global illumination technique I am
  also open but I would prefer if it work stand alone.
* If it can easily support GGX it's better but not required.
* Inaccuracy is not a problem as long as it is predictable by the
  artist

**Tags:** opengl, reflection


---

## 2 answers

### Answer by username_1 on 2017-03-20. Score: 4

If there is only a few flat mirrored surfaces the solution is to render the scene again for each mirror, once normally. Afterwards you use stencils to mark the area where the mirror is visible.

Then only drawing into that area you render the scene again for each mirror but mirror it around the mirror's plane and cull any geometry on the wrong side of the mirror.

> **Comments:**
> **username_0**: I will keep that in mind but I was talking about generalised methods  
> **username_2**: @username_0 When you say generalised, do you mean non-flat surfaces, or multiple flat surfaces? Do you require distortion of the reflections? Multiple reflections of mirrors in other mirrors? It would help to edit the question to specify what you do need and what you don't need, then answers can take that into account and focus on just what is necessary.  
> **username_0**: @username_2 I edited my question with much more precisions I hope that's enough.  

---

### Answer by username_3 on 2017-03-23. Score: 2

If you want a real-time solution (no baking), and only need one reflection bounce, you can try to generate (or update) a cubemap of the scene every frame, as described in this [graphics study of GTA5](http://www.adriancourreges.com/blog/2015/11/02/gta-v-graphics-study/) .

This solution should work in general cases (be sure to handle cases when the cubemap probe would be in an object of the scene).

If rendering the six faces of the cube every frame seems too heavy, you can try for example to update only one face at a time. You can then use some kind of average function when updating the faces so that the change between each frame looks smoother.

It is only an idea, there are many other solutions that one can think of.

> **Comments:**
> **username_4**: It can also be done as a single camera placed in the scene at the correct angle and location to capture what the "mirror" would see given the current main camera's position. Render and lookup in a fashion similar to shadow maps, but this time get actual colors, transparency becomes a function of the normal for the triangle being rendered. This works for basic mirrors/windows/water. The rendering is done at a low resolution (half or 1/4) this gives blurry reflections, if the scene allows the size can be increased and clear reflections can be done.  

---

