Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect projection on passthrough geometry #239

Open
celyk opened this issue Dec 29, 2024 · 4 comments
Open

Incorrect projection on passthrough geometry #239

celyk opened this issue Dec 29, 2024 · 4 comments
Assignees

Comments

@celyk
Copy link

celyk commented Dec 29, 2024

While trying out OpenXRFbPassthroughGeometry with hole punch enabled, I noticed a distortion of the image up close to the mesh. Meanwhile, creating passthrough with shadow_to_opacity looks fine. You can see it for yourself in the Meta Passthrough XR Sample

I suspect one of the transformations in OpenXRFbPassthroughExtensionWrapper::set_geometry_instance_transform must be off

I did notice a problem in this line. Should it not be using Node3D::get_global_transform() ? Even then, I'm not sure this is the culprit

void OpenXRFbPassthroughGeometry::update_passthrough_geometry_transform() {
if (geometry_instance) {
OpenXRFbPassthroughExtensionWrapper::get_singleton()->set_geometry_instance_transform(geometry_instance, get_transform());
}
}

My hardware:
Quest 2 standalone

@celyk
Copy link
Author

celyk commented Dec 29, 2024

I tried a couple more things, and it appears I was right about get_transform. But the issue is more complex than that. Even if the pose of the mesh is wrong, youd think the projection would still work out, right?

The distortion is symptomatic of a slight offset in the viewpoint of each eye. I tried adding a MeshInstance3D of the same mesh to see if it aligns with the OpenXR one, and it does perfectly. This baffles me.

I'm not sure what could be going wrong with the rendering here. One theory I have is that the projection is coming out from the cameras themselves, hence the slight offset. It would make sense for e.g motion reprojection. I'm really just guessing as I am not familiar with these APIs

@celyk
Copy link
Author

celyk commented Dec 30, 2024

I've learned a lot investigating this. Reading https://developers.meta.com/horizon/documentation/native/android/mobile-passthrough-customization/#surface-projected-passthrough

surface geometries provided by the app should match real-world surfaces as closely as possible. If they differ significantly, users will receive conflicting depth cues, and objects may appear too small or large.

Looks like it would be projected out from the cameras then, good stuff. Where does that leave this issue? Assuming this is the intended use, I recommend clarifying the difference between projected vs reconstructed passthrough in the docs, and adding an option for reconstructed passthrough in OpenXRFbPassthroughGeometry. Floating cubes that dont represent real-world geometry should be avoided for projected passthrough. But there is one surface that will always work: the floor!

Keep in mind the Quest 2 does not provide a global mesh, so it would be hard to get an accurate mesh for projected passthrough. For a static room reconstructed passthrough tends to look pretty good and reduces choppiness. However, I do appreciate having the projected passthrough as a low level option. In fact I would love to have more tools to manipulate the projection.

@devloglogan devloglogan self-assigned this Jan 6, 2025
@devloglogan
Copy link
Collaborator

I recommend clarifying the difference between projected vs reconstructed passthrough in the docs, and adding an option for reconstructed passthrough in OpenXRFbPassthroughGeometry. Floating cubes that dont represent real-world geometry should be avoided for projected passthrough. But there is one surface that will always work: the floor!

Thanks for bringing some of this to attention! Some clarification in the docs seems warranted. Adding an option for reconstruction passthrough by way of OpenXRFbPassthroughGeometry doesn't make sense to me, considering it can only be used with surface-projected passthrough.

While I do enjoy having the moving cube as a part of the passthrough, you make a good point. I'd like the sample to illustrate that moving the geometry around is possible, but it probably won't be used like that for the vast majority of cases. I will probably update this to be the floor, like you suggest.

@celyk
Copy link
Author

celyk commented Jan 7, 2025

it can only be used with surface-projected passthrough

Are you sure? I was thinking that geometry could be used with the reconstructed layer, since I can't find anything against it. If you find that it's allowed, it will make sense to add it as an option to OpenXRFbPassthroughGeometry. If not, thats alright then.

There is still shadow_to_opacity, which works, but it requires transparency. I'd rather have the layer options in the one Node if it is possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants