diff --git a/alvr/client_core/cpp/graphics.cpp b/alvr/client_core/cpp/graphics.cpp index 4870c7f47e..09f9628db8 100644 --- a/alvr/client_core/cpp/graphics.cpp +++ b/alvr/client_core/cpp/graphics.cpp @@ -191,9 +191,22 @@ in lowp vec2 uv; in lowp vec4 fragmentColor; out lowp vec4 outColor; uniform sampler2D Texture0; -void main() -{ + +vec2 RGBToCC(vec4 rgba) { + float Y = 0.299 * rgba.r + 0.587 * rgba.g + 0.114 * rgba.b; + return vec2((rgba.b - Y) * 0.565, (rgba.r - Y) * 0.713); +} + +void main() { + vec4 keyRGBA = vec4(0.0, 1.0, 0.0, 1.0); // key color as rgba + vec2 keyCC = RGBToCC(keyRGBA); // the CC part of YCC color model of key color + vec2 range = vec2(0.3, 0.4); // the smoothstep range + outColor = texture(Texture0, uv); + vec2 CC = RGBToCC(outColor); + + float mask = sqrt(pow(keyCC.x - CC.x, 2.0) + pow(keyCC.y - CC.y, 2.0)); + outColor.a = smoothstep(range.x, range.y, mask); } )glsl"; @@ -683,7 +696,11 @@ void renderEye( GL(glBindVertexArray(0)); GL(glBindTexture(GL_TEXTURE_2D, 0)); } else { - GL(glClear(GL_DEPTH_BUFFER_BIT)); + GL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f)); + GL(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)); + + GL(glEnable(GL_BLEND)); + GL(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); GL(glBindVertexArray(renderer->Panel.VertexArrayObject)); diff --git a/alvr/client_openxr/Cargo.toml b/alvr/client_openxr/Cargo.toml index ed60fb217c..9c57224f0c 100644 --- a/alvr/client_openxr/Cargo.toml +++ b/alvr/client_openxr/Cargo.toml @@ -103,6 +103,9 @@ required = false name = "oculus.software.handtracking" required = false [[package.metadata.android.uses_feature]] +name = "com.oculus.feature.PASSTHROUGH" +required = false +[[package.metadata.android.uses_feature]] name = "com.oculus.software.body_tracking" required = false [[package.metadata.android.uses_feature]] diff --git a/alvr/client_openxr/src/lib.rs b/alvr/client_openxr/src/lib.rs index cb2d9e19cc..cecd70dddf 100644 --- a/alvr/client_openxr/src/lib.rs +++ b/alvr/client_openxr/src/lib.rs @@ -156,6 +156,7 @@ pub fn entry_point() { exts.htc_facial_tracking = available_extensions.htc_facial_tracking; exts.htc_vive_focus3_controller_interaction = available_extensions.htc_vive_focus3_controller_interaction; + exts.fb_passthrough = available_extensions.fb_passthrough; #[cfg(target_os = "android")] { exts.khr_android_create_instance = true; @@ -203,6 +204,18 @@ pub fn entry_point() { session: xr_session.clone(), }; + let passthrough = xr_session + .create_passthrough(xr::PassthroughFlagsFB::IS_RUNNING_AT_CREATION) + .unwrap(); + + let _passthrough_layer = xr_session + .create_passthrough_layer( + &passthrough, + xr::PassthroughFlagsFB::IS_RUNNING_AT_CREATION, + xr::PassthroughLayerPurposeFB::RECONSTRUCTION, + ) + .unwrap(); + let views_config = xr_instance .enumerate_view_configuration_views( xr_system,