Skip to main content
November 25, 2021

Passthrough and post processing

Good afternoon.

 

I am in a student research group working on a game/Passthrough showcase, that shows factory building and prototyping in vr.

 

We have been struggling a lot with getting Passthrough working, over the last 4 months. Now we had an issue again where it would not work at all in underlay mode when post processing was enabled on the camera using a global volume. 

 

Any advice? As we need the post processing for our product.

 

Unity: 2020.3.22f1 URP

XR plugin managment: 4.2.0

Oculus integrations: 34.0

This topic has been closed for replies.

31 replies

New Participant
December 3, 2021

I'm facing the same problem, using same setup(unity version, plugin version, etc). The background is just black if the post-processing on the camera component is turned on. Doesn't matter if there's a global post-processing volume or not. 

Currently I'm just turning off the post processing on the camera when using passthrough, but I would really like to have bloom in passthrough environment.

New Participant
December 7, 2021

Same here... Would be great to use both in combination.

Inspiring
June 30, 2023

Same problem, Integration SDK v 54.1. No one's got a solution ?

Up and Coming
June 30, 2023

I had this problem a while ago, back then it was caused by the post-processing shader not reading the alpha from the framebuffer texture you had generated while rendering your frame. It put an alpha of 1 for every pixel, which means the passthrough texture (at least in Underlay mode) won't blend with the texture output from post-processing.

A hack that worked back then was to go to your UberPost.shader, and on line 238, instead of:

return half4(color, 1.0);

Use the alpha from the source texture, like this:

return half4(color, _SourceTexture.a);

This is mostly from memory, not sure if it still works! Also it will have issues with blending because now you have kind of a 'cutout' where the stuff you've rendered is drawn, you won't get effects in areas where you hadn't rendered anything before the post-processing was done. _Also_, this is a change to the URP package so you'll need to make your own branch of URP, either in your /Packages directory, or by some other cunning hack.

Good luck!

Inspiring
July 3, 2023

Thank you so much ! 
I managed to do it, getting the alpha needed a little bit more code but it's the idea. For anyone who runs into the same problem, here's the solution : 

- Make a copy of UberPost.shader file into your assets
- Modify line 238 (return half4(color, 1.0);) by :

half alpha = SAMPLE_TEXTURE2D_X(_SourceTex, sampler_LinearClamp, uvDistorted).w;
return half4(color, alpha);

- Create a new PostProcessData asset (or modify a custom one)

- Turn the inspector into debug mode, and set your custom UberPost shader in the corresponding frame

 

And this should work !

 

 

Participant
January 8, 2024

Can't find '_SourceTex' in the shader.
Tried to use _UserLut & _OverlayUITexture, but the result is transparent. 😓

New Participant
January 10, 2024

Thanks! I have checked the UberPost.shader in the package, and only used by the default PostProcessData.asset which is unable to be deleted. I have changed the post-process data to my custom post-process data which has changed the shader also. But the post-processing still does not work with passthrough‌‌.
I am using Unity 2022.3.14 with URP version 14.0.9 and 2022.3.14 Unity

Participant
January 10, 2024

What happens if you edit the actual UberPost.shader in the package and save it - will it work then?
I also deleted all possible Quality settings and left only the one with the custom PostProcessData.asset

New Participant
January 11, 2024

The post-processing should work with passthrough with the solution mentioned above!!! Seems other settings are causing the issue!

After I disabled different features of post-processing, I found out the HDR caused the black background. This means I can't use the bloom effect in passthrough mode, while others should be working. This is quiet important to my current project, does anyone have tried before?☹️

Sandstedt
Inspiring
March 7, 2024

This worked for me using Unity 2022.3.19f1 and URP com.unity.render-pipelines.universal@14.0.10:
Copy the com.unity.render-pipelines.universal@14.0.10 folder from \Library\PackageCache to \Packages.

In UberPost.shader, change (on row 287):

return half4(color, 1.0);

To:

half alpha = SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uvDistorted).w;
return half4(color, alpha);


Adding post-processing tick on only the center camera in a OVR Camera rig. Make sure Universal Render Data file has Post-processing and HDR enabled. Add a global volume with bloom with some good settings. Now all HDR material with enough emission will bloom just fine. Not the most performant solution though. (The classic DOOM Volumetric Bloom trick is more performant)

But are probably better solutions in the thread, so you don't have to copy the entire URP package, but havn't tried 😄

Example: https://x.com/jonassandstedt/status/1765683987408711904?s=20

Unity XR Developer
New Participant
March 28, 2024

Thanks! I managed to run your solution, but in my case fail as soon as I active HDR. I checked the _blitTexture and is full 1.0 on every channel if HDR is enabled. Any idea?

Participant
April 18, 2024

Did you ever resolve this?

Inspiring
March 27, 2024

I'm desperately trying to get some bloom on top of passthrough but unfortunately your solution didn't work for me.
(unity 2022.3.20f1)

Update : I fixed it (bloom on top of pass-through) by going trough all the places where HDR is mentioned and manually set it to explicit OFF. it seems when i set the tick box for post process, it automatically reactivates the HDR for the camera even if the camera's settings is set to follow URP settings and URP settings are HDR off.

http://unwise.software/
Participant
April 18, 2024

Hi Yoirgl,

Can you elaborate on "going through all the places where HDR is mentioned and setting it to OFF"?
I thought you needed HDR in order to have bloom so I'm a bit confused on what you did to get it to work.

New Participant
April 18, 2024

Hello,

Well, there are certainly some smarter people than me who will correct me if I'm wrong but it is my understanding than in SDR mode you can't get a pixel intensity beyond 1.

So usually bloom is configured to be above 1, in HDR.

In my case, I wanted to use the passthrough and bloom but was forced out of HDR by Meta's incompatibility.

What I did was to configure postprocess's bloom to trigger above the treshold of 0.9 or 0.95.

Therefore all elements lit close to max intensity will emit bloom. It is a bit tricky as it applies not only to emissive but to all materials. It's therefore important to adjudt light and material settings to be sure the bloom doesn't affect items that are not required to emit bloom.

For example, i had to get all my UI text to show in a pale white instead of full white.

 

It's annoying but it kinda works.

 

I really hope passthrough will get some HDR compatibility, tho as it's an unnecessary burden.

I just had to make sure hdr was explicitly off on camera, urp settings and all places in the settings i could find.

 

I hope this helps.

Yoirgl

(Edit:sorry I replied with wrong account)

 

Inspiring
June 28, 2024

In Unity I use Meta -> Tools -> Building Blocks -> Passthrougth template. I do not know what is global volume for you, but for me all works with this template.

Up and Coming
July 24, 2024

Following this for further testing

Up and Coming
July 28, 2024

Haven't tried it, but looks like this is possible in Unity 6: https://www.youtube.com/watch?v=G6p8E2GMi-E