Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Mirroring the Z axis

Discussion in 'General Graphics' started by DeltaPiSystems, Oct 16, 2019.

  1. DeltaPiSystems

    DeltaPiSystems

    Joined:
    Jul 26, 2019
    Posts:
    30
    I am loading a model with externally supplied matrices, those matrices are produced with a flipped Z-axis.
    It's because these models are designed with a Right-Handed coordinate system.

    I have been multiplying a "mirror" matrix
    Matrix.Scale(new Vector3(1,1,-1))
    to all matrices received but this is too slow during load time.

    The obvious solution to me seems to be to modify the camera matrix (UNITY_MATRIX_VP in shaders).

    Is this possible to do through the standard Unity Camera features or do I have to manually create my VP matrix and supply it in my shaders?
     
  2. DeltaPiSystems

    DeltaPiSystems

    Joined:
    Jul 26, 2019
    Posts:
    30
    I figured it out...
    I set the worldToCameraMatrix to a right-handed look-at matrix ported from SharpDX.
    A bunch of other, small issues arose as lighting and faces were inverted, simple enough to fix though.