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

[Working] Green Screen Chroma Key Passthrough - Enable OpenXR #1881

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

beiller
Copy link

@beiller beiller commented Nov 2, 2023

I attempted to add green screen pass-through, and got stuck trying to get the pass-through to be "over top" the "video stream". If I move my head real fast I can see the pass-through in the lags that the video is not covering so I think it's progress.

@beiller beiller changed the title initial [WIP] Green Screen Passthrough - Enable Passthrough OpenXR Nov 2, 2023
@beiller
Copy link
Author

beiller commented Nov 2, 2023

If anyone is able to help me make the passthrough appear over the video stream, even just setting alpha to zero doesn't seem to work. I tried changing all the GLSL shaders to set .a = 0.0 to no avail. Tried various GL clear flags etc.

Once that works I can write code to toggle it as well as chroma key GLSL code. I just can't seem to make it pass through however.

@beiller beiller changed the title [WIP] Green Screen Passthrough - Enable Passthrough OpenXR [WIP] Green Screen Chroma Key Passthrough - Enable OpenXR Nov 2, 2023
@zarik5
Copy link
Member

zarik5 commented Nov 2, 2023

I believe you will have to set the alpha channel == 0 for every shader in the compositor. The reason I haven't implemented passthrough yet is because I wanted to rewrite the client compositor since the current OpenGL one is pretty messy.

@Vixea
Copy link
Collaborator

Vixea commented Nov 2, 2023

It's best to use an epsilon when comparing floats btw or alpha < 0.01. If I understand what you're trying to do here zarik

@beiller
Copy link
Author

beiller commented Nov 2, 2023

@zarik5 I tried that all the glsl I could find and set .a = 0.0 for all of them and it didn't pass through. I just reverted that change since it didn't seem to work. Only on the outside of the frame I could see slivers of pass-through. Or maybe can you point me to a particular shader of interest?

@zarik5
Copy link
Member

zarik5 commented Nov 2, 2023

@beiller There are a few shaders: gamma correction, FFR, and one last one to split the image between the two eyes. To be honest the code is very old and quite bad, I can't help you much further unless I dig into that more.

@beiller
Copy link
Author

beiller commented Nov 2, 2023

Thanks for your comments @zarik5 I will try it out. I will think on it some more because I feel there is something higher level than GLSL that is setting the alpha blending.

@zarik5
Copy link
Member

zarik5 commented Nov 3, 2023

It's useful to disable/bypass some code temporarily, for debug purposes. for example in the shader to render to the final swapchains, discard the texture values and always set (0, 0, 0, 0).

@zarik5
Copy link
Member

zarik5 commented Dec 22, 2023

@beiller, instead of writing raw ffi code in ALVR itslef, are you able to add the passthrough bindings to our openxrs fork? Or you can submit the bindings upstream, Ralith could help you making sure the styling of the code is consistent.

@zarik5 zarik5 force-pushed the master branch 2 times, most recently from b5db426 to 9cfd449 Compare January 11, 2024 13:36
@beiller
Copy link
Author

beiller commented Feb 20, 2024

Hey @zarik5 the good news is I don't need all that I guess I was just using it to debug. I have a new working implementation obviously missing a lot and is hard-coded to chromakey green currently. Maybe we can turn it into a feature somehow.

@beiller beiller changed the title [WIP] Green Screen Chroma Key Passthrough - Enable OpenXR [Working] Green Screen Chroma Key Passthrough - Enable OpenXR Feb 20, 2024
@beiller
Copy link
Author

beiller commented Feb 20, 2024

Need way to toggle and maybe some small cleanup before this could ever be considered.

  • Need to toggle feature on/off with key combo
  • Need to remove required: true for passthrough component in open XR
  • Need to test on more devices (I have quest2 only)

@Meister1593
Copy link
Collaborator

Does not seem to work on pico 4 (pro, 5.9.1 pui)?... Just black screen
Screenshot_alvr client_2024 02 21-12 24 35 418_640

@Vixea
Copy link
Collaborator

Vixea commented Feb 21, 2024

Does not seem to work on pico 4 (pro, 5.9.1 pui)?... Just black screen Screenshot_alvr client_2024 02 21-12 24 35 418_640

check for shader compile error in logcat

@Meister1593
Copy link
Collaborator

Does not seem to work on pico 4 (pro, 5.9.1 pui)?... Just black screen Screenshot_alvr client_2024 02 21-12 24 35 418_640

check for shader compile error in logcat

Any specifics for compiler error message? Don't seem to find much of anything with "shader" in logs

@Vixea
Copy link
Collaborator

Vixea commented Feb 21, 2024

nah not really just search for err or error

@Meister1593
Copy link
Collaborator

From what i can tell, it compiled shaders just fine and runtime recognized passthrough

02-21 13:04:11.107 30004 30032 I [ALVR Native]: Compiling shaders.
02-21 13:04:11.108 30004 30032 I [ALVR Native]: Successfully compiled shader.
02-21 13:04:11.108 30004 30032 I [ALVR Native]: Compiling shaders.
02-21 13:04:11.108 30004 30032 I [ALVR Native]: Successfully compiled shader.
02-21 13:04:11.109 30004 30032 E APxrRuntime:  oxr_session_poll:XRT_COMPOSITOR_EVENT_SEETHROUGH_CHANGE-------:0

@Meister1593
Copy link
Collaborator

fb_passthrough is available and being used

@beiller
Copy link
Author

beiller commented Feb 21, 2024

Ah so it is just black where the passthrough should be seen? That is at least "working". If the shader has issue the app just crashes :)

I did hack around with it until it works so I think there may be something missing in the code. I can try experimenting with some things if you can help test pico 4.

@Meister1593
Copy link
Collaborator

Ah so it is just black where the passthrough should be seen? That is at least "working". If the shader has issue the app just crashes :)

I did hack around with it until it works so I think there may be something missing in the code. I can try experimenting with some things if you can help test pico 4.

Sure thing, i can test it of course

@beiller
Copy link
Author

beiller commented Feb 22, 2024

OK maybe it is caused by "com.oculus.feature.PASSTHROUGH" Is there some other feature that needs to be enabled for Pico do we think?

@beiller
Copy link
Author

beiller commented Feb 22, 2024

@Meister1593 I found maybe an issue, the features aren't properly returned. Can you try compiling with this commit and let me know? I think I may have had a different build on my device. With the "if" statements uncommented I got similar black screen behavior that you see.

@Meister1593
Copy link
Collaborator

@Meister1593 I found maybe an issue, the features aren't properly returned. Can you try compiling with this commit and let me know? I think I may have had a different build on my device. With the "if" statements uncommented I got similar black screen behavior that you see.

just tried, nothing changed, exactly the same thing
Checked one of the passthrough apps (it's unity though) and android props, tried to copy them - nothing changed

[[package.metadata.android.application.meta_data]]
name = "MRCsupport"
value = "1"
[[package.metadata.android.application.meta_data]]
name = "color_Space"
value = "1"
[[package.metadata.android.application.meta_data]]
name = "rendering_mode"
value = "0"

@Meister1593
Copy link
Collaborator

From brief discussion in the server i've changed layer mode from OPAQUE to ALPHA_BLEND and it started to work.
I will try to work on providing settings from server to client to make chromakey colour, range and toggle be adjustable.

@zarik5 zarik5 force-pushed the master branch 2 times, most recently from d01478e to 005c4c7 Compare March 22, 2024 09:18
@beiller beiller force-pushed the feature/green_screen_passthrough branch from 005f954 to 02320ea Compare April 13, 2024 02:18
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

Successfully merging this pull request may close these issues.

None yet

4 participants