OffAxisCamera
OffAxisCamera computes and applies an off-axis perspective projection to a camera dynamically. Simply add OffAxisCamera to your scene and assign a GameObject that will serve as the window plane.
by Sixth Sensor
★★★★ star rating
Price History +
Off-axis perspective projection is often used in VR/XR applications where you need to render a perspective that matches the viewpoint of a spectator relative to a display. It can be used in conjunction with head tracking, providing the illusion of a dynamic view into a 3D scene, similar to looking through a window.
The view and projection matrices are applied using Unity's physical camera properties (2018.4 LTS and up), supporting Unity's native rendering.
Use case examples
- Panorama multi display setups.
- Cubic VR CAVE display setups.
- Building facade video projection setups.
Disclaimers
- Some post effects are incompatible with multiple edge-aligned cameras. See possible workarounds below.
- Although the off-axis perspective is applied correctly to URP and HDRP cameras, don't expect a flawless merge between edge-to-edge aligned cameras. Rendering in HDRP and URP does not seem to take into account this use case scenario, and it is likely that some features are incompatible (Sept 2020).
- The package does not include any head/eye tracking functionality, but it can easily be combined with tracking software by setting the camera position dynamically.
- The package does not include any four corner perspective correction functionality. This is needed for example in a VR CAVE setup, where you need to adjust the video projection areas to fit your physical surfaces.
Known issues with multiple edge-aligned cameras
When using multiple cameras that are aligned edge to edge, you may experience different brightness in each camera image and/or visible gradient at borders. Here are some workarounds:
Active post effects settings:
- Disable Vignetting.
- Reduce or disable Bloom and Ambient Occlusion. These effects are computed by sampling neighbouring pixels, so edges won't be perfect. Alternatively, render extra margin and crop in post after these effects.
HDRP specific active post effects settings:
- Disable Exposure or set its Mode setting to Fixed so that all camera are exposed evenly.
- Visual Environment, HDRI Sky and Fog works together, and they do not respect off-axis perspectives. If you can live with a minor brightness misalignment, then for Visual Environment set Type to Gradient Sky, and for Fog disable Anisotropy, otherwise disable all of them.
Also note:
- Shadow distance fadeouts works "as expected" which may not be what you desire for off-axis projection where different edges of the camera view can have radically different distances.