WaveMaker creates a rectangular mesh that simulates waves to look like liquid. You can interact with it and it interacts with your rigidbodies. It is a normal mesh, you can make it look the way you like!.
Create small, medium or long surfaces like pools, portals, ponds, simple river shapes...
Generate waves reacting to selected colliders
Apply forces to selected rigidbodies to make them float and drift while generating waves due to volume occupation. Complex rigidbody with overlapped setups supported
Make the waves look like water, mud, cream and denser liquids at the resolution you want
React to static objects by painting the areas of the surface you want to be fixed
Works like any other mesh with your own material (hide parts with transparency, change look using shaders, use the API to generate your own effects. etc)
Key points compared to other similar assets ...
This is a mesh modifier, not a visual trick (2D shader with or without vertical offsets). Waves are more correct and it is actually simulated in 3D in the CPU, so devices with GPU support limitations are supported.
Your shaders don't need to be specific for this asset, if your shader works with a normal mesh, it will work with WaveMaker, so it supports the same rendering pipelines as your shader.
It is a two-way coupling system: Water moves objects, volume occupancy is calculated and objects generate waves at the same time. If you pay attention, most buoyancy systems can't do this, allowing for more interaction for your game.
You can use the API of the interactors and surface to gather simulation data and use it for your own purposes.
What this asset CAN'T do in the current version...
No breaking waves
Not suited for huge surfaces like oceans, complicated river shapes and waterfalls
It is not a water shader, it's a mesh modifier. No FXs are included. You must use your own shaders / materials and the API to gather and use the data provided
FXs like foam, splashes. But you can use the mesh data and the API to apply those by yourself.
Aerodynamics (effect of wind and such), shore and coastal effects
Different behaviour of the surface depending on water depth
MeshColliders cannot be interactors. Simple colliders should be used instead
Some of these features will be added in the future. Please, see the bugs and suggestions tracker to know what's coming up.
Current Features
Unity 2019, 2020, 2021 and all rendering pipelines support. (2018 still supported but needs manual installation of required packages).
Heightfield-based realtime fluid simulation on CPU.
Mesh properties updated real-time to work with lighting
Scene hierarchy agnostic
Wave speed, damping and smoothing parameters. Substepping to avoid inestabilities
Simple interaction mode based on relative velocity for any shape or orientation of the surface
Advanced interaction mode based on occupancy of liquid volume for more advanced features on horizontal surfaces like Buoyancy and drifting (floating forces).
Arbitrary surface position and rotation, length and width
Areas can be fixed manually or automatically to ignore them and allow waves to "hit" on them
Timestep independent
Quality code, fully documented API and C# source included. Assemblies and namespaces used everywhere.
Heavily multithreaded code written with Jobs and Burst, with very small CPU cost
Idle/rest status of surfaces to reduce computation to a minimum
Many example scenes and create menu shortcuts included
How to install, docs, tutorials, live demos
Follow updates
To be notified on updates, please follow the asset on the unity assetstore, follow me on social media or my blog (twitter, linkedin, blog). For more frequent information, follow the official forum thread.
Change Log
Technical and Implementation Details
Jobs, Burst, Mathematics and Collections packages required. A detailed list in the Learning Portal
Quality code, full documented API to get gradients, heights, and some other data from the surface and interactors. More data will be available soon.
Full C# source included. Assemblies and namespaces used everywhere.
Heavily multithreaded code written with Jobs and Burst, with very small CPU cost.
Two-way coupling simulation: Waves affect objects and objects generate waves at the same time.
Mesh normals updated real-time to work with lighting
Possibility to enable substepping to avoid inestabilities
Arbitrary surface position and rotation, length and width. It works in local space
A file with the resolution and fixed cells is stored and can be shared between surfaces
Timestep independent
Fixed Update simulation time depends on type of interaction chosen. It can go from 0.01ms to 4ms in the worst case scenario (many floating objects occupying the whole surface). Generally it stays between 0.2 and 1ms.
Known Limitations
No breaking waves. (unless researchers or I come up with a good idea): This method is based on heighfields so that means there is only one height
per cell of surface. A breaking wave would have more than one height per cell.
Open borders are still not perfect. Even when you don't fix the borders of your surface, a percentage of the wave will be returned. I'm still working on it.
Mesh colliders are not supported. Since I have to create my own colliders for some operations, a mesh collider would be too slow for the current efficiency of the system.
Several surfaces can't be connected. The shape of the surface is rectangular and has a maximum resolution (56k vertices). This feature would allow us to be more creative but right now
the only way to approach this is to create a bigger surface, hide parts using your own transparent materials and fix cells that you don't want to simulate, making it more efficient.
In the velocity based interaction mode, small waves appear even when both interactors and surface are moving together: Relative movement between
a surface and an interactor is used to generate waves. Translating both toegether does not generate waves. However, if both are rotated together under
the same parent a little wave generation cannot be avoided. Sadly, this is due to the lack of precission of the calculation of the angular velocity for both objects.
A solution that would make this system less flexible would be to associate each interactor with each surface, and calculate the velocity of the interactor with
respect to the surface, but this will not be done unless you have a good reason to share with me.
Support and Contact
If you need help, or you are interested in some new feature that is not in the tracker, please contact me directly at unitysupport (at) lidia-martinez.com