stereolabs / zed-unity

ZED SDK Unity plugin
https://www.stereolabs.com/documentation/guides/using-zed-with-unity/introduction.html
MIT License
254 stars 57 forks source link

ZED_GreenScreen : How can i render the camera frame in front of all virtual objects ? #230

Closed Gnoknop closed 2 years ago

Gnoknop commented 2 years ago

Preliminary Checks

Proposal

Hello, I am wondering how could I setup the ZED_GreenScreen that the camera frame will be always on the top of virtual objects ?

Almost similar to this post : Occlusion for real-world frame, yet ZED_GreenScreen doesn't use ZED_Forward_Lighting Shader.

Here is what i'm trying to achieve ( left = current state ; right = goal ) :

0

ps : i don't want to move 3D objects further away from the camera

Thank you for your help

Use-Case

No response

Anything else?

No response

Bvallon-sl commented 2 years ago

Hi,

The solution shared in the issues you link should work in the Green Screen shader as well, even if the option is missing.

I added a modified version of the shader which should do what you are looking for. All you have to do is disable the "Depth occlusion" option in the ZEDManager.cs script.

Best, Benjamin V.

GreenScreen.txt

Gnoknop commented 2 years ago

Hi,

The solution shared in the issues you link should work in the Green Screen shader as well, even if the option is missing.

I added a modified version of the shader which should do what you are looking for. All you have to do is disable the "Depth occlusion" option in the ZEDManager.cs script.

Best, Benjamin V.

GreenScreen.txt

Thanks for answering me.

I replaced the GreenScreen.shader Code with the modified version you gave me and then disabled the " Depth occlusion " option. Unfortunately, that method doesn't work. The Depth occlusion remain active ( despite the option being disable ) and my camera frame is still behind nearest 3D objects.

I noticed something, that might be the cause of the problem ( ? ) :

S.D.K Version i use : 3.6.0

Still, i haven't clue how to solve this. I'm looking forward for your help. Thank you

Bvallon-sl commented 2 years ago

Hi,

If you are using the sdk 3.6.0 you need to do a small change in the shader :

Gnoknop commented 2 years ago
  • change all the occurrence of "NO_DEPTH" with "NO_DEPTH_OCC"

Work like a charm. Thanks a lot !

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment otherwise it will be automatically closed in 5 days