Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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.