The New Playground

30 January 2015
4608 Views

After three months in production Particle Playground got an action packed update. There was a lot of pressure this round from enthusiastic users that some missing key features were to be addressed, I couldn’t get all of them in but 29 of them did! The 2.2 release is the biggest update yet since the framework was introduced and it was a really intense production sprint, luckily the beta went well and deadlines were kept with a couple of hours in spare. The key parts to the 2.2 update is creative flexibility with more Source- and Manipulator features, performance improvements and the finally arrived Prewarming, Time Scale and Spherical Velocity and Scatter.

These type of releases is a bit intimidating, there’s many pieces that has to be put into place. The most important thing is of course that the framework itself is ready and tested in different environments, but also the manual must be up-to-date as well as the script reference. In correlation the video needs to be edited before release day and some kind of promo idea should be ready. That last part has always been a bit tricky for me to get in place. I contacted the amazing people at the Unity Asset Store giving them a heads up with a couple of days notice, and to my big relief they gave Playground a lift to the front-page of the store (humble thanks guys!).

After a bigger release there’s always some issues that wasn’t possible to find for us in the beta due to all the infinite possibilities of project setups, so we’re actually at version 2.21 to date – sweeping a couple of smaller bugs under the carpet.

Enough about the production, here are some highlights from the 2.2 release:

Example Project

You’ll find an example project in the package which is the video shown above. In there you’ll find some good praxis approaches when working with particle systems in general, basically how to get things fly – and you’ll probably notice that there isn’t much to it but enabling and disabling effects in the order you want them. The moving camera is utilizing the new Playground Spline with a really easy script, basically you’ll get position in world space by calling:

spline.GetPoint(time)

Additionally you’ll find all effects in the video as prefabs under the Example Project folder.

Playground Splines

Introducing the Playground Spline component to create and edit splines in the scene. A particle system can emit from the spline, use it as an alternative to Lifetime Positioning and target it with a Spline Target Manipulator. A Playground Spline is not exclusive for particles, you can use it for any other component as well. When working with splines in the Scene View, Ctrl+Click to add a new node, Ctrl+Shift+Click to remove a node. To assign a Transform as a node, unfold the Nodes list in Inspector and toggle the Vector3 button.

Multiple Transforms as Source

Introducing the possibility to create source positions from a list of transforms. You can specify if the particle distribution should see the source as separate or conjoint transforms, this has effect on how particles birth positions are placed and noticeable when working with any method reading the particle array linearly (for instance Overflow Offset, Lifetime Sorting: Linear/Reversed, Particle Mask and Color Method: Particle Array).

 

Prewarming

A particle system can now prewarm its simulation upon creation (Advanced > On Enable > Prewarm). Use Prewarm Lifetime Cycles to determine where in its lifetime it should start and Prewarm Cycles to determine how many calculation steps should be used (higher means more accurate but will demand more CPU). Prewarming is multithreaded for performance.

New Target Manipulators

Introducing the State Target Manipulator and Spline Target Manipulator. The State Target will let you target pixels or vertices within the scene, the Spline Target can target positions on a spline with either the spline’s time or particles time as method.

Particle Time Scale

You can now set the simulation time seamlessly (Advanced > Time > Time Scale). This also lets you pause an effect by setting Time Scale to 0.

Reworked update routines and optimizations

Preparation, calculation and final particle output has been restructured. This was to create an overall smooth particle repositioning and give better time sync. Each particle also has an individual calculation check to not interfere with final output when Sync Particle To Main-Thread is enabled. Previously you may have experienced jaggy movement especially on heavier scene setups. Also, an improvement to certain routines such as distance checks makes parts of the particle calculation loop faster to execute (such as collisions and all Manipulators).

 

 

 

What you’ll find furthermore is the possibility to automatically cull calculation (enabling/disabling particle systems) using the improved Auto-Pause Calculation found in Advanced > Out Of View. This lets you trigger particle systems whenever the trigger position is within the frustum of the Main Camera.

Texture Sheet Animation

Texture Sheet Animation (for particle UVs) is now implemented directly into the Particle Playground Inspector. The layout is similar to the Texture Sheet Animation-module on the Shuriken component, please refer to the Shuriken manual for more details.

 

 

Minimum to maximum spherical velocity and scatter shape

A new method to calculate minimum to maximum random Vector3 values is introduced where you can choose between Rectangular (behaves as previously), Rectangular Linear, Spherical, Spherical Linear. This can be applied to the Initial Velocity and Source Scatter values to get a spherical emission/position shape instead of a quadratic. Using any linear method means the distribution will take the array of particles into calculation.

The Range determines the size of the sphere in minimum to maximum random value. When applied to Source Scatter the Range of 0-0 means no scattering, 0-1 means random within one unit from source position, where for instance 1-2 creates a random shell one unit thick.
When applied to a force, the Range will amplify the force within a minimum to maximum random spherical direction.

Color Method

The Color Method lets you determine how particles get their gradient colors distributed. Using Lifetime will apply the gradient over a particle’s lifetime (as previously). Using Particle Array will color the particles linearly using the array of particles as time for evaluating the color gradient, where leftmost color in gradient is the first particle and rightmost color is the last particle. This can be useful when working with any linearly positioned particles (using Playground Splines, Lifetime Positioning or Overflow Offset).

New Nearest Neighbor Origin methods

When using Lifetime Sorting: Nearest Neighbor/Reversed you can now specify the origin method by Source Point (as previous), Vector3 or Transform. Using a Vector3 or Transform will determine the sort origin from a point in world space. Using Source Point will determine the origin from a generated particle birth position in world space.

Hierarchy icon – an indicator

An icon in the Hierarchy is added to each Playground system. This serves as an indicator if the particle system isn’t currently calculated (for instance when out of view or when the simulation has expired) by turning beige. The icon will turn red to indicate that the calculation loop is reporting a slow iteration, this is a good way to detect which particle system is slowing down a scene.

More Emit() overload options

You can now call custom emission through script by these new overloads:



Emit (Vector3 givePosition); // Other values by Inspector

Emit (Vector3 givePosition, Vector3 giveVelocity); // Color by Inspector

Emit (float giveLifetime); // Set lifetime of particle, other values by Inspector
Emit (Vector3 givePosition, float giveLifetime); // Set lifetime of particle, other values by Inspector

Emit (Vector3 givePosition, Vector3 giveVelocity, float giveLifetime); // Set lifetime of particle, color by Inspector
Emit (Vector3 givePosition, Vector3 giveVelocity, float giveLifetime, Color32 giveColor);



Any emission call without the full declare of instructions will let the previously scripted value be in control (same as set in the Inspector by the Source tab). Setting independent lifetime of an emitted particle is also introduced.

Followers Example

I’ve been asked numerous times if it would be possible to let objects follow particles in an easy-to-setup configuration, and as Playground exposes nearly all caches and values for getting and setting – sky’s the limit. You’ll find an example scene called Follow Particle (Trail Renderers), where a couple of trail components will follow a Particle Playground system. The approach is multithreading friendly and will reuse your objects in a pool. The followers could be any type of object of your choosing, use the script PlaygroundFollow.cs found in Examples/Example Scripts/Simple Scripts/ to start following particles.

Now there’s a lot more, so please see the Version History document for the full list of features and fixes.

If you’re looking to publish your product to the Windows Store, keep an eye out on the soon available (not so dense) 2.22 update! In case you want to request any features or have any questions, make sure to drop by the Particle Playground user group.

Particle Playground can be found on the Unity Asset Store.

Lars-Erik Ronnheden – CEO Polyfied