Hi friends,
I would like to cull elements of my scene that are not within a custom made frustum / frustrum.
What I want to do is clip objects as if my field of view is 20 for example, but display them on screen as if the field of view is 60.
I want to do this very quickly too, i.e. I don’t want to check boundaries of objects vs custom frustum / frustrum planes manually. Ideally I want the objects to be clipped by unity (or umbra).
If it is not possible to set custom clipping planes, my feeling is that it might still be possible to change cleverly the camera’s projection matrix so that the field of view would appear to be different.
(Set my camera to FOV of 20, let unity do the clipping, change projection matrix to make things appear as if FOV is 60)
Possible? Impossible?
Anyone has any insight they would like to share?
Edit: One way this might work is if I have 2 cameras: 1 with FOV of 20 and 1 with FOV of 60. I let the FOV of 20 camera do the culling and rendering and just overwrite its projection matrix with the projection matrix of the FOV of 60 camera on preRender… This might not work though, since according to the document if I change the viewing parameters they won’t take place until next frame… I will try when I get home.
Edit: it did not work. I don’t understand why unity doesn’t allow changing the viewing parameters in onPreRender. (it waits til the next update). If I want to change the viewing parameters before I cull the scene, I would simply do it in the preCull function…
Any other ideas are more than welcome.
thank you