MegaFlow - Vector Fields & Fluid Flows [Released]


What is MegaFlow
Have you ever wanted to simulate a wind tunnel in your game, or have leaves of snow blow through your village flowing naturally around buildings, speeding up down alley ways or settling slowly in the lee of an obstacle, Lava flowing down a volcano side or Waterfalls cascading over rocks, Or a car stirring up leaves as it drives along a road in Autumn, vortices for your plane wings, perhaps an object floating along fast moving water, tornadoes, or even simulate gravity around objects in space, if so then MegaFlow can help.

MegaFlow is a set of systems that allow you to use Vector Fields to control the movement of objects or particle systems in Unity. Vector fields are a 2D or 3D grids of values that describe the direction and magnitude of velocities for that point in space. The Vector Field can be generated by systems such as Maya Fluids, FumeFX, Krakatoa, etc. MegaFlow can import the files generated by those systems in the form of .FXD or .FXA files, it also has an exporter for Maya that will export any Maya fluid simulation to the MegaFlow .FLW format. You can then import a single frame or multiple frames into the MegaFlow system in Unity and then use that to control the movement of particles from either the Shuriken or Legacy particle system, or control movement of Rigid Bodies or just general objects. Don’t worry though if you don’t have access to any Fluid Simulation software as MegaFlow also comes with a system that allows you to author your own Vector Fields inside Unity using multiple splines to define flow directions and forces.

The movement of objects interacting with the Vector Fields is via a simple physics simulation which has parameters that allow you to control the overall force the field applies and the mass of the objects that are interacting with it, this means you can adjust the look and feel of the flow from either a very tight following of the flow to a subtle influencing only of objects that move through the field. You can change the force the field exerts or reverse the flow direction. All the values can be adjusted at runtime via script of the Unity animation system if required.The physics code used is optimized for performance and makes use of multi threading on any system that has multiple cores for super fast performance even with 10’s of thousands of particles being moved.

If a system such as FumeFX or Maya fluids has been used to create the Vector Fields then that would allow you to place obstacles into the flow, if the flow is then used to control a Particle system you can get even more performance back by disabling the collision system in the Particle system, since the Vector Field will now handle moving the particles around objects in the way, this can get you quite a saving in CPU time in complex scenes. You can off course still use the collision system of the particles or rigid bodies alongside the flow system if you wish.

The Vector Field source can have any number of Vector Fields loaded so you can do animation of flows if required, or just easily swap the flow field being used to change the look and flow of your scene. You can ask the system to show you the flow through the system of objects via the visualization options, or display the flow as either vector lines or colored cells.



Included in MegaFlow are various components to help you use the Vector Fields in your projects. There are components to control the Unity particle systems as well as a component you can attach to any rigid body object that will then allow that object to be influenced by the Vector Field. There is also an example Smoke Gun script that will inject large numbers of objects into a scene so you can see how they flow.

To find our more about the system as well as the complete docs on the various parts of the system please visit our website. MegaFlow Ā« MegaFiers

Features

  • Support for FumeFX FXD file import
  • Support for FGA file import
  • Custom Maya Fluids Exporter
  • Create Vector Fields in Unity
  • Multi-Threaded physics
  • Highly optimized physics code
  • C# Source Code Included
  • Multiple frames of flow data per source
  • Control Legacy or Shuriken particles
  • Control Rigid Bodies
  • Control Normal Objects
  • Works in Unity Free
  • Works on Mobile devices
  • Flow visualization
  • Create a 3d Texture from the flow
  • MegaShapes Lite included

Available Now

MegaFlow is available no on the Asset Store or on our Website for the special early adopter price of $50, as with all our assets we will be adding new features over the coming months so if you have anything you would like to see please let us know.

Video Examples
Below are some videos showing the MegaFlow system being used in a couple of scenarios, the first uses a Maya Fluid simulation to simulate the airflow around objects in a scene, the second shows the in Unity creation of Vector Fields from splines and that then being used to control a particle system. The third shows a Vector Field being created inside Unity using splines to define flows.

NB: Moving sources is not included yet will be in the next update which will also see a price rise

4 Likes

Wow this looks really great. You never fail to impress!

look awesome

Thanks :slight_smile: Just done a quick update to the system to add some more features. You can now use your own color gradients to define the colors to use to represent velocity. Also added flow arrows to the Create Flow from spline system to better visualize the flow as you create it, and also added a new page to the docs on the site outlining the FLW file format in case you need to get your own custom flow field data imported into the system.

Also forgot to add a video showing the ā€˜SmokeGun’ system being used to fire hundreds of mesh objects into a flow scene.

Changes in v1.01

  • Added flow arrows to the Create From Spline gizmos to show the flow direction and force for that spline.
  • Added option to ring display to adjust alpha value.
  • Splines remain visible when Create Flow object selected.
  • Option to have Create flow gizmo always on.
  • Added option to show color of velocity vectors based on either direction or magnitude
  • Added editable color gradient for showing velocity magnitude
  • Added option to show color of the grid cells based on either direction or magnitude
  • Added FLW file format page to website
  • Added gradient color option to create flow from splines system.

As always absolut incredible!!!

Doubt I shall resist buying this for more than a few more hours.

Any idea if it seems to work ok with the current Unity 5 beta?

There are some bugs still in the conversion process it seems in Unity 5.0, if you import the asset into Unity 5.0 Beta 11 the scripts seemed to get detached from the objects, but if you create objects from scratch everything seems to work fine. I can’t test for long though for my Unity 5 just keeps freezing up for several seconds even with empty projects making it virtually impossible to use.

This looks megacool

1 Like

Here my first impressions from MegaFlow: MegaCool!
A long dream working with flowfields in Unity comes true.
I had only some workflow suggestions:
When i want to create a flowfield from splines it would be great to have some sort of preview of the flowfield. Right now i change my splines and hit ā€œCreate Flowā€, then i have to switch to the MegaFlow source and select the new frame to see the flowfield. If it doesn’t fit my need i have to delete the frame and go back to the Create Flow component. So what about a preview button on the Create Flow component and a second button to add the flowfield to the MegaFlow source explicit? So you can only add the flowfield if you like.
It also would be a timesaver to have some sort of manager component to handle a bunch of gameobjects that should be moved by a flowfield. Right now i have to add to every single gameobject a special component and make my changes on every instance.

Looks brilliant, and I think I’m going to be purchasing MegaFlow on the strength of the videos (and previous experience with MegaShapes). I’ve been working on a glider prototype using UnityFS, and have already set up a fairly crude trigger-based approach to wind volumes. It appears I could use MegaFlow instead, and get better results by laying splines around my terrain. However, it would be nice for different aerodynamic setups to be affected by the flow field differently- I could probably adjust the force effect on the rigidbody from my interpretation of the video, but was wondering if there could be an opportunity for the two systems to speak to each other in a more integrated way?

Firstly just submitted a small update to the Asset Store, fixes some exception errors if you delete all frame data from a flow source and then try and use that source to control something. Also fixed a mismatch in the coloring of Velocity data between the vector lines and the cell coloring.

@sloopidoopi - I will be adding more visualization options to the create from spline system, we did add flow arrows in the previous update so will likely add more options like that, it can’t really show the exact flow as that can be quite a time intensive process to calculate but will see what can be done, possibly a reduced grid option could work.

I will be adding an improved system for controlling options, allowing you to define the objects to use and settings and then those will be created for you such as in the SmokeGun system. The controller scripts currently included ie particle, rigid body etc are ones we have been using in our projects but fully understand that other users will require different systems so just let us know and we will do our best to get them added.

@Karearea - There should be no reason at all that MegaFlow could not be used alongside UnityFS, it would a simple case of finding the velocity value for the position and then computing a force from that and feeding that into the flight sim model, pretty much as you would for any global wind speed and direction that the sim already uses, you just replace those values per frame based on the glider position.

Changes in v1.02

  • Fixed an exception if particle system was trying to use a flow source with no frame data.
  • Fixed an exception if rigid body controller was trying to use a flow source with no frame data.
  • Fixed an exception if effect controller was trying to use a flow source with no frame data.
  • Removed some old code.
  • Fixed a mismatch between cell and vector colors when showing magnitudes.

Thanks- Have bought the asset and tried an initial test with a flow field around my terrain. At this point I have been attempting to use the Mega Flow RBody component, so both UnityFS and Megaflow are applying forces to the rigidbody, but I suspect that my aircraft are simply to high in mass to be affected as I’d like them. Furthermore, I’d been previously translating the aircraft per second when in wind triggers, rather than applying a force to it, as I was thinking in terms of wind as a moving reference frame and therefore not affecting the rigid body with forces per se.

As you suggested above, I’d be better off simply sampling the flow at the current position, and then feeding that into my system. Is there a simple way to get the sampled velocity value as a vector3 every frame? I’m no coder so I’ve been wiring the assets I’ve been using together with simple Playmaker FSMs, although I have a working system already to adjust the aircraft with vector3s- this would simply be a far more elegant way of sampling them.

As I’m using Playmaker, a component that measured the vector3 at the location of a game object, for a selected source, and printed that as a public vector3 variable would be my ideal feature, as I can then use the get property action in Playmaker to interpret it.

Cheers,

Nick

1 Like

I will add some API calls like that for you, just using the system myself in a project and am finding more things that need to be added so expect more features and updates soon.

Thanks! appreciate you help. Really enjoying using MegaFlow so far, it certainly meets the same high standards I’ve enjoyed with your other assets.

One final request would be a trigger system (which I can probably do in Playmaker for the meantime), whereby as the glider flies into the next flowfield, it automatically switches to that source as the sample.

Cheers,

Nick

New version in the AssetStore, this adds a preview mode to the Create Flow system so you can visualize the created flow before adding it to the flow source, it has all the same visualization features as the flow display. Also each frame can have an offset value which is useful if you are using multiple frames of flow data all of different sizes, you can position each frame independently now. Also added a ā€˜Normalize’ flow button, this will normalize the flow data so you can then control the overall force using the Scale value, again useful if you are linking the flow to a moving object, say a car, if you use a normalized field then you can adjust the Scale value to fit the speed of the car. Also fixed an issue in the generate Texture3D option with negative values not mapping correctly and finally started an API section on the MegaFlow help page outlining some methods to get the access to the flow data directly, will be adding more to this section soon.

Changes in v1.04

  • Each frame can now have an offset value, useful if using multiple frames of different sizes.
  • Added option to the inspector normalize the flow frame data.
  • Added a preview option for the Create Flow system, so you can quickly see the current flow without having to send it to the flow source.
  • Fixed issue in Texture3D builder with negative values.
  • Added API section to MegaFlow docs, GetGridVelWorld, SetFrame, SetMatrix, GetCol methods.

I’m interested but would like some ideas on practical use/performance. Could these be used to control small particle systems that get toggled on and off quickly/frequently, like for different spells a character might cast (without controlling a whole environment)? Could you run multiple such instances at once?

MegaFlow could certainly control any size particle system, world size or for doing small effects around say a fire, and would be fine for controlling particles around a player. You can have any number of flow sources in the scene, they use no CPU unless they are controlling something. As for performance actually moving a single particle on my machine takes 0.0004ms so that would mean a system with 2500 particles would take 1ms, and you can nearly halve that if you turn threading on. Plus in the smoke and rocket scene the scene ran faster using the flow field as I could turn of collisions on the particles.

That sounds good, I will probably pick this up then.

One other question that came to me just now. Is it possible to introduce a degree of randomness somehow, for example if we’re using this to simulate wind, wind can very in direction and intensity somewhat.

We will be adding new controllers to the system with various options, some randomness would be something we can do. We could have an uber controller with loads of features but trying to keep the particle controllers as streamlined as possible.

Fixed an issue with the previews not being saved with the scene and causing an error message when scene loaded again.