Integration Description
We have created a custom Unity Package that allows you to easily import your volumetric videos into Unity to be played back in your projects.
The package can be download here: https://spatialscan3d.com/wp-content/downloads/plugins/legacy_Unity-Playback_v1.14.0.unitypackage
How to Use
- Download the package from https://spatialscan3d.com/downloads/plugins/legacy_Unity-Playback_v1.14.0.unitypackage
- Either create a new project or update your existing project to a unity version of at least 2021.1.16f1. (Older versions might work, but also might not, your mileage may wary)
- If creating a new project, make sure it is using the Universal Render Pipeline (URP), or if you already have a project and it isn’t using URP, upgrade your project to use URP (you can find how to through google).
- After opening your unity project, in the topbar, choose Assets -> Import Package -> Custom Package and in the opened dialog choose the downloaded package file.
- You should now have a folder called EVE.Sequence_Playback in your assets folder.
- To start with, experiment with the Example Scene provided with the package by opening EVE.Sequence_Playback->Example Scene->Scenes->Main.unity in your unity’s project files window.
- In the Hierarchy navigate to the Sequence Loader gameobject.
- In the Inspector you should now see a script called Sequence Loader
With it you can load volumetric videos into your project, with a couple of steps that you need to do:- Decide if you wish to load the video into RAM or into the disk memory. If you wish to use RAM, then enable the Use Buffer toggle (For now this only works when loading meshes in .obj files. Alternatively keep the toggle off.
- Next click the Select Sequence Folder button and select the folder that contains your .obj or .ply files.
- Now click Generate Frames and wait for the code to process and import your volumetric video.
- Decide if you wish to load the video into RAM or into the disk memory. If you wish to use RAM, then enable the Use Buffer toggle (For now this only works when loading meshes in .obj files. Alternatively keep the toggle off.
- Now you should have imported a volumetric video into your project. It is either all loaded into your scene, therefor taking up space in RAM, or it is all saved in a new folder within the [Streaming Assets->PreLoaded Data] directory. The video can be found as a new child object of the Sequence Loader.
- To Control the playback of your video you need to select the newly created object and use the Sequence script attached to it.
- You can change the playback framerate here:
- Loop Type determines the functionality when the playback reaches it’s end. Once means that it will stop when the end is reach. Loop means it will repeat from frame 0 when the end is reached. Ping Pong means that when the playback reaches the end it will start playing backwards until it reaches the start again when it will flip again to play forwards.
- By changing the Renderer object you can change which Renderer controls the visual display of this specific volumetric video.
- You can use the buttons at the bottom to control the playback of the video. Their names are self-explanatory.
- You can also control the playback of the Sequence script through code, with functions such as Play() Stop() Pause() and so on. The code is open source so you can easily see which functions you should call from within the script.
- You can change the playback framerate here:
- To control the visual side of your videos you’ll need to use the Renderer. In the example scene in the Hierarchy you can find the Default Renderer object that has a Renderer script attached to it.
- The Renderer is responsible for controlling the display of both pointcloud videos and mesh videos at the same time.
- You can use the buttons at the top to switch between 4 different presets for mesh materials, which also account for whether or not you’re using meshes that are using vertex colors or meshes that have textures.
- This Unity package comes with 8 different vfx graphs, which you can use from the get go by changing the Current Vfx value to represent the index of the vfx that you wish to use from the Vfx Filter list. Or you can change an existing vfx graph or create a new one and add it to the list here. Keep in mind that if you’re changing the vfx graph at index 0 it will not work because index 0 is used for all the variations of the simple point cloud point display, which itself has 8 variations based on how many points your pointcloud has (this is done for optimization purposes).
- In the Hierarchy navigate to the Sequence Loader gameobject.