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

OpenXR: Add documentation page about the new composition layers #9373

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

BastiaanOlij
Copy link
Contributor

This new help page documents the new composition layer support @dsnopek added to Godot.

I've detailed a simple example project for this. I'll see if I can upload that somewhere so we can reference the source.

@BastiaanOlij BastiaanOlij added enhancement topic:xr Related to XR documentation area:manual Issues and PRs related to the Manual/Tutorials section of the documentation labels May 14, 2024
@BastiaanOlij BastiaanOlij added this to the 4.3 milestone May 14, 2024
@BastiaanOlij BastiaanOlij self-assigned this May 14, 2024
@BastiaanOlij BastiaanOlij requested a review from dsnopek May 14, 2024 08:25
@BastiaanOlij BastiaanOlij force-pushed the xr_composition_layers branch from c427fdf to 8962b22 Compare May 14, 2024 08:26
Copy link
Member

@mhilbrunner mhilbrunner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Only reviewed the first half so far.

tutorials/xr/openxr_composition_layers.rst Outdated Show resolved Hide resolved
tutorials/xr/openxr_composition_layers.rst Outdated Show resolved Hide resolved
tutorials/xr/openxr_composition_layers.rst Outdated Show resolved Hide resolved
tutorials/xr/openxr_composition_layers.rst Outdated Show resolved Hide resolved
tutorials/xr/openxr_composition_layers.rst Outdated Show resolved Hide resolved
tutorials/xr/openxr_composition_layers.rst Outdated Show resolved Hide resolved
@m4gr3d m4gr3d requested review from m4gr3d and devloglogan May 14, 2024 15:02
Copy link

@devloglogan devloglogan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more typos

tutorials/xr/openxr_composition_layers.rst Outdated Show resolved Hide resolved
tutorials/xr/openxr_composition_layers.rst Outdated Show resolved Hide resolved
tutorials/xr/openxr_composition_layers.rst Outdated Show resolved Hide resolved
@BastiaanOlij BastiaanOlij force-pushed the xr_composition_layers branch from 8962b22 to d894725 Compare May 15, 2024 01:23
Hole punching
-------------

This is a feature that is specifically targeted at AR use cases as it requires our
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add MR in addition to AR in that sentence to avoid giving the impression we're only referring to AR glasses:

This is a feature that is specifically targeted at AR and MR use cases...

Copy link
Contributor Author

@BastiaanOlij BastiaanOlij May 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned during the XR meeting, should have written this down before :) In my humble opinion I want to avoid the MR terminology here. AR and VR reference two distinct approaches, VR referencing fully immersive virtual worlds, while AR references any approach where the real world is augmented with virtual content.

Just for completeness sake for this discussion, XR is a grouping term that was adopted by Khronos and as such by a part of the industry (including by Godot).

MR is a confusing term that means something different depending on who you talk to.

  • Originally it referred to mixing real world capture with virtual world capture to create a composite such as solutions as MixCast, Liv and Oculus own Mixed Reality iPad app implement.
  • Then Microsoft adopted MR to mean Mixed Reality as the name for their WMR platform, in this case defining it as a platform supported both AR (through Hololens) and VR (through other WMR devices, none of which do passthrough I believe). I also guess they hoped people would see it as an abbreviation of Microsoft Reality, but that's pure speculation on my part :)
  • Then in most recent years MR meaning Mixed Reality has become an alternative to XR as an encompassing term for people who don't like the XR moniker.
  • And finally, Meta seems to have rebranded it recently to specifically mean AR through the means of passthrough though I am not sure if that has created more clarification or more confusion in the market space. All though Metas marketing here IMHO is inconsistent as its also often referring to the above meaning as a catch all for AR and VR.

So MR in its meaning in the context of this document as I understand it, e.g. AR through passthrough, is a meaning that is fairly contested.

As Godot is a platform agnostic development tool and we try not to care how AR is achieved but want our applications to be portable between various AR devices, it is my personal opinion that AR in this context is sufficient capturing all use cases of this feature, while MR is confusing.

There are features that are only possible on devices that use a camera feed to achieve AR and where passthrough should be named specifically, but this is no such feature as it is as applicable on a passthrough device such as the Quest, as it is on an optical AR device such as the Magic Leap 2.

However, I stress that this is my personal standpoint on the matter, so this is absolutely up for debate.

was_intersect = NO_INTERSECTION


Hole punching
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be worth giving a use-case to illustrate how this is being used in actual project (e.g: adding a virtual window to the environment with passthrough in the 'background'.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I said I was on board with this use case last night at the XR meeting but I need to run that back: hole punched composition layers aren't the correct method for a "window into a virtual world". Since a subviewport can't be rendered in stereo to make it look actually 3D. If you wanted to achieve that effect you'd be better off having the "virtual world" be the main scene, and then have everything that isn't the window be covered up by (hole punched) geometry passthrough.

The main point of hole punching in composition layers is to just let things be displayed in front of the composition layer, like hand models, etc. Adding that use case would make sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devloglogan actually for those type of use cases you're better off rendering geometry directly with the shadow to opacity option and skip composition layers all together.

Hole punching in relation to composition layers is purely meant to allow the composition layer to be rendered behind the main content so that you can have virtual foreground objects occlusion part of the content of the composition layer.

Right now composition layers are always visible on top even if they clip through geometry.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BastiaanOlij I totally agree, and was attempting to say as much in my previous comment. :) Would not use composition layers when going for that use case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah we're on the same page then :)

@BastiaanOlij
Copy link
Contributor Author

One more bit of feedback from the XR meeting was the suggestion to add some image captures to the documentation.

Especially seeing we're naming this by the technical solution, not by what you can achieve with this solution, a picture tells a thousand words to let people know what this functionality is used for.

@devloglogan
Copy link

Perhaps an image like this would suffice to illustrate hole punching?

CompositionLayerHolePunch

@BastiaanOlij
Copy link
Contributor Author

BastiaanOlij commented May 20, 2024

Owh thats pretty clear!

Interesting btw that this shows its also viable for VR, so possibly I should rewrite that part of the text to not point out AR at all.

@dsnopek
Copy link
Contributor

dsnopek commented May 20, 2024

@devloglogan That screenshot looks great!

@BastiaanOlij:

Interesting btw that this shows its also viable for VR, so possibly I should rewrite that part of the text to not point out AR at all.

+1 to this!

@m4gr3d
Copy link
Contributor

m4gr3d commented May 20, 2024

Owh thats pretty clear!

Interesting btw that this shows its also viable for VR, so possibly I should rewrite that part of the text to not point out AR at all.

@BastiaanOlij +1! A VR specific example would be to use a quad composition layer for text display to improve the text rendering quality.

hole punched composition layers aren't the correct method for a "window into a virtual world".

@devloglogan During the meeting, I was suggesting the opposite, showing a window into the real world, which should be doable using the OpenXRFbPassthroughGeometry node.

If you wanted to achieve that effect you'd be better off having the "virtual world" be the main scene, and then have everything that isn't the window be covered up by (hole punched) geometry passthrough.

This would make for an interesting sample, especially if the geometry is destructable so the user can 'break out' from the real world into the virtual world (e.g: similar to what First Encounters does).

@BastiaanOlij
Copy link
Contributor Author

@m4gr3d asked this on rocketchat as well, but I don't see whats special about FB passthrough geometry, we can already do this with the shadow_to_opacity shader and it will work cross platform on any AR capable device?
I'm probably missing something?

@BastiaanOlij BastiaanOlij force-pushed the xr_composition_layers branch from d894725 to cbcf3b8 Compare May 22, 2024 01:16
Copy link
Contributor

@dsnopek dsnopek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking really great! I have just a couple minor notes.

Also, I wonder if it's worth pointing out that an equirect layer can also be used for rendering a sky box? While Godot can of course render the sky, using a composition layer has the same advantages with regard to clarity and performance that using a composition layer for 2D UI has.

This is mentioned specifically in the OpenXR spec:

Selection_163

tutorials/xr/openxr_composition_layers.rst Outdated Show resolved Hide resolved
tutorials/xr/openxr_composition_layers.rst Outdated Show resolved Hide resolved
tutorials/xr/openxr_composition_layers.rst Outdated Show resolved Hide resolved
Comment on lines +280 to +281
As the composition layer is composited on top of the render result,
it can be rendered in front of objects that are actually forward of the viewport.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth specifically saying something about "virtual hands appearing behind the composition layer"? I feel like that's the first thing developers are going to notice about composition layers in VR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we do have the screenshot logan provided, it kind of shows that use case.

Hole punching
-------------

As the composition layer is composited on top of the render result,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is dependent upon the sort order, so it may be worth clarifying that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does say that later on:

You also need to set ``Sort Order`` to a negative value,
the XR compositor will now draw the viewport first, and then overlay our rendering result.

Copy link
Contributor

@m4gr3d m4gr3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments, but looks good overall!

@BastiaanOlij BastiaanOlij force-pushed the xr_composition_layers branch from cbcf3b8 to 389e1f3 Compare May 30, 2024 01:52
Copy link
Contributor

@skyace65 skyace65 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one minor phrasing issue, but after that is fixed this should be good to merge.

tutorials/xr/openxr_composition_layers.rst Outdated Show resolved Hide resolved
@BastiaanOlij BastiaanOlij force-pushed the xr_composition_layers branch from 389e1f3 to 3e61fdf Compare June 7, 2024 04:18
@BastiaanOlij BastiaanOlij requested a review from skyace65 June 7, 2024 04:20
@skyace65 skyace65 merged commit 194ce92 into godotengine:master Jun 7, 2024
1 check passed
@skyace65
Copy link
Contributor

skyace65 commented Jun 7, 2024

Thanks!

@BastiaanOlij BastiaanOlij deleted the xr_composition_layers branch June 15, 2024 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:manual Issues and PRs related to the Manual/Tutorials section of the documentation enhancement topic:xr Related to XR documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants