Search Unity

Question Keeping an ARPlaneMaterial aligned to planes

Discussion in 'AR' started by spacedeveloper2, Apr 25, 2022.

  1. spacedeveloper2

    spacedeveloper2

    Joined:
    May 18, 2018
    Posts:
    4
    Hey all -- I see some AR apps that have a super-clean visual representation of the AR Planes, where the texture of the ARPlane aligns quite well to the perspective of the camera & the shapes in the scanned world.

    Like in this below example, notice how the white plane lines & dots pretty accurately follow the edges of the scanned space. Vertical planes have lines that go straight up and down, and horizontal planes have lines that generally go left & right.

    example2.jpg

    I've copied the `FeatheredPlanes.unity` demo from the examples. But when planes are detected in my environment, they appear skewed (see screenshot below). Note how my vertical plane dots are tilted at roughly a 45 degree angle (see the red line screenshot). I've verified that the `FeatheredPlaneMaterial` texture is in fact straight-on; it's not rotated.

    What causes the below rotation that I am seeing, and how do I get my texture to lie "straight" on the plane?

    example.png example2.png

    Thanks!
     
    Last edited: Apr 25, 2022
  2. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,143
    It looks like the upper image shows the app that uses a meshing algorithm. In AR Foundation, meshing is supported on HoloLens and iOS (LiDAR sensor required) with the help of ARMeshManager.
    You can ask the ARMeshManager to supply texture UV coordinates and use them to apply texture to the scanned model. I haven't tested this myself, but I assume you should receive the same result as on the upper image.
     
  3. spacedeveloper2

    spacedeveloper2

    Joined:
    May 18, 2018
    Posts:
    4
    Thanks, Kirill! I'll take a look at the ARMeshManager and see if I can coax what I'm looking at from that.
     
    KyryloKuzyk likes this.