- Home /
Planar reflection is getting cut off when using camera with an oblique viewing frustrum
Heres' my setup:
I'm using Unity, a large screen and a tracked observer/camera to create some form of parallax effect, pretty much the same idea as shown in here.
So my virtual camera is driven by the tracking data of my real camera, but has a script that adjusts its rotation and view frustrum to remain fixed on a pre-defined plane at all times. All this works like a charm. But here's the problem: I've also got a reflective floor in my scene, using a planar reflection probe. As soon as my camera move too far from the center and its viewing frustrum becomes more oblique, the reflection is cut off.
Adjusting the reflection probe's FOV helps, but in order to achieve enough coverage I'd have to crank it up so much that it's pixelated beyond recognition.
I've a few ideas what might be causing this (probably something about the reflection probe's own viewing frustrum not being in sync with my main camera?), but no idea how to fix it. :(
(I'm using 2019.2.0f1, HDRP 6.9.1)
$$anonymous$$y assumption is that the planar reflection probe is based off Aras' work on planar reflections in Unity from years back. To make it compatible with every camera, the reflection camera's projection matrix is copied from the currently rendering camera and inverted over the plane. From then, that matrix itself is turned oblique to prevent drawing reflections beneath the object's surface. The problem with that is that because you're already using an oblique projection matrix on your camera, the reflection camera is copying your offset values before it adds its own. The best I can think would be to somehow setup your oblique camera before it renders, render the camera, then reset the matrix before the reflection camera is created/setup.