Search Unity

Spatial mapping load from prescan

Discussion in 'VR' started by TheRaider, Dec 2, 2016.

  1. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,250
    I am trying to make virtual museums in real life spaces, so I want people to get the same experience whenever they walk in certain rooms.

    Is there a way to do this?
     
  2. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    Hello,

    I would suggest looking at the Microsoft game fragments on the windows store, and also looking at the documentation for world anchors. You could use world anchors to save and load game objects at a certain position using world lock. I don't know of a way to do this programmatically, but you might be able pull the surface mapping from the device through Web B.

    Thank you,
    Wesley
     
  3. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,250
    Thanks for the reply. There must be an easy way to do this!
     
  4. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    The easier way which might work for you is using AR tags in the room. If you have seen the Lowes hololens demo, that is how that have objects in the same position everytime.

    I think is called fiducial marker which can be used for AR systems.



    https://en.wikipedia.org/wiki/Fiducial_marker
     
  5. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,250
    I assume they are using vuforia and the costs significant for that. It also seems logical I should be able to remember a room I have been in before!
     
  6. pfreese

    pfreese

    Unity Technologies

    Joined:
    Feb 23, 2015
    Posts:
    85
    Persisting WorldAnchors should do that for you, but it can fail if rooms are very similar or if the room geometry changes significantly.

    You can also use fiduciary markers, such as AprilTags, to register locations in 3-space. AprilTags API has a BSD license.
     
  7. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,250
    Is there is examples of how you would would use world anchors with prescanning?
     
  8. pfreese

    pfreese

    Unity Technologies

    Joined:
    Feb 23, 2015
    Posts:
    85
    There are some usage examples on the Microsoft Developer site, but no full-fledged examples.

    Basically the process would look something like this:
    1. Using a different app, or custom mode in your app, explore and map the space while wearing HoloLens. Position holograms in the space, and attach a WorldAnchor component to each. Alternatively, position a single WorldAnchor and have each hologram be a child of the object with the component.
    2. Persist the WorldAnchors using either the WorldAnchorStore or the WorldAnchorTransferBatch. The former will easily save to a single device, and the latter, while requiring more work, gives you more flexibility and the ability to share the data between multiple devices.
    3. In your main app, Load or LockObject on the persisted anchors. In order for this to work, the device will need matching spatial data in its cache. i.e., locking will fail for an anchor in a room that the device does not know about.
    The caveat on 3 is why a lot of devs opt to use fiduciary markers for positioning.

    Hope that helps.
     
  9. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,250
    and you can't include the spatial data with the app?

    My use case is a museum where things will be the same each time.
     
  10. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,250
    I just ask cause getting my museum to put them on the walls is going to be tricky (so many departments have to agree which usually ends in deadlock)
     
  11. pfreese

    pfreese

    Unity Technologies

    Joined:
    Feb 23, 2015
    Posts:
    85
    If you use WorldAnchorTransferBatch, you'll be able to deal with the raw data representing the WorldAnchor position yourself, which could conceivably include packaging the data with the app.