Repository navigation
OpenXR: Add support for spatial entities image tracking - #123275
BastiaanOlij wants to merge 1 commit into
Conversation
ad3347f to
1a0d332
Compare
1a0d332 to
cb08e54
Compare
cb08e54 to
2c9d447
Compare
2c9d447 to
0bc3204
Compare
|
Finally got this working, just need a little cleanup and a few cross the t's and dot the i's thingies. |
0bc3204 to
982cc35
Compare
56d6a81 to
b84acc3
Compare
| Resource for storing image data that can be submitted to the spatial entities image tracking system. | ||
| </brief_description> | ||
| <description> | ||
| This resource stores image data that can be submitted to the spatial entities image tracking system. This allows you to configure the images that should be tracked within the editor. As image tracking data is immutable, image data is not submitted to OpenXR until tracking is initialized. |
There was a problem hiding this comment.
I don't know how this will appear on the website or the in-editor help, but there's nothing in the XML to indicate that images are added by setting image/x/image properties. We should probably include some examples here of how to make an image database in code via image_database.set("images/0/image", image)
There was a problem hiding this comment.
Or, actually, it would probably be better to add some functions that are intended to be used to add images from code? That would be easier to use and easier to document :-)
There was a problem hiding this comment.
Agreed, I'll work on that when I have a moment.
|
I tested the demo project on Xreal Aura and it worked for me! My printer is out of ink, so I just brought up the Godot XR logo on each of my screens and saw the detected entity move around that way. After I'm got some new ink, I'll try it on a piece of paper :-) |
devloglogan
left a comment
There was a problem hiding this comment.
Will continue to review the implementation but here are some review notes on the docs for now. :)
| Spatial entity tracker for our spatial entity image tracking extension. | ||
| </brief_description> | ||
| <description> | ||
| Spatial entity tracker for our spatial entity image tracking extension. These trackers identify entities in our real space by recognizing an image. |
There was a problem hiding this comment.
"Our spatial entity image tracking extension" seems like non-standard wording to me for the docs, I'd maybe swap it out for "the spatial entity image tracking OpenXR extension" .
There was a problem hiding this comment.
We probably need to do similar changes to some of the other extensions as well, but I agree with this
There was a problem hiding this comment.
@dsnopek @m4gr3d @devloglogan something I chanced here too is:
| Spatial entity tracker for our spatial entity image tracking extension. | |
| </brief_description> | |
| <description> | |
| Spatial entity tracker for our spatial entity image tracking extension. These trackers identify entities in our real space by recognizing an image. | |
| Spatial entity tracker for the OpenXR spatial entity image tracking extension. | |
| </brief_description> | |
| <description> | |
| Spatial entity tracker for the [url=https://registry.khronos.org/OpenXR/specs/1.1/html/xrspec.html#XR_EXT_spatial_image_tracking]OpenXR spatial entity image tracking extension[/url]. These trackers identify entities in our real space by recognizing an image. |
So add in a hyperlink to the documentation of the extension here. Might be better placed in the configuration class than the tracker class, but it was something that was raised a little while ago in the WG as an idea.
| <method name="has_images"> | ||
| <return type="bool" /> | ||
| <description> | ||
| Returns [code]true[/code] if this object has valid image data. Note that there will always be one empty image entry that is ignored by this check. |
There was a problem hiding this comment.
Mega nit: I don't like how the method above this uses "Note:" and that this one uses "Note that", unsure if there's a convention here but I would make them uniform and make both of them use "Note:".
There was a problem hiding this comment.
I changed it to the usual [b]Note:[/b] formatting.
| <method name="get_image_tracking_database" qualifiers="const"> | ||
| <return type="RID" /> | ||
| <param index="0" name="index" type="int" /> | ||
| <description> | ||
| The RID of the image tracking database containing this image. | ||
| </description> | ||
| </method> | ||
| <method name="get_reference_image_index" qualifiers="const"> | ||
| <return type="int" /> | ||
| <param index="0" name="index" type="int" /> | ||
| <description> | ||
| The index of the image within the image tracking database. | ||
| </description> | ||
| </method> |
There was a problem hiding this comment.
I'd explicitly state what the index parameter is supposed to be in these method descriptions.
There was a problem hiding this comment.
Hmmm, that might get lengthy, might be better for a documentation page..
|
I finally have new printer ink, so I tested with a printed version of the If I put it on a monitor, it'll be recognized after ~1 second, and if I move it to another monitor, it'll take ~1 second for the marker to move to the new location. But on paper, it's very "hit or miss" with it sometimes recognizing it after ~1 second, but most frequently not recognizing it, or taking much longer before it decides it's seen it. Moving the paper will sometimes show the marker move, but it's only after ~1 second or longer - it doesn't "stick" to the image the way I recall marker tracking working In any case, I don't think the low speed and accuracy of this is the fault of this PR, it's most likely on the OpenXR runtime's side |
|
Compared to @dsnopek's testing on printed images, my device (also an Aura) seemed to recognize the images pretty well, though on occasion it did seem to fail or take a bit. It does seem like the tracking doesn't update dynamically though, whenever a position is "updated" I think it's because it's just freeing and discovering a new tracker. Looking at marker tracking, I'm guessing something like this needs to be added? |
Good call Logan, yes that is needed for dynamic tracking of images assuming it is supported by the runtime and assuming the image wasn't marked as static. I'll work on that tomorrow. |
8c416a6 to
1335705
Compare
1335705 to
4976bb2
Compare
What problem(s) does this PR solve?
This PR implements the new OpenXR spatial entities image tracking API. When supported by the XR runtime, this allows an XR device to use its cameras to detect an image that has been supplied to the runtime before hand.
The location and orientation of the image is then communicated to the application and virtual content can be anchored to the real world image.
Additional information
The specification for this API can be found here: https://registry.khronos.org/OpenXR/specs/1.1/html/xrspec.html#XR_EXT_spatial_image_tracking
I have a PR with an update demo implementation here: https://github.com/BastiaanOlij/spatial-entities-demo/tree/test_image_tracking
One of the images the demo tracks is our Godot logo : )

I had some difficulty adding the meta data for the images into our project settings, ended up creating a resource to hold the data. As the image tracking is immutable, it won't register data right away when setting stuff but only when finally submitting the image database to OpenXR.
In the demo there is a small example script that lets you manage this data on a node yet still use the built-in logic, it actually works nicer than setting it in the project settings, but it's up to the dev to choose what they prefer.