How to Display Soil Dust in Unity

Soil Dust events, dynamically simulated in Vortex Studio, can be used to render dust particles in Unity during simulation. When the Soil Dust instance is loaded, a Soil Dust prefab is loaded from an asset bundle file located in the same directory as the Vortex file that contains the Soil Dust.

Manually creating prefabs and Asset Bundles

To manually create assets for the Soil Dust, a Unity project with the Vortex Integration Package is needed (such as VortexUnityTools or your own project), some Soil Dust prefabs must be added and the assets must be packaged in asset bundles.

For an overview of the assets workflow, refer to Workflow for Preparing and Using Assets for a Vortex Simulation with Unity Graphics.

Soil Dust Prefabs

At simulation time, when a Soil Dust instance is added, the Vortex Integration will look for a Soil Dust prefab with a specific name. The prefab name must contain the Graphics' Soil Dust hierarchy with the Graphics' Soil Dust name from the Vortex Editor explorer without the parent element that is contained in a Vortex file. The hierarchy levels are separated with period characters. Folders are omitted from the hierarchy. The name and hierarchy are case sensitive.

For example, for the following hierarchy, the prefab name would be Soil Dust.Graphics.

Creating a Soil Dust Prefab

The Soil Dust prefab must have a Vortex Soil Dust component. 

  1. Create an empty GameObject
    image2021-2-16_9-47-6.png
  2. Rename it with the proper name (see the Soil Dust Prefabs section introduction)


  3. Select the created GameObject and add the VortexSoilDust components in the inspector

  4. Duplicate the Packages/Vortex Studio Unity Integration/Runtime/Resources/Effects/defaultSoilDustEffect visual effect graph asset in your project by drag and dropping the file in another folder
  5. Rename the copied defaultSoilDustEffect file, ex: SoilDustEffect
  6. Assign the copied visual effect file to the Effect Asset field in the Vortex Soil Dust component properties


  7. Assign a texture to the Particles Texture field

  8. Drag and drop the GameObject somewhere in the asset bundle folder in the project pane to create the prefab

In the following section, we present in greater detail the required components for a Soil Dust prefab.

The VortexSoilDust Component

The VortexSoilDust component is in charge of managing the Soil Dust events and to spawn dust particles.

These public fields can be configured through the inspector:

Field

Description

Particles TextureThe texture applied to the particles
Emission RateParticles emission multiplier 
Particles LifetimeThe particles life span
Spray Cone AngleDetermines the maximum offset angles a particle can take when it is spawn with a certain initial direction
Spray Linear Speed RangeDetermines the range of linear speeds the particles can travel 
Gravity ForceForce applied to the particles
Drag CoefficientDrag forces apply to the particle so it resists all other forces (air resistance)
Color Over LifeParticles color and transparency over lifetime
Size RangeThe size range for the particles

The defaultSoilDustEffect Visual Effect

The particles are simulated and drawn with a Visual Effect Graph asset. For distributed simulation, it is important to make sure that the spawned dust particles will have the same state on all renderers. Random number generators should be avoided when modifying the defaultSoilDustEffect Visual Effect to make sure the effect will be consistent on the different screens. 

Creating an Asset Bundle

Once the Soil Dust prefabs are created, they can be packaged in asset bundles so that they can be loaded by VortexUnityApp, or your own similar Unity application with Vortex Integration.

The process for generating an asset bundle is described in this section. In short, you can use the Export Asset Bundle... command from the context menu when selecting the folder containing the prefab's assets.

Then, select the file's destination and name to create the file.

In order to get VortexUnityApp to load the asset bundles properly, the asset bundles files should be placed in the same folders where are stored the Vortex file that contains the Soil Dust.