googlesamples / arcore-depth-lab

ARCore Depth Lab is a set of Depth API samples that provides assets using depth for advanced geometry-aware features in AR interaction and rendering. (UIST 2020)
https://augmentedperception.github.io/depthlab/
Apache License 2.0
762 stars 152 forks source link

No Shadows in Collision Scene #38

Closed knewk closed 2 years ago

knewk commented 2 years ago

Nice work. I'm trying to get shadows from the throw objects in the Collision scene but they seem to be missing. They are there in the non AR Foundation version. Looks like the shadow receiving mesh is obscured by the AR Foundation occlusion.

ruofeidu commented 2 years ago

Yes, thank you Martin for pointing out. DepthLab was originally developed for ARCore legacy SDK while we haven't integrated the shadow receiver to ARF. Please feel free to contribute :)

ruofeidu commented 2 years ago

This is really cool! Please feel free to send over a PR.

ruofeidu commented 2 years ago

Sorry for my abbreviation - PR is short for pull request. It's your choice whether or not to contribute to the codebase. I probably won't have cycles to transfer all scenes from legacy SDK to the ARF one but will try my best - and I welcome contributions :)

knewk commented 2 years ago

Hi All, got the shadows working in the collision scene. Was as simple as turning on the Shadow Type to Hard Shadows for LightEstimation prefab. Setting the shadow quality setting in Project Settings to high. And the Shadow Distance to 6 and Shadow Near Plane Offset to 0.1.

ruofeidu commented 2 years ago

Hi knewk, thanks a lot for sharing! Would you like to create a pull request and patch the code?

knewk commented 2 years ago

Hi knewk, thanks a lot for sharing! Would you like to create a pull request and patch the code?

Cheers. Can do. I look at some other changes I'd like to make and also discuss stuff. e.g. Upgrading to latest 2020 Unity and 1.29 AR Core Extensions. What's the best way to communicate with contributors?

knewk commented 2 years ago

The shadow is there however it seems to be too big. Maybe the shadow receiver mesh is too close. This could also explain why it shows up in front of the AR Foundation occlusion. I need to investigate further. Below is a screen shot of the current shadow using my suggestions above, moving on a frame where a shadow is cast and received by an object showing a comparable size, and my shadow receiver implementation incorporating occlusionManager.TryAcquireEnvironmentDepthCpuImage(out XRCpuImage cpuDepthImage) into DepthSource.

Screenshot 2022-02-27 200833

ruofeidu commented 2 years ago

Hi Akssieg,

The shadow is in legacy ARCore SDK branch and we don't have enough bandwidth to port it to the ARF version.

I always welcome PRs and please feel free to contribute your shadow!!

Cheers, Ruofei