Integrating Unity terrains with Vortex

In the Vortex Unity integration, Vortex assemblies and mechanisms can now interact directly with Unity terrains and Unity static colliders.

Vortex Terrain component

In order to integrate a Unity terrain with a Vortex simulation, a Vortex Terrain component must be manually added to every required Unity terrain. Adding the component signals Vortex that the Unity terrain must be considered for collision detection. Without it, a Vortex mechanism will fall through the terrain.

Vortex Terrain component

Vortex contact material mapping

Unity terrains may contain various Terrain layers, used to define the Terrain’s surface qualities (such as a Texture) which in turn are used to render the Terrain surfaces. Each Terrain layer found in the Terrain GameObject will be listed in the Vortex Terrain component.

Unity Terrain Layers

If a Unity scene is associated with a Vortex scene containing a Material Table, each Terrain layer listed in the Vortex Terrain component has an associated Vortex Contact Material drop-down menu. When expanded, the Vortex Material Table content will be listed. Each point of interest on the Terrain will be associated with a Vortex Material based on its dominant Terrain Layer.

Vortex Terrain material dropdown

If there are no associated Vortex scenes, or if the Vortex scene doesn’t contain a Material Table, the drop-down menu will be greyed out. The Terrain will fallback to use a default material for the entire terrain. A warning will also be displayed in the Console window of the Unity Editor.

Unity Editor empty table warning

Static colliders

In Unity, a static collider is a GameObject that has a Collider but no Rigidbody. The Vortex Unity integration will automatically detect the supported static colliders and send relevant information during simulation. In order for the collider to be considered in the Vortex simulation, the collider cannot be a trigger collider.

 

Box

Sphere

Capsule

Mesh

Convex mesh

Wheel

 

Box

Sphere

Capsule

Mesh

Convex mesh

Wheel

Supported Collider

Unity colliders can have a Physic Material assigned to the Material field.

Collider with PhysicMaterial assigned

These Physic Materials can be associated to Vortex materials by modifying the mapping found in the Vortex Material Table GameObject. The list of Physic Materials will automatically be populated with materials located in the project. If no material is assigned to a collider, the default material will be used.

Vortex Material Table mapping

Note: Unity Terrain trees and detail objects are ignored for collisions; they are only for decorations. If trees are needed for collision, they should be added individually as GameObjects in the scene.

Simulation performance tuning

There are two Unity Terrain Settings on the Terrain’s GameObject that have a great impact on the Terrain’s Compute time: Heightmap Resolution and Control Texture Resolution.

Unity Terrain resolution settings

The Heightmap Resolution defines the pixel resolution of the Terrain’s heightmap. The values stored in the heightmap define the height of each point on the Terrain. The greater the value, the more the Terrain’s surface will be refined, and by extension the more compute and memory expensive it will be for Vortex.

The Control Texture Resolution controls the blending resolution of the different Terrain Textures. The higher the resolution, the more precise the material mapping will be when determining the Vortex Contact Materials.

These resolutions are relative to the Terrain’s Width and Length values. For example, a 1024x1024 Terrain with a Heightmap Resolution of 1025x1025 will have a cell size of 1 meters. Increasing the Heightmap Resolution to 2049x2049 decreases the cell size to 0.5 meters.

Note: We recommend limiting the cell size to no less than 0.5 meters. Exceeding this resolution may lead to performance degradation.

Limitations

Unity VortexTerrain support is still early in development and some limitations exists:

  • Only one Vortex Terrain component is supported per Unity scene.

  • When using Unity Terrains, only one VortexMechanism is supported per Unity scene. Adding more mechanisms will lead to serious performance degradation.

  • The Unity Terrains must be rigid; the Unity Terrain’s data can’t be modified at playtime. Doing so will lead to undefined behaviour.

  • Unity Terrain trees and detail objects are ignored for collisions; they are only for decorations.