-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fbb683b
Showing
171 changed files
with
95,322 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
[Ll]ibrary/ | ||
[Tt]emp/ | ||
[Oo]bj/ | ||
/[Ll]ogs/ | ||
[Bb]uild/ | ||
[Bb]uilds/ | ||
Assets/AssetStoreTools* | ||
|
||
# Visual Studio cache directory | ||
.vs/ | ||
|
||
# Autogenerated VS/MD/Consulo solution and project files | ||
ExportedObj/ | ||
.consulo/ | ||
*.csproj | ||
*.unityproj | ||
*.sln | ||
*.suo | ||
*.tmp | ||
*.user | ||
*.userprefs | ||
*.pidb | ||
*.booproj | ||
*.svd | ||
*.pdb | ||
*.mdb | ||
*.opendb | ||
*.VC.db | ||
|
||
# Unity3D generated meta files | ||
*.pidb.meta | ||
*.pdb.meta | ||
*.mdb.meta | ||
|
||
# Unity3D Generated File On Crash Reports | ||
sysinfo.txt | ||
|
||
# Builds | ||
*.apk | ||
*.aab | ||
*.unitypackage | ||
*.app | ||
|
||
|
||
# Ignore: name DOT meta | ||
*.meta | ||
# Include: name DOT extension DOT meta | ||
!*.*.meta | ||
|
||
ZEDUnityLivelink/Logs/ | ||
ZEDUnityLivelink/UserSettings/ | ||
ZEDUnityLivelink/.vsconfig | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
# Stereolabs ZED - Live Link for Unity | ||
ZED LiveLink Plugin for Unity | ||
|
||
## ZED Live Link for Unity | ||
|
||
This tool is an interface between the SDK Fusion module and Unity. It sends fused skeleton data to the engine so that 3D avatars can be animated in Unity using one or several ZED cameras working together. | ||
|
||
The data is broadcast via UDP on a specified port, and can be received using the assets of the paired Unity project. | ||
|
||
## Compatibility | ||
|
||
### Dependencies | ||
|
||
- **ZED SDK v4.x**, available on [stereolabs.com](https://www.stereolabs.com/developers/) | ||
- **Unity 2021.3** and more recent versions, available on [unity.com](https://unity.com/download) | ||
- It will probably work well with older versions, as its core is an UDP receiver which animates an Humanoid avatar, but has not been tested with them. | ||
- You may encounter an error about the package **Newtonsoft** not being installed at first launch. With versions 2022.x and more recent of Unity, it should not happen, but in any case please refer to [the Newtonsoft repo](https://github.com/jilleJr/Newtonsoft.Json-for-Unity/wiki/Install-official-via-UPM) for installation instructions with Unity Package Manager. | ||
|
||
### Difference with the ZED Unity Plugin | ||
|
||
The ZED Unity plugin, available [here](), is a full integration of the SDK features in Unity, except for the multi-camera data fusion. It comes as an Unity Package, allowing dialogue between your project and all the ZED SDK capabilities. | ||
|
||
This sample comes as an alternative and a complement, allowing your Unity project to receive only **Body Tracking data**, from one or several cameras. The Unity project provided does not implement any dialogue with the SDK, only being able to receive data from the sender tools (not the SDK directly). | ||
|
||
## Content | ||
|
||
### Sender tools | ||
|
||
The `ZED Unity Live Link` and `ZED Unity Live Link Fusion` projects are the C++ samples responsible for sending the data from the SDK to Unity via UDP. | ||
|
||
- The `ZED Unity Live Link Mono` sample directly calls the SDK and sends only the Body Tracking data to Unity. | ||
|
||
- The `ZED Unity Live Link Fusion` sample uses the Fusion module of the SDK to combine the Body Tracking data from several cameras, via a direct USB connection or ZEDHub. | ||
|
||
### Unity project | ||
|
||
The `Live Link for Unity` project comes with some scripts to receive skeleton data, a sample scene to discover it and a 3D avatar to populate said scene. | ||
|
||
Scenes : | ||
- *Skeleton Fusion* : main scene, simple space showcasing the necessary elements to receive skeleton data from the sender and animate some 3D avatars. | ||
- *Upper Body Tracking* : Implementation of a way to use only the upper part of the body (from the spine and above) to animate the avatar. | ||
|
||
Main scripts : | ||
- *ZEDStreamingClient* : Manage the reception of data from the sender. | ||
- *ZEDCommon* : Defines the structure of the body data received and used in the sample. | ||
- *ZEDSkeletonTrackingManager* : Manages the display of the 3D avatars by processing the data received by the `ZEDStreamingClient` at each reception. | ||
- *SkeletonHandler* : Main script to manage the "data" part of each body detected. | ||
- *ZEDSkeletonAnimator* : Script to manage the animation of each avatar, using the `SkeletonHandler` data. | ||
|
||
Main prefabs : | ||
- *FusionManager* : The main manager, with the `ZEDStreamingClient` and `ZEDSkeletonTrackingManager` components attached. | ||
- *Unity_Avatar* : Sample avatar using Unity's [Starter Assets](https://assetstore.unity.com/packages/essentials/starter-assets-third-person-character-controller-196526) 3D humanoid model. | ||
|
||
## Using the Live Link for Unity tools | ||
|
||
### Quick Start | ||
|
||
- First, download and install the latest version of the ZED SDK on [stereolabs.com](https://www.stereolabs.com/developers/) (**Minimum requirement: ZED SDK v4.0**). | ||
- For more information, read the ZED [Documentation](https://www.stereolabs.com/docs) and [API documentation](https://www.stereolabs.com/docs/api/) | ||
- Download the C++ samples and the Unity project (or unitypackage) on the [Releases page](). You can also directly pull the master branch of the repo for an up-to-date version. | ||
- Generate either or both of the projects (`fusion` or `mono`) using CMake. | ||
- Open the `main.cpp` file and set the `servAddress` and `servPort` variables with your desired address and port. | ||
- The default values are `230.0.0.1` for the IP and `20001` for the port. | ||
|
||
```c++ | ||
// ---------------------------------- | ||
// UDP to Unity---------------------- | ||
// ---------------------------------- | ||
std::string servAddress; | ||
unsigned short servPort; | ||
UDPSocket sock; | ||
|
||
sock.setMulticastTTL(1); | ||
|
||
servAddress = "230.0.0.1"; | ||
servPort = 20001; | ||
|
||
std::cout << "Sending fused data at " << servAddress << ":" << servPort << std::endl; | ||
// ---------------------------------- | ||
// UDP to Unity---------------------- | ||
// ---------------------------------- | ||
``` | ||
|
||
- Build the sample and execute it, passing your calibration file (see [the documentation about ZED360]() for more details) as argument, if you're using the Fusion sender, or either nothing or your SVO file for the mono-camera sender. | ||
``` | ||
> path/to/the/ZED_Sender_Fusion.exe path/to/the/calib_file.json | ||
``` | ||
``` | ||
> path/to/the/ZED_Sender_Monocam.exe [path/to/the/file.svo] | ||
``` | ||
- Import the Unity package in your project or just open the project provided on this repo. | ||
- Check that the `Port` and `Multicast IP Address` variables of the `ZED Streaming Client` script on the `Fusion Manager` prefab are set to the same values as in the `main.cpp` set previously. | ||
|
||
![zedstreamingclientimage here]() | ||
|
||
- Run the scene and you should see avatars moving in Unity ! | ||
|
||
### Main settings in Unity | ||
|
||
These are located on the `ZED Skeleton Tracking Manager` script in the `Fusion Manager` prefab. | ||
|
||
![zedskeletontrackingmanagerimage here]() | ||
|
||
- `Enable Avatar` / `Enable SDK Skeleton` : controls the visibility of the 3D avatar and of the skeleton directly derived from the keypoints of the SDK. | ||
- `Avatars` : Array of 3D avatars randomly chosen when detecting a new person. | ||
- All of Unity **Humanoid** avatars should be compatible, provided they are made into a prefab with a `ZEDSkeletonAnimator` component attached. | ||
- `Enable SDK Skeleton` : controls the visibility of the *stickman* view of the SDK keypoints. Whereas the 3D avatar is animated using local rotations derived from the keypoints, this show the actual positions of the keypoints detected by the SDK. | ||
- `Log Fusion Metrics` : enables logging the metrics sent by the Fusion module in the console. More information in the [Fusion Documentation](). | ||
|
||
## Support | ||
You will find guidance and assistance : | ||
- In the [documentation of the sample](https://www.stereolabs.com/docs/livelink-unity/) | ||
- On our [Community forums](https://community.stereolabs.com/) | ||
|
||
## Bugs and fixes | ||
You found a bug / a flaw in our plugin ? Please check that it is not already reported, and open an issue if necessary. You can also reach out to us on the community forums for any question or feedback ! | ||
|
||
*By the way, we also have a special place in our hearts for PR senders.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!114 &11400000 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 0} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: bf2edee5c58d82540a51f03df9d42094, type: 3} | ||
m_Name: URPAsset | ||
m_EditorClassIdentifier: | ||
k_AssetVersion: 9 | ||
k_AssetPreviousVersion: 9 | ||
m_RendererType: 1 | ||
m_RendererData: {fileID: 0} | ||
m_RendererDataList: | ||
- {fileID: 11400000, guid: 93106034bbc657942b45b4f5d0d9881b, type: 2} | ||
m_DefaultRendererIndex: 0 | ||
m_RequireDepthTexture: 0 | ||
m_RequireOpaqueTexture: 0 | ||
m_OpaqueDownsampling: 1 | ||
m_SupportsTerrainHoles: 1 | ||
m_StoreActionsOptimization: 0 | ||
m_SupportsHDR: 1 | ||
m_MSAA: 8 | ||
m_RenderScale: 1 | ||
m_UpscalingFilter: 3 | ||
m_FsrOverrideSharpness: 0 | ||
m_FsrSharpness: 0.92 | ||
m_MainLightRenderingMode: 1 | ||
m_MainLightShadowsSupported: 1 | ||
m_MainLightShadowmapResolution: 2048 | ||
m_AdditionalLightsRenderingMode: 1 | ||
m_AdditionalLightsPerObjectLimit: 4 | ||
m_AdditionalLightShadowsSupported: 0 | ||
m_AdditionalLightsShadowmapResolution: 2048 | ||
m_AdditionalLightsShadowResolutionTierLow: 256 | ||
m_AdditionalLightsShadowResolutionTierMedium: 512 | ||
m_AdditionalLightsShadowResolutionTierHigh: 1024 | ||
m_ReflectionProbeBlending: 0 | ||
m_ReflectionProbeBoxProjection: 0 | ||
m_ShadowDistance: 50 | ||
m_ShadowCascadeCount: 1 | ||
m_Cascade2Split: 0.25 | ||
m_Cascade3Split: {x: 0.1, y: 0.3} | ||
m_Cascade4Split: {x: 0.067, y: 0.2, z: 0.467} | ||
m_CascadeBorder: 0.2 | ||
m_ShadowDepthBias: 1 | ||
m_ShadowNormalBias: 1 | ||
m_AnyShadowsSupported: 1 | ||
m_SoftShadowsSupported: 1 | ||
m_ConservativeEnclosingSphere: 1 | ||
m_NumIterationsEnclosingSphere: 64 | ||
m_AdditionalLightsCookieResolution: 2048 | ||
m_AdditionalLightsCookieFormat: 3 | ||
m_UseSRPBatcher: 1 | ||
m_SupportsDynamicBatching: 0 | ||
m_MixedLightingSupported: 1 | ||
m_SupportsLightLayers: 0 | ||
m_DebugLevel: 0 | ||
m_UseAdaptivePerformance: 1 | ||
m_ColorGradingMode: 0 | ||
m_ColorGradingLutSize: 32 | ||
m_UseFastSRGBLinearConversion: 0 | ||
m_ShadowType: 1 | ||
m_LocalShadowsSupported: 0 | ||
m_LocalShadowsAtlasResolution: 256 | ||
m_MaxPixelLights: 0 | ||
m_ShadowAtlasResolution: 256 | ||
m_ShaderVariantLogLevel: 0 | ||
m_VolumeFrameworkUpdateMode: 0 | ||
m_ShadowCascades: 0 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!114 &11400000 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 0} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: de640fe3d0db1804a85f9fc8f5cadab6, type: 3} | ||
m_Name: URPRenderer | ||
m_EditorClassIdentifier: | ||
debugShaders: | ||
debugReplacementPS: {fileID: 4800000, guid: cf852408f2e174538bcd9b7fda1c5ae7, type: 3} | ||
m_RendererFeatures: [] | ||
m_RendererFeatureMap: | ||
m_UseNativeRenderPass: 0 | ||
postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2} | ||
xrSystemData: {fileID: 11400000, guid: 60e1133243b97e347b653163a8c01b64, type: 2} | ||
shaders: | ||
blitPS: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3} | ||
copyDepthPS: {fileID: 4800000, guid: d6dae50ee9e1bfa4db75f19f99355220, type: 3} | ||
screenSpaceShadowPS: {fileID: 0} | ||
samplingPS: {fileID: 4800000, guid: 04c410c9937594faa893a11dceb85f7e, type: 3} | ||
stencilDeferredPS: {fileID: 4800000, guid: e9155b26e1bc55942a41e518703fe304, type: 3} | ||
fallbackErrorPS: {fileID: 4800000, guid: e6e9a19c3678ded42a3bc431ebef7dbd, type: 3} | ||
materialErrorPS: {fileID: 4800000, guid: 5fd9a8feb75a4b5894c241777f519d4e, type: 3} | ||
coreBlitPS: {fileID: 4800000, guid: 93446b5c5339d4f00b85c159e1159b7c, type: 3} | ||
coreBlitColorAndDepthPS: {fileID: 4800000, guid: d104b2fc1ca6445babb8e90b0758136b, type: 3} | ||
cameraMotionVector: {fileID: 4800000, guid: c56b7e0d4c7cb484e959caeeedae9bbf, type: 3} | ||
objectMotionVector: {fileID: 4800000, guid: 7b3ede40266cd49a395def176e1bc486, type: 3} | ||
m_AssetVersion: 1 | ||
m_OpaqueLayerMask: | ||
serializedVersion: 2 | ||
m_Bits: 4294967295 | ||
m_TransparentLayerMask: | ||
serializedVersion: 2 | ||
m_Bits: 4294967295 | ||
m_DefaultStencilState: | ||
overrideStencilState: 0 | ||
stencilReference: 0 | ||
stencilCompareFunction: 8 | ||
passOperation: 2 | ||
failOperation: 0 | ||
zFailOperation: 0 | ||
m_ShadowTransparentReceive: 1 | ||
m_RenderingMode: 0 | ||
m_DepthPrimingMode: 0 | ||
m_AccurateGbufferNormals: 0 | ||
m_ClusteredRendering: 0 | ||
m_TileSize: 32 | ||
m_IntermediateTextureMode: 1 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
ZEDUnityLivelink/Assets/UniversalRenderPipelineGlobalSettings.asset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!114 &11400000 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 0} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: 2ec995e51a6e251468d2a3fd8a686257, type: 3} | ||
m_Name: UniversalRenderPipelineGlobalSettings | ||
m_EditorClassIdentifier: | ||
k_AssetVersion: 2 | ||
lightLayerName0: Light Layer default | ||
lightLayerName1: Light Layer 1 | ||
lightLayerName2: Light Layer 2 | ||
lightLayerName3: Light Layer 3 | ||
lightLayerName4: Light Layer 4 | ||
lightLayerName5: Light Layer 5 | ||
lightLayerName6: Light Layer 6 | ||
lightLayerName7: Light Layer 7 | ||
m_StripDebugVariants: 1 | ||
m_StripUnusedPostProcessingVariants: 0 | ||
m_StripUnusedVariants: 1 | ||
supportRuntimeDebugDisplay: 0 |
8 changes: 8 additions & 0 deletions
8
ZEDUnityLivelink/Assets/UniversalRenderPipelineGlobalSettings.asset.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.