Integrating Unity as Graphics Renderer in a Vortex distributed simulator - com.cmlabs.vortex.integration
 The main goal of the Vortex integration with Unity as Graphics Renderer is to benefit from the Unity Graphics Rendering capabilities, while still allowing to run Vortex simulations on a distributed simulator..
Here's a short overview of how it works:
In a Vortex simulator, each graphics slave node must run a Unity application which can load Vortex content (i.e. Graphics Galleries, Mechanisms, Assemblies, Scenes). VortexUnityApp is the default application to do this, but you can also create your own.
When this application loads any Vortex document in the simulator, it will also load a Unity Asset Bundle of the same name, and instantiate a Game Object matching a Vortex graphics object.
A Vortex setup file must be adapted to allow using a Vortex-Unity application as an executable on a graphics slave node in a distributed simulator.Â
Vortex Integration Package for Unity
A Unity package for Vortex was made which can be included in your own custom Unity project. These are its main features:
Includes Vortex-specific components for common asset types such as cables.
Easily package assets into asset bundles to be used during simulation.
Test these assets directly in the Unity Editor by loading Vortex documents.
Build a Unity application which can be used on graphics nodes of a distributed simulator.Â
To install this package, refer to:Â Installing the Vortex Studio Package in a Unity Project
Opening the demo project from Vortex Demo Scenes in Unity Editor
The sample consists of the Vortex Excavator that can dig in a Unity terrain. It is based on the Excavator.vxscene that can be loaded in the Vortex Editor.
Follow the instruction in https://cm-labs.atlassian.net/wiki/spaces/VSD2407/pages/776510172/Vortex+Studio+Demo+Scene+package#How-to-use-the-Unity-demo-projects to open up the Integration Demo Project.
This integration uses a non-standard Unity workflow. All Unity prefab assets are packaged in Asset Bundles, that are loaded at runtime. The project has been used to generate the Asset Bundles that are already present alongside the Vortex documents.
Scenes/SampleScene.unity
This scene contains all the prefabs that were packaged into the different Asset Bundles.
Scenes/Empty.unity
Using this scene, you can test the Asset Bundle integration
Select File, Open Scene, and select Scenes\Empty
Hit the Play button
In the Vortex Studio Player window, click on Add Assets..
Navigate to and select the Excavator.vxscene in Demo Scene that is located at C:\CM Labs\Vortex Studio Content 2023.10\Demo Scenes\assets\Scenario\Excavator Scene
Double click on the Excavator.vxscene to load it and the prefabs coming from Asset Bundles will populate the scene
Â
You can now press the red Simulate button on the Vortex Studio Player window and you can operate the Excavator.
Â
Don’t forget to first turn on the engine using the Operator Controls tab on the Vortex Studio Player window.
Explore the Asset/VortexAssetBundles folder to see all the prefabs.
Managing Assets
To benefit from Unity graphics in a Vortex simulator, Unity assets must be made. There must be a correspondence between Vortex documents and Unity Asset Bundles, as well as between Vortex graphics extensions and Game Objects.
To get started, refer to:Â How to associate Vortex Objects with Unity prefabs
Preparing a Vortex Distributed Simulator with Unity Graphics
To use your assets in a distributed simulation launched via the Vortex Director, some specific changes must be made inside your Vortex setup document.
Read a step-by-step guide here:Â How to set up a Vortex Distributed Simulator for Unity
Debugging the simulatorÂ
The same tools for debugging can be used on a distributed simulator with Unity rendering.
The Remote Debugger can be set up to inspect the internal state of the simulation (contacts, collision geometries, etc.) See Vortex Studio Debugger.
For profiling the simulation, you can add the Profiler Page extension to you setup file. Please see The Profiler Tab and Measuring Performance Using the Content Debugger and Profiler