stereolabs / zed-unity

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

Project Optimization and Git package support #283

Closed smitdylan2001 closed 3 months ago

smitdylan2001 commented 4 months ago

PR containing performance optimizations, assembly definition support, and git package support for easy package installs. Tested to work in sample scenes.

Assembly definitions:

Zed core Zed Editor Zed Examples (installed with Samples from package manager)

Git support:

After merging install from https://github.com/stereolabs/zed-unity.git?path=/ZEDCamera/Assets Current install URL: https://github.com/smitdylan2001/zed-unity.git?path=/ZEDCamera/Assets#ProjectOptimization

Performance optimizations:

Todo:

[x] Test with OpenCV (I do not have a license) [ ] Change install instructions in readme to git URL in package manager

SLJLMacarit commented 4 months ago

The "Common" folder can not be imported through the package manager, breaking the green screen sample. Furthermore, it's only ever used with the green screen sample. Can you confirm the fix would be to just move the folder inside of the green screen sample folder? That's something we can do ourselves afterwards.

SLJLMacarit commented 4 months ago

Under Assets/Samples/ZED SDK/4.1.0/Green Screen/Shaders/:

These shaders have a broken reference: Couldn't open include file '../../../SDK/Helpers/Shaders/ZED_Utils.cginc'.

This is probably due to the separation of the package files and the samples files. Can this be fixed?

SLJLMacarit commented 4 months ago

Is it difficult to add an "Import All Samples" option to the packages manager?

SLJLMacarit commented 4 months ago

The Plane Detection and VR Plane Detection samples were split in two folders whereas they were in the same one before. This leads to duplicated code and assets. Can they be put back into the same folder?

SLJLMacarit commented 4 months ago

Tested with OpenCV, no issue 👍

SLJLMacarit commented 4 months ago

The Mixed Reality Calibration (Packages/com.stereolabs.zed/Tools/Mixed Reality Calibration/Scene/MR Calibration.unity) is not available in the samples, so it can't be opened as is. It must be copied from the package into the project. Can you make it into a sample ? Since it's the only thing in the tools folder, getting rid of the tools folder altogether is not a problem.

smitdylan2001 commented 4 months ago

The "Common" folder can not be imported through the package manager, breaking the green screen sample. Furthermore, it's only ever used with the green screen sample. Can you confirm the fix would be to just move the folder inside of the green screen sample folder? That's something we can do ourselves afterwards.

Put the folder in the sample folder, I will test next push

Under Assets/Samples/ZED SDK/4.1.0/Green Screen/Shaders/:

  • ComputeGreenScreen
  • GreenScreen
  • GreenScreen_URP
  • YUV

These shaders have a broken reference: Couldn't open include file '../../../SDK/Helpers/Shaders/ZED_Utils.cginc'.

This is probably due to the separation of the package files and the samples files. Can this be fixed?

Ah I see. I can try to hard link them, so making them reference packages. This will break the development project tho. An alternative is make a copy of the utils include in the green screen shader folder, or potentially (if this does not break references) have the green screen shaders in the SDK/Helpers/Shaders folder as well. Shaders do not add compile time, so that should be fine.

Is it difficult to add an "Import All Samples" option to the packages manager?

This is not something which is supported by Unity. I could make a parent folder with all samples, but if people import all samples, and after that an individual sample that will import the sample twice, causing compilation issues. I would advice against it and make it a feature request for Unity

The Mixed Reality Calibration (Packages/com.stereolabs.zed/Tools/Mixed Reality Calibration/Scene/MR Calibration.unity) is not available in the samples, so it can't be opened as is. It must be copied from the package into the project. Can you make it into a sample ? Since it's the only thing in the tools folder, getting rid of the tools folder altogether is not a problem.

I will add it as a sample and put it under the Sample asmdef in the next push

smitdylan2001 commented 4 months ago

It would be nice to add the MR calibration in the Samples in the git readme as well. Now it only is in the documentation

smitdylan2001 commented 4 months ago

Fixed the sample issues and added the mixed reality sample Also fixed an issue when importing the green screen sample without asmdef support added because the editor reference was lost