VaultsdkUnity by Euclideon - 1

SDK

Unity/Euclideon Vault Integration for large scale point cloud visualization

Unity 2019.4.3f1Unknown LicenseUpdated 44 days agoCreated on June 16th, 2020
Go to source

This repository is no longer active after the migration from Vault SDK to udSDK. Please use the udSDKUnity moving forward.

VDK Unity

This project demonstrates the use of Euclideon Vault developer Kit (Vault SDK) with the Unity Real Time Development Platform.

Language:              C#
Type:                  Integration
Contributor:           Euclideon Vault Development Team <support@euclideon.com>
Organization:          Euclideon, https://euclideon.com/vault
Date:                  2020-08-10
udSDK Version:         1.0.0
Toolsets:              Requires Unity >= 2019.3.4f1

Quickstart guide

The UnityudSDK sample requires a valid license for Euclideon Vault SDK, trial licenses can be obtained here The VDK is tested with Unity 2019.3.4f1 - it may work in other versions of Unity, but we can’t guarentee that it does. Please sneure you have Unity 2019.3.4f1 installed.

Installation - New or Existing Project

The fastest way to install VDK for Unity is to go here and follow the onscreen instructions.

Installation - Github Samples

  1. Download and extract the latest udSDK package from here using your license credentials (if you do not have one, free trials are available from here )
  2. Clone or Download the Unity udSDK examples from here
  3. Copy the files from Euclideon_udsdkXX/lib/(your operating system here)/ to your Unity project working directory
  4. Open the udSDK Unity example project by navigating to _vaultsdksamples/integrations/unity-csharp/Assets/Scenes and opening Basic Render
  5. From the Toolbar, Navigate to VDK > Set User Info - and enter your VaultSDK username/password, then press Save User Info.

VaultSDK with Unity is now ready to go! Press play!

Changing UDS model

The UDS can be changed by modifying the path attribute of the Model object in the project hierarchy (by default on the left of the screen) using the inspector (by default on the right)

There is a UDS model included with this example for demonstration purposes, paths to your own model can be pasted into the path field of the US model object UDS file format developed by Euclideon allowing streamable, unlimited sized 3D datasets requiring only low spec hardware.

Models can be created from most common photogrammetry and LiDAR point clouds file formats using Euclideon udStream available Here your vault SDK trial license also gives you access to vault client during your trial period. You can read about the conversion process here if you have any questions check the support knowledge base or on the

Photogrammetry model of the Gold Coast courtesy of Aerometrex

Sample Scenes

Each included example is accompanied by a scene demonstrating the use of the objects. The best way to become farmiliar with these unity objects is to explore their usage in those scenes. Currently there are four sample scenes

  • Basic Render - showing importing a UDS and usage of the picking system (extraction of voxel data from the point cloud given a coordinate in screen space)
  • Driving demo -Showing the usage of the VDK collider object to make local mesh colliders for physics simulation
  • Filter Demo - demonstrating the use of a query filter to selectively render volumes of the point cloud
  • Raycasting Example - Showing usage of the VDK Collider to estimate surfaces in front of the camera for raycasting.

Examples of use of the API features are located under Assets/Plugins/EuclideonUdSDK/Scenes

Basic Example

This is an example demonstrating how to use udSDK with Unity, it includes a minimalist example of a flight camera and an attached collider. Unlimited detail rendering is implemented as a postprocessing effect that can be applied to cameras in order to display UDS objects.

Sample Scene Structure

The Structure of the basic sample scene

Main Camera

The main view used in the example. It has a flight camera script attached to it to enable user interation. Of importance to this object is the implemented post process layer and volume properties which must be included for the camera to view UDS files.

Sample UDS camera Settings

Various settings can be passed to the renderer including the point rendering mode (rectangle, cube or point), the desired resolution scaling and example interfaces for picking of voxels

UDS Model

Each of UDS to be loaded in unity is represented as a one of these models.

vdkLogin

This file contains the login logic for the unity example, including login credentials. GlobalVDKContext contains a vdkContext for managing licensing and login information between objects, and a vdkRenderContext, enabling the rendering of and caching the UDS model information

VDKPPER

VDKPPES.cs contains the implemention of udSDK in Unity as a post processing effect. The associated shader is vdkShader.shader

VDK Collider

This object demonstrates how to achieve physical collisions between Euclideon UDS models and native Unity colliders. Because of the potential scale of UDS objects it is not practical to construct mesh colliders of UDS objects (espeially if these objects are being streamed externally) The approach taken is to construct a mesh of the UDS object local to a point of interest (for example a player or the potential colliding object using information available from an instance of vdkRenderView.

Because the information contained in UDS files (especially unfiltered point clouds) can be noisy, we have included functionality to smooth the generated surfaces.

VDKCollider.cs contains the majority of the logic associated with the example collider system.

Collider Object Structure

Because Unity does not allow collisions between a parent and child object, the collider cannot be a direct decendent of an object it is intended to collide with. Instead use the follow target parameter to keep the collider within an objects reference frame

The VDK Colider Script takes the following parameters:

Follow Target: If not none will set the transformation of the collider to match that of the target, useful for meshing locally around particular objects.

Threshold Follow: Determines the rate at which the location of the collider is updated, if true the location of the collider is updated only when the object is Follow Threshold distance from the watcher position

Watcher Pos: The location of the virtual camera in the local frame used to generate the collision mesh. Currently this should be set to 0.5*(ZNear-Zfar) in the direction the cameara is intended to look, this is to prevent unwanted clipping

width, height: the dimensions of the polygon ‘sheet’ draped over the UDS model in metres, smaller colliders will have a higher polygon density and therefore better collision accuracy at lower computational cost

Z Near, Z far: the locations of the near and far plane along the local z axis for the ‘watcher’ camera used to generate the collision polygon.

Width Pix, Height Pix: The number of pixels used to find the position of the vertices in the sheet. Currently this is equal to the number of vertices in the collision mesh. Smoother results may be obtained in future versions by oversampling around the vertex locations and averaging to eliminate noise. These values have a large impact on frame rate and should be kept as low as possible. Increasing these improves the accuracy of the produced collision mesh.

Laplacian Smoothing: This determines if smoothing should be applied to the collider, this has the effect of removing noise from laser scans at the cost of potentially removing ‘sharp’ features from the collision mesh.

Smoothing off (note the rougher ground surface due to sensor noise): UnSmoothed

Smoothing on (note that tree branches are no longer captured by the collision model): Smoothed

As the attached mesh is modified often by this script, baking options for the mesh collider should be turned off for performance reasons

Android Support

The provided scenes have been tested on Android: Compiling to Android involves the following:

  • Copy libvaultSDK.so from “[udSDK Location]\lib\android_arm64\libvaultSDK.so” (or android X64 depending on your target platform) to Assets/Plugins/EuclideonUdSDK
  • Select the newly added file from the Unity project pane and in the inspector under platform settings select your target platform and check the box “load on startup”
  • In File -> Build Settings ensure that the Menu 3d Scene is loaded first, then the forst scene in your application
  • In the bottom left of this window click player settings -> Sndroid settings, set the scripting backend to IL2CPP and the target architecture to ARM64 (or X64 if you are using that platform)
Show all projects by Euclideon