Announcement

Collapse
No announcement yet.

Miirror effect with the RUISCamera

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Miirror effect with the RUISCamera

    Hello,

    I am trying to create a mirror effect for the avatar movement using kinect (so, for example, when the right arm is raised, its left arm is raised and so on and so forth). I tried using a mirror texture on a surface and pointing the camera on it. It works but the display looks very dark, faded and low quality. There were a few suggestions about manipulating the projection matrix of the camera itself by flipping the X-axis. It kinda works with normal cameras except that you have to use the invert culling property to handle the normals which get all screwed up. But it doesn't seem to work at all with the RUISCamera. I tried applying the matrix manipulation on the center camera and then all three cameras but to no effect. What would be the right way to go about it with the RUISCamera?

    Attached to the RUISCamera object:
    Code:
           
            RUISCamera ruisCam = new RUISCamera();
            GameObject camObj = this.gameObject as GameObject;
    
            if (camObj)
            {
                ruisCam = camObj.GetComponent<RUISCamera>();
            }
    
            Matrix4x4 mat = ruisCam.centerCamera.projectionMatrix;
            mat *= Matrix4x4.Scale(new Vector3(-1, 1, 1));
            ruisCam.centerCamera.projectionMatrix = mat;
    Last edited by Dev; 05-19-2017, 05:35 PM. Reason: Added code snippet

  • #2
    This shader and the associated C# script has worked for us:
    http://wiki.unity3d.com/index.php/MirrorReflection4

    No modifications to RUISCamera are needed.
    The only problem is that shadows don't work.

    Comment


    • #3
      I had tried that one earlier but the resulting reflection looks very blurred compared to the direct camera display. I have attached the screenshots to compare the views:

      Mirror:

      Mirror.jpg

      Camera:
      Camera.jpg
      Attached Files

      Comment


      • #4
        Choose the Game Object that has the MirrorReflection.cs script. Set the "Texture Size" property to 1024 or 2048.

        Comment


        • #5
          That worked like a charm! Thanks.

          Comment

          Working...
          X