# weird dark outlines when video playing in Quest2

**URL:** <https://forums.unrealengine.com/t/weird-dark-outlines-when-video-playing-in-quest2/784952>\
**Category:** XR Development\
**Tags:** edge, video-texture, oculus-quest, video, unreal-engine\
**Created:** [March 6, 2023, 3:45pm UTC](https://forums.unrealengine.com/t/weird-dark-outlines-when-video-playing-in-quest2/784952 "2023-03-06T15:45:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hexaylon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/hexaylon/32/725386_2.png) [@Hexaylon](https://forums.unrealengine.com/u/Hexaylon)\
**Post date:** [March 6, 2023, 3:45pm UTC](https://forums.unrealengine.com/t/weird-dark-outlines-when-video-playing-in-quest2/784952/1 "2023-03-06T15:45:05Z")

</div>

Hi, folks, I have issue with dark outline edges around videos playing in VR goggles.  
when played in UE4.27.2, the widget with video texture looks fine

 ![36817a6e-7071-480f-b638-bf00311b773b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/f/e5f7be9f878fc6553cbf51987a03f8d1407ff0cf.jpeg)  
however, inside quest2, it shows black outlines  
 ![5ad85773-f6d4-4230-be34-3832f86db961](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/9/4/994c827561e0cf930c179d74e892b38675985d78.jpeg)

the setup was using a combined video with color image on the top and black&white masks on the bottom. using widget with stereo layer.

 ![b571d311-912d-4e33-9350-b3c7670fae37](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/c/5/bc538069864e87c2c88c7dc3c49d191fba11594e.png)  
 ![0bd4f95d-9bc2-4afe-bfa7-e9fae7f0938f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/9/1/491fa81b565a3f63d50aa29d0867e031aca7dd4a.png)

 ![8fe8f7d2-53c7-4e8b-8fb3-41ef5c6d37db](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/6/1/d61ab4915a56b5ef0a143c151985335fa5912642.png)  
 ![c7e699b6-b13c-4555-bf9e-c1f83d793e6a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/7/3/97367d6d897227d1f2967c6e2cee66abb13ca30b.png)

and the mask has already been shunken and blurred. ( you could see the fingers are starting to disappear)

 ![1a44be25-f9e5-4038-bf0f-341fb8fdb702](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/6/c/86cc77e51c61363cb9ae49dbb8087ff37ae01ed8.png)  
 ![11ce2049-4274-4f95-8d76-ada5b9b48e23](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/b/f/8bfdfbc53ed02deb568986cd99a4a2704ffd7a51.png)

tried different blend mode with no luck.

Any clue with eliminating the annoying dark edges would be more than helpful.  
thanks!!

---

<div class="post-metadata">

**Author:** ![Rectus\_SA](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rectus\_SA](https://forums.unrealengine.com/u/Rectus_SA)\
**Post date:** [March 6, 2023, 11:05pm UTC](https://forums.unrealengine.com/t/weird-dark-outlines-when-video-playing-in-quest2/784952/2 "2023-03-06T23:05:50Z")

</div>

The dark outlines look like what happens when the alpha gets masked out twice. Stereo layers are composited by the VR runtime instead of the engine. For it to work correctly, the runtime compositor needs to be told that the alpha is already premultiplied. Most runtimes should support this, but I don’t know if there is any support in the Unreal Stereo layer component for doing that. If there isn’t, it might be necessary to either modify the engine, or composite the video on the application side instead of using a stereo layer.

---

<div class="post-metadata">

**Author:** ![Hexaylon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/hexaylon/32/725386_2.png) [@Hexaylon](https://forums.unrealengine.com/u/Hexaylon)\
**Post date:** [March 7, 2023, 12:08am UTC](https://forums.unrealengine.com/t/weird-dark-outlines-when-video-playing-in-quest2/784952/3 "2023-03-07T00:08:50Z")

</div>

Hi Rectus,  
" the runtime compositor needs to be told that the alpha is already premultiplied."  
do yo mean there is some settings we need to change on the Oculus VR plugin?  
Not sure how to modify based on your advice.  
Could you talk a bit more to details?

---

<div class="post-metadata">

**Author:** ![Rectus\_SA](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rectus\_SA](https://forums.unrealengine.com/u/Rectus_SA)\
**Post date:** [March 7, 2023, 1:24am UTC](https://forums.unrealengine.com/t/weird-dark-outlines-when-video-playing-in-quest2/784952/4 "2023-03-07T01:24:15Z")

</div>

It’s something that is done in code where the engine interfaces with the VR runtime.

I looked at the code, and it seems for the Oculus plugin, it actually applies the masking in the engine instead of in the runtime. To fix it, you would need to modify the engine, specifically, the `FLayer::UpdateTexture_RenderThread()` function in `OculusHMD_Layer.cpp`, and add a way to set `bAlphaPremultiply` to false for your layer.

For completions sake, the OpenXR plugin does it on the runtime side by passing the `XR_COMPOSITION_LAYER_UNPREMULTIPLIED_ALPHA_BIT` flag when creating a quad composition layer. Toggling that flag off will make it consider the alpha premultiplied.

---

<div class="post-metadata">

**Author:** ![Hexaylon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/hexaylon/32/725386_2.png) [@Hexaylon](https://forums.unrealengine.com/u/Hexaylon)\
**Post date:** [March 13, 2023, 3:40pm UTC](https://forums.unrealengine.com/t/weird-dark-outlines-when-video-playing-in-quest2/784952/5 "2023-03-13T15:40:25Z")

</div>

Hi Rectus, we tried `bAlphaPremultiply` to false, however now multiple frames are remaining displayed , looked like ghosting/onion skin effect, meanwhile the dark edges remains visible.  
is there anything that we are missing here?

---

<div class="post-metadata">

**Author:** ![Rectus\_SA](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rectus\_SA](https://forums.unrealengine.com/u/Rectus_SA)\
**Post date:** [March 13, 2023, 4:30pm UTC](https://forums.unrealengine.com/t/weird-dark-outlines-when-video-playing-in-quest2/784952/6 "2023-03-13T16:30:11Z")

</div>

In that case it might be something doing it earlier in the process. Does it still happen if you output the video to the stereo layer without using a widget in between (if that is even possible)?
