• Our products
  • Our achievements
  • Interactivity
  • Documentation (current)
  • en (change language)
    en
    fr
  • Introduction
  • Tutorials
    • Introduction
    • nano-router connection
    • First Steps
    • Direct wired connection
    • Adding content
  • How-to guides
    • Introduction
    • How to create holograms
    • Holusion Content Manager guide
    • Holusion Companion install guide
    • Invert a camera in Unity 3D
  • References
    • Introduction
    • organisation
  • Product manuals
    • Introduction
    • Iris 22 user guide
    • Iris 32 user guide
    • Iris 46 user guide
    • Iris 46 assembly guide
    • Prism user guide
    • Opal user guide
    • Iris 22 stand assembly guide
    • Iris 32 stand assembly guide
    • Holographic fan user manual
  • Documentation
    • Introduction
    • Holographic models
    • eCorpus
    • eThesaurus
    • Holusion for Museum
    • Technical products
    • Integration Guide

Invert a camera in Unity 3D

Horizontally flipping a camera in Unity 3D

To be able to display an image on Holusion’s products using Unity, the first step is to flip camera images.

It can be done with a Post Process Volume (Unity >5.6 required) or with the slightly less efficient OnPreCull camera hook.

PostProcessing

Since V5.6, Unity offers a new post-processing stack. It is possible to use it to mirror a camera’s output using a matrix transform.

The Post Processing v2 package from Unity’s Package Manager is required. You then need the holusion-provided CameraFlop package.

For the shader to be applied you need to add a Post Process Layer to your main camera and tick the Camera Flop effect.

You need to also add the shader in Edit > Project settings > Gaphics > Always included Shaders.

PreCull Hook

To use the OnPreCull hook, attach this script to your scene’s main camera :

    using UnityEngine;
    using System.Collections;

    [RequireComponent (typeof (Camera))]
    public class HSymmetry : MonoBehaviour {

    	void OnPreCull () {
    		Matrix4x4 scale;
    		if(camera.aspect >2){
    			scale = Matrix4x4.Scale (new Vector3 (-1, 1, 1));
    		}else{
    			 scale = Matrix4x4.Scale (new Vector3 (1, -1, 1));
    		}
    		camera.ResetWorldToCameraMatrix ();
    		camera.ResetProjectionMatrix ();
    		camera.projectionMatrix = camera.projectionMatrix * scale;
    	}
    	void OnPreRender () {
    		GL.SetRevertBackfacing (true);
    	}
    	void OnPostRender () {
    		GL.SetRevertBackfacing (false);
    	}
    }

It will apply a matrix transform to the camera.

Contact

  • contact@holusion.com
  • +33 (0)9 70 66 77 96
  • 111, avenue Jean Lebas
    59100 Roubaix, France

Holusion

  • Who are we ?
  • Terms and conditions
  • Privacy Policy

Follow Us

 
 
 
 
 
Holusion © 2015 - 2025 CC. Attribution ShareAlike CC.BySa