Dynamic Water Physics 2 [Released]


Dynamic Water Physics 2 is a water-object interaction simulator that uses mesh data to simulate both buoyancy and hydrodynamics, making it suitable for objects of any shape or size, moving or stationary.
DWP2 is a complete rewrite from the previous version to make use of new Unity features and get even better performance.

MAIN FEATURES
• Fast and easy to setup - either manually or through one-click wizard.
• Simulate any object of any shape or size, as long as it has a mesh.
• Extremely well optimized. ~0.02ms CPU time on average per object in the demo scene, ~1.2ms total for 70 objects. (Wavy water performance depends on 3rd party asset used)
• Utilizes Burst-enabled Unity Jobs to make use of multiple CPU cores.
• WaterObjects are ribidbodies and interact with water only through use of forces. No translation or rotation applied.
• Uses in-built algorithm to generate a simplified simulation mesh meaning that high-poly models can be used without affecting performance.
• Suitable for both desktop and mobile.
• Works with any positive object scale.
• Works under water.
• Water effects work with any flat water and are auto-generated using simulation data.
• Included C# source code, manual and everything seen in the demo.

SHIP CONTROLLER
• Ship controller that can be used together with WaterObjects to make drivable boats and ships.
• Additional script for submarines.
• Multiple engines with sound, both inboard and outboard.
• Bow and stern thrusters.
• Multiple rudders.

SUPPORTED WATER ASSETS
Wavy:
• Crest (free)
• Ocean Community Next Gen (free)
• Lux Water
• SUIMONO Water System

Flat:
• All flat water assets (AQUAS, Stylized Water Shader, etc.)

More info:
YouTube Channel - Website

If you have any questions or need support contact us at nwhcoding@gmail.com.

DWP2 is not a water renderer / shader.
Dynamic Water Physics 2 is now available here.

9 Likes

Forum thread for Dynamic Water Physics 1 can be found here: Dynamic Water Physics | Physics | Unity Asset Store
Discussion for DWP2 has been moved to this thread to prevent confusion due to the assets being quite different.

1 Like

Does this work with animated objects, i. e. swimming animals?

1 Like

With animated objects your probably mean skinned mesh. The answer is both yes and no. Yes because if you bake the skinned mesh each frame and use the baked mesh data it would work (not currently implemented, but if you need it send me and email and I will send you the modified script as it is only a few lines of code). No because baking the mesh each frame is quite expensive and there is not much to be gained from it. I would suggest using an impostor - say one capsule for each limb - and using that. I do know that somebody used DWP1 in such way to make a corpse float. Also, making the animal swim would be possible but I would recommend simply adding a force to each limb on downstroke manually as it is easier to tune and only takes a handful lines of code. Since all FloatingObjects are using rigidbodies you can use all the rigidbody members on them. Hopefully this helps.

Thanks. I’ll just buy it and try it, asset looks awesome and useful either way. Btw your demo scene could use a ramp and a ring to jump through with the boat :smile:

Oh, but a ramp is in there - actually 2 or 3 of them and they are FloatingObjects too! But I am missing a ring I guess. Darn, I knew I must have missed something in all the testing I did.

1 Like

Ceto support on the way. Expect it tomorrow or so.

2 Likes

How do you properly set this up with Lux Water? I did the following:

  • open the scene DemoScene
  • replaced the water with OceanPlane_500x500_subdiv50 from Lux Water
  • set the tag of the ocen gameobject to “Water”
  • added the DWP_LUX symbol
  • hit play

The problem: I get 4 fps.

Edit: This is in the documentation:

NOTE: When using DWP2 with any non-flat water asset expect some overhead. If you need to simulate a large number of triangles, untick High Resolution Water Queries option on WaterObjectManager. This will reduce resolution somewhat but increase performance.

However, when I select High Resolution Water Queries in WaterObjectManager I get 60fps.

Also, is there any information about how I get foam and water ripples from the boat using Lux Water?

Hello,
I must say that it is quite curious that you get more FPS with the High Resolution Water Queries unticked as it should be exactly the opposite. In fact, high resolution queries are intended mostly for ship games as it is assumed that there will be only a few ships at max (high resolution queries have 3 times as much water height calls as the low resolution ones).

Foam and water ripples are entirely dependent on the water package itself. I must say I do not have experience with Lux past making it compatible with DWP but I would suggest checking their documentation first - it is quite good.

That’s what I thought, also maybe that it would be inverted? But it would be great if you could check that out, simply for performance reasons. I added the water and didn’t add anything else so far. I guess performance will drop a bit soon when I come with terrain and vegetation studio surroundings, enviro etc :smile:

Ah, I thought your asset would do some magic. So I can ignore the particles etc and stick with what Lux Water provides?

Btw, great asset, I’m having a lot of fun so far :slight_smile:

Yep, you can use anything that Lux provides as long as it does not mess with physics of the boat (so no buoyancy scripts and such). Everything else will work fine.

Got it, thank you! I do have a wish list if I may:

  • racer boat has no uvs, needs pbr to look good; ie a better boat might be beneficial. i know it’s not part of the asset itself. but your cars look awesome, so should the boat :smile:
  • boost button (eg shift) for the boat (arcade style)
  • a more detailed setup doc with lux water might be helpful for others

Otherwise it’s fun :slight_smile:

https://www.youtube.com/watch?v=wa6F2cYHW8I

1 Like

Hi, you have a typo…
“set up ‘BowThruster’ and ‘SternThurster’ axes under Edit > Project Settings > Input. Otherwise, ignore this message.”

Thanks for the spot. I would not want people strapping an axe to their thrusters, that is a no-no.

2 Likes

lol, indeed, Thurster axes even worse

Am not getting anything back from the getwaterheight query using dwp2 and suimono 2.1 ?
(water is tagged properly and defines set)

Interesting. Make sure that “Query Water Heights” inside Water Object Manager is ticked and that you are getting the “Using SUIMONO …” message in the console. If you defined SUIMONO but did not tag the water object properly it would have shown the warning so if you are not getting that is not the issue. Could be that I tested with pre 2.1 version - will have to check it out.

Re: DWP2 with suimono, have tried again using mac this time, get this:

ndexOutOfRangeException: Index was outside the bounds of the array.
DWP2.WaterObjectManager.FastCopy[T] (T[] source, Unity.Collections.NativeArray`1[T] destination) (at Assets/DWP2/Dynamic Water Physics 2/Scripts/WaterObject/WaterObjectManager.cs:537)
DWP2.WaterObjectManager.Initialize () (at Assets/DWP2/Dynamic Water Physics 2/Scripts/WaterObject/WaterObjectManager.cs:382)
DWP2.WaterObjectManager.OnEnable () (at Assets/DWP2/Dynamic Water Physics 2/Scripts/WaterObject/WaterObjectManager.cs:238)
IndexOutOfRangeException: Index was outside the bounds of the array.
DWP2.WaterObjectManager.FastCopy[T] (T[] source, Unity.Collections.NativeArray`1[T] destination) (at Assets/DWP2/Dynamic Water Physics 2/Scripts/WaterObject/WaterObjectManager.cs:537)
DWP2.WaterObjectManager.Initialize () (at Assets/DWP2/Dynamic Water Physics 2/Scripts/WaterObject/WaterObjectManager.cs:382)
DWP2.WaterObjectManager.Start () (at Assets/DWP2/Dynamic Water Physics 2/Scripts/WaterObject/WaterObjectManager.cs:214)

Can`t get this to work with Crest ocean and Unity 2019.2.0f1.
Crazy, tried it with Lux water too. Seems not to work (but no errors are shown), my capsule sinks to the ground and ignores the water.
The demo scene works fine. :face_with_spiral_eyes:

With Lux water make sure that you are using DWP_LUX scripting define symbol (it should say in the console which water you are using) and that the object which contains actual Lux script is tagged as water. In the example “Infinite Ocean With Skirt” (or similar name) this is one of the children objects of the ocean. And lastly make sure that “Query Water Heights” is ticked under WaterObjectManager. Usually it is also a good idea to set the Lux ocean to y=0.
Hopefully this helps.