Search Unity

ARFoundation + Post Processing Stack = Tracking Drift

Discussion in 'Handheld AR' started by trakloz, Dec 6, 2018.

  1. trakloz


    Jul 23, 2017
    I have been trying to introduce Post Processing Stack effect depending on the user's actions. I import the Post Process package (2.12) via Package manager, add components to the AR Camera and when I build the tracking is not stable anymore. Please find screencapture with slight Chromatic Aberration.

    If I disable PP Layer and Volume components on the camera, tracking comes back to normal.
    I'm using Unity 2018.2.18f1 and ARFoundation preview 20.
    Has anyone encountered this issue? Thanks!
  2. tdmowrer


    Unity Technologies

    Apr 21, 2017
    The video looks like you have quite a low framerate; that could impact tracking quality. Is that the case, or is it just how it was captured?
  3. shaun_fuzzy_unity


    Oct 11, 2018
    Was this problem solved, as I have the same issue.
    I did manage to determine that this drift only occurs when the device is in Landscape with any form of post-processing enabled. This drift did not occur when any of the devices were in portrait with post-processing enabled.

    I have replicated this issue on Android and iOS using the following unity versions and mobile devices.
    Unity versions: 2018.2.13f1 and 2018.3.0f2
    Mobile devices: Samsung S7 edge, IPhone 8, IPhone X
    Plugin versions Unity 2018.2.13f1: Post-Processing v2.1.2, ARFoundation 1.0.0-preview.17, ARCore XR Plugin 1.0.0-preview.18, ARKit XR Plugin 1.0.0-preview.14
    Plugin versions Unity 2018.3.0f2: Post-Processing v2.1.2, ARFoundation 1.0.0-preview.20, ARCore XR Plugin 1.0.0-preview.23, ARKit XR Plugin 1.0.0-preview.17

    Also note that three builds were done for each Unity and mobile pairing:
    first with auto rotation enable, second with the build locked to landscape, and third with the build locked to Portrait.
    Last edited: Jan 16, 2019
  4. shaun_fuzzy_unity


    Oct 11, 2018
    I manage to find the following temporary solution.
    Set AR camera to depth 0.
    Add a second camera any where to the AR scene.

    For the second camera set Clear Flags to Don't Clear, Culling Mask to Nothing, and set Depth to 1 assuming your AR camera's depth is set to 0. Finally add the Post process layer to the second camera and remove the Post process layer from the AR camera
    cLick1338 and trakloz like this.
  5. Florian-


    Aug 20, 2017
    I hit the same problem and got a (dirty) fix.

    While Shaun workaround above kinda worked, I'm doing something a bit more exotic using an alpha mask to not affect the AR background with post process.

    Drift was very clear on this setup as i could see my post process effect float around my meshes and bleed on the real world pixels around.

    Drift looked very similar to transformation matrix issues I had in the past using multiple cameras in ARFoundation..
    Turns out the post process layer script reset the transformation matrix multiple times while executed.
    It seems to be related to some temporal anti aliasing stuff.
    I just commented out all calls that affect the transform matrix in the script and no more drift with post process on !
    JoeGrainger, trakloz and ROBYER1 like this.
  6. ROBYER1


    Oct 9, 2015
    Was this also related at all to the device struggling with post processing? Thus far my experience with mobile devices and post processing is to keep it minimal or none at all(!)