AR-js-org / AR.js

Image tracking, Location Based AR, Marker tracking. All on the Web.
MIT License
5.45k stars 926 forks source link

[feature request] Ground Plane #133

Open marcusx2 opened 4 years ago

marcusx2 commented 4 years ago

Do you want to request a feature or report a bug? Feature

What is the current behavior? There is no ground plane support.

If the current behavior is a bug, please provide the steps to reproduce.

Please mention other relevant information such as the browser version, Operating System and Device Name

What is the expected behavior?

If this is a feature request, what is motivation or use case for changing the behavior? Ground plane is a great AR feature that would add even more value to ARjs. Can it be emulated with the location based AR already present? If yes, how?

blckwngd commented 4 years ago

I don´t know if this is what you want - but this is how i did ground placement of ar objects in one project: At start i request an elevation map from https://elevationapi.com an parse the image data for height info. That way i can find lat/lon coordinates on the map, and calculate the approximate elevation at that point.

If you are interested in the implementation, you can find it here: https://github.com/blckwngd/FireAjna/blob/master/AjnaConnector/ajna-connector.js The functions described above are loadHeightmap() and hmProject()

EDIT: I see you don´t need geospatial elevation as ground level, but ground data computed from the camera data. Yeah that would be great. It´s baked into WebARCore afaik, but it would be awesome to see this in ARjs

marcusx2 commented 4 years ago

I don´t know if this is what you want - but this is how i did ground placement of ar objects in one project: At start i request an elevation map from https://elevationapi.com an parse the image data for height info. That way i can find lat/lon coordinates on the map, and calculate the approximate elevation at that point.

Interesting! So there is a work-around after all. Thanks for sharing this information.

jamess922 commented 4 years ago

Hi could you share a demo

nickw1 commented 4 years ago

I also use Digital Elevation Models in my Hikar project (preview of AR.js version - Europe/Turkey only - at https://hikar.org/webapp). This makes use of the publicly-available Terrarium PNG tiles available on Amazon S3. The URL is:

https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z/{x}/{y}.png (XYZ tilesystem)

See:

https://github.com/nickw1/aframe-osm-3d/

for some components which make use of it. Also see https://github.com/nickw1/hikar.org/ for the Hikar code which uses these components.

Using a DEM is definitely essential in a non-flat area, however its resolution is not sufficient for 'perfect' on the ground placement. What's likely needed for really nice placement of the sort seen in that Youtube video, however, is computer-vision based ground plane detection, this could well be in the long-term aims of AR.js.