Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Dynamic Water System [Released]

Discussion in 'Assets and Asset Store' started by ZimM, Aug 14, 2013.

  1. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,038
    How quick is Dynamic Water System compared to using Unity basic water shader for PE? Also, can it do underwater caustics/different colours for different depths and rippling if looking up from underwater?
     
  2. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    945
    Dynamic Water System is a simulation/physics package in the first place, so your questions are somewhat invalid. Unity Basic Water is nothing more than a plane with a shader applied. Dynamic Water System, on the other side, is all about wave simulation, and the included shaders are just for demo purposes and not extremely optimized. The point is - you can use any water shader with Dynamic Water, as it's designed mostly to complement your water looks, not completely replace it.
     
  3. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,038
    @ ZimM - Ah, I understand - thanks for getting back to me.
     
  4. DrakharStudio

    DrakharStudio

    Joined:
    Mar 2, 2012
    Posts:
    8
    Hi,

    We bought your asset and it works like a charm! Except ...

    We are now porting the game to XBOX one, and when building it complains on your dll saying it is not a AMD64 binary. Is there any way to fix that ?
     
  5. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    945
    Interesting. I don't have a XB1 or a Unity license for it, so I can't say for sure, but - at which dll, exactly, it complains?.. There is only a single native dll there, located in Plugins/x86, but it shouldn't even be included into x64 build, since, indeed, it's not an x64 dll.
     
  6. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    685
    Just want to clarify – this can work with all sorts of arbitrary mesh water shapes, correct?
     
  7. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    945
    Not exactly. The system itself supports only flat rectangular planes. You can simulate different shapes of the plane by using obstructions masks (like you can see in the Obstruction scene in the webplayer demo, where it is used to make a ciruclar-shaped water body). However, using arbitrary mesh shapes (like a sphere) is not possible.
     
  8. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    685
    So it looks like the obstruction mask is an array? So you'd have to somehow determine the triangles which are obstructed and relate those to the array? So you'd have to create a rectangle bounding the entire area and then create a bounding box on the areas of the rectangle you want to omit and see which verts are in that area and then mark them as occlusion vertices?
     
    Last edited: Jul 11, 2015
  9. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    945
    Internally - yes. It is actually a texture that is stretched across the whole water plane and then converted into an array for your convenience. But, of course, you can fill the obstruction mask in whatever way you want.
     
  10. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    685
    Ok, that makes sense and would occluding sections of the water speed up the simulation rendering time proportionally? One more question – would opaque water still show the ripples or does it need to be clear for the effect to be apparent? Thanks so much for the quick responses!
     
  11. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    945
    Yes, occluded points are excluded from the calculation for better performance, however, they are still not absolutely free (as they still have to be traversed), so keep that in mind.
    It's depends on whatever shader you use to actually render the water. With the included demo shaders, it doesn't really matters - as long as you can see the water, the effect is apparent.
     
  12. GreatWhite

    GreatWhite

    Joined:
    Dec 13, 2012
    Posts:
    4
    Hi,

    Does this use a cube or a plane? Can a water volume for 2.5D with dynamic surface/waterline be achieved with DWS?

    Thanks in advance!
     
    Manny Calavera likes this.
  13. JTam_HItn

    JTam_HItn

    Joined:
    Dec 13, 2013
    Posts:
    4
    Hi ZimM,
    How can I change the Buoyancy Force on a game object during runtime?

    Thanks!
     
  14. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    945
    Dynamic Water surface is just a plane, so no, you can't do that right out of the box. I was thinking about adding support for this kind of thing, but there turned out to be certain complications. Still, it is on the roadmap.
     
    Manny Calavera likes this.
  15. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    945
    Do you mean the component or the actual force applied to the object? Buoyancy force depends on the density of the object and on the density of fluid the object is in. The smaller the density of the object is compared to the density of the fluid - the bigger the force. In runtime, you can change the density of the object like this:
    Code (csharp):
    1. BuoyancyForce buoyancyForce = GetComponent<BuoyancyForce>();
    2. buoyancyForce.Density = 500;
     
    JTam_HItn likes this.
  16. JTam_HItn

    JTam_HItn

    Joined:
    Dec 13, 2013
    Posts:
    4
    Thanks! That answered my question :)
     
  17. adre

    adre

    Joined:
    Mar 28, 2014
    Posts:
    37
    Hi, i just bought the assets which seems really powerful.
    I imported in the project ( unity 5.x ) but i have the following errors just after the import:

    Assets/DynamicWater/Demos/Assets/Scripts/DW_CharacterRipples.cs(57,37): error CS1061: Type `CharacterController' does not contain a definition for `bounds' and no extension method `bounds' of type `CharacterController' could be found (are you missing a using directive or an assembly reference?)

    Assets/DynamicWater/Demos/Assets/Scripts/DW_CharacterRipples.cs(58,37): error CS1061: Type `CharacterController' does not contain a definition for `bounds' and no extension method `bounds' of type `CharacterController' could be found (are you missing a using directive or an assembly reference?)

    Assets/DynamicWater/Demos/Assets/Scripts/DW_CharacterRipples.cs(62,29): error CS1061: Type `CharacterController' does not contain a definition for `velocity' and no extension method `velocity' of type `CharacterController' could be found (are you missing a using directive or an assembly reference?)

    Assets/DynamicWater/Demos/Assets/Scripts/DW_CharacterRipples.cs(67,100): error CS1061: Type `CharacterController' does not contain a definition for `isGrounded' and no extension method `isGrounded' of type `CharacterController' could be found (are you missing a using directive or an assembly reference?)


    Any way to sort it out?
     
  18. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    945
    Hi,
    I can't confirm that, unfortunately. I've just tried importing Dynamic Water into Unity 5.0.2 and latest Unity 5.1.2 and it's all OK, no compilation errors.
    1) Which exact version of Unity are you using?
    2) What is your build target?
    3) Make sure the Dynamic Water package was downloaded from within the built-in Unity 5.x Asset Store window. You can't upgrade a Unity 4.x project, nor you can't use a Unity 4.x-specific package with Unity 5.x.
     
  19. xiewneqi

    xiewneqi

    Joined:
    Aug 20, 2012
    Posts:
    31
    Hi,
    It seems Dynamic Water doesn't support IL2CPP on IOS. There are lots of compile errors when build with IL2CPP into xcode project, similar to:
    Any solution?
     
  20. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    945
    Sorry for the slow response.
    This seems to be a bug in IL2CPP, not in Dynamic Water itself. What version of Unity do you use? IL2CPP gets tons of fixes all the time, so it is important to use the latest Unity version if you are developing for iOS. I've just tested in the latest Unity 5.2.0f1 and it compiles fine.
     
  21. MikeSz

    MikeSz

    Joined:
    Jul 7, 2014
    Posts:
    2
    What about 4.6.7? Does it compile fine there?

    I've e-mailed you a few days back with some questions, but apparently forum works faster ;) Gonna copy-paste them here:
    1) Is it possible to use your plugin just for the simulation but without any rendering? Or to remove your rendering and replace it with a custom solution? (needed to match the planned art style of our game)
    2) Is the source for modifying and passing meshes to GPU included with the plugin?

    Cheers!
     
  22. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    945
    E-mail is usually faster most of the time, I was actually going to reply to your message just now, so it's just my bad, sorry.

    I've just tested with 4.6.7p3 and it compiles fine too.

    1) You can use just the simulation, yes, but you'll probably have to read through the source code to understand how to do that. In any case, what is specific kind of rendering you're going to? The way Dynamic Water System works, you can apply any shader and material to the mesh, and it will work just fine, so probably there's no need to overcomplicate this.
    2) Yes, all C# code is included with the plugin. There is one catch, though. While most platforms use C# code, a C++ dll is used for Android and Windows x86 to get better performance. It is optional, and it is exactly the same as C# code, just converted to C++, but it's not included in the package. I plan to include it in the next update, but meanwhile, you can request it via email if you need it.

    Hope this helps.
     
    Last edited: Aug 18, 2015
  23. soldier11213048

    soldier11213048

    Joined:
    Mar 29, 2015
    Posts:
    11
    Could Dynamic Water support IOS?
    I build faild in IOS, Couly you help me? The error is below

    Thanks.
     

    Attached Files:

  24. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    945
    This is the exact same error that was discussed just a few posts above. Update your Unity version and the issue should be gone. You should always use the latest Unity version when building for iOS, since IL2CPP gets a ton of fixes all the time.
     
  25. c-rajiv-chandel

    c-rajiv-chandel

    Joined:
    Nov 19, 2012
    Posts:
    30
    @ZimM I have e-mailed you some queries please help.
     
  26. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    635
    I have a larger open body of water that's surrounded by terrain. Instead of creating a giant plane which 75% of it is wasted underground, I used Blender to create a custom flat mesh like this that follows the water in terrain:

    Untitled.jpg

    Is there absolutely no way to make Dynamic Water (just some simple waves) work on a custom mesh like this?
     
  27. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    945

    There is no way to do that now, unfortunately, since Dynamic Water System maintains its own mesh that has known specific geometry for performance reasons. But it's not entirely "wasted" - waves will be only be calculated in non-underground areas, if you set up your terrain as an obstruction.
     
  28. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    635
    I have a boat out on the water all the time. It doesn't seem that there's any "occluding" so to speak to not do calculations if you are not looking at the boat, or are even very far from boat, in BuoyanceForce. Am I missing a setting or do I need to implement my own script to enable/disable the boat buoyancy?

    Is disabling the script enough? It looks like I'd have to freeze the rigibody position so it doesn't sink if I disable and enable script.
     
  29. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    945
    Well, the question is - should there even be such a thing? BuoyanceForce is designed in the same way standard Unity physics components are. And Unity physics components are not disabled automatically when you are not looking on the object, or when you are far away from it. The reason is simple - if you just disable the buoyancy script, your object will sink to the bottom, which is clearly not something you'll ever want to save some calculations. Sure, you can freeze the rigidbody position, but, again, this depends very much on the exact situation and scene you'll need this.

    Still, I was indeed thinking about some kind of LOD system to gradually reduce the buoyancy detail with distance, so maybe I'll do that in an update.
     
    Last edited: Sep 22, 2015
  30. rkstormer

    rkstormer

    Joined:
    Nov 26, 2012
    Posts:
    17
    In my game I have boats with people on them. I'm generally happy with how the buoyancy works on the boats but I always have trouble with the boats sometimes dipping underneath the water completely, submersing the people, which just doesn't look right. Is there a way to make sure the boats are never submersed beyond a certain point? I've played around with the buoyancy force parameters a bit but can't seem to find a solution.

    Thanks in advance.
     
  31. Manny Calavera

    Manny Calavera

    Joined:
    Oct 19, 2011
    Posts:
    205
    Hi @ZimM, has there been any follow up on this?

    I would like to setup a top-down view where the camera follows the character over a large body of water. A couple of options:

    - Tiling a few DynamicWater boxes side by side. In which case the ripples would have to propagate between adjacent DynamicWater meshes. Maybe even lay 9 tiles around the camera and reposition them as needed.
    - Parent a single DynamicWater box under the camera. In which case the mesh would have to 'scroll' as the camera moves and the simulation wraparound.

    Possible? Any ideas?

    I'm mainly interested in the ripples. Buoyancy is not needed for my use case. Obstruction would be nice to have.
     
  32. rkstormer

    rkstormer

    Joined:
    Nov 26, 2012
    Posts:
    17
    I posted a question before asking if there is some way to ensure that a floating object (such as a boat) never goes completely under the water's surface, even with relatively large waves. Does anyone have a suggestion about how I might do this?
     
  33. speckpgh

    speckpgh

    Joined:
    Jan 20, 2016
    Posts:
    2
    Does this library support objects creating and properly propagating waves over the fluid? IE... I drop a rock into the pool, it will properly propagate the wave out from that point, reflecting and interacting off other objects in the fluid? I really need this behavior to explore an idea I have, and I have not found a physics engine yet that seems to handle this properly...
     
  34. Vontarga

    Vontarga

    Joined:
    Oct 14, 2014
    Posts:
    99
    Hi Zim,

    Wonderful product, but we encountered a problem with alpha layers. Trees and other items vanish or shift when they are between the camera and your water. Is there a fix for this? Thank you.
     
  35. PlaymintDev

    PlaymintDev

    Joined:
    Jan 11, 2014
    Posts:
    304
    @ZimM

    I'm using your plugin Dynamic Water as one of the main plugins in my game, small water based arena, I get decent performance with 5.3.3, however after updating to 5.3.4 and also trying 5.4 Beta 12 the performance drops dramatically,

    5.3.3 - Average of between 60 - 75 fps
    5.3.4 - Average of between 15 - 20 fps
    5.4 beta 12 - Average of between 12 - 15 fps


    Can you update your plugin to work correctly with these versions, or at least release an interim fix for whatever is causing the huge drop in performance ?

    It's definitely Dynamic Water causing the performance drop, because if I disable the gameobject, performance in every version jumps back up to an average of between 60 - 75 fps again.
     
  36. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    945
    It's highly unlikely that updating 5.3.3 to 5.3.4 will cause that huge of a drop by itself... Perhaps something else changed too? Do you use 32-bit or 64-bit versions of Unity? How many Dynamic Water instances are there, and how high is the Quality setting? Also, on what platform are you seeing those FPS?
    I'll take a look at the issue in a few days, but meanwhile, could you please run the Profiler in Deep Profile mode and examine what exactly is consuming the most CPU resources? That would be a tremendous help.
     
    Last edited: Apr 2, 2016
  37. PlaymintDev

    PlaymintDev

    Joined:
    Jan 11, 2014
    Posts:
    304
    Thanks for replying.

    I don't want to disrespect your plugin, I think it's fantastic. However, it was the only constant that seemed to effect my game performance when disabled.

    To give you a bit more info. I am using Unity 5.3.3 on a iMac, there is 1 Dynamic Water instance, and in my test scene I also have 7 buoyancy objects, quality for Dynamic Water is 192, and 12 for buoyant objects, standard Mac desktop as the platform for builds, etc.

    This is some profiler information from my 5.3.3 version of the game, the 5.3.3 version of the game runs at a very good frame rate.



    EDIT : And some profiler info from 5.4 Beta 12, Overhead is marginal at best on both which makes it somewhat more confusing...



    EDIT 2 : Small update, installed 5.4 beta 12 again to test, now I'm getting 30-35 fps, so, somewhat better, but still half of what I was getting in 5.3.3, the game is playable again, still not sure what's causing the performance drop, I'm literally just loading the same file...
     
    Last edited: Apr 2, 2016
  38. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    945
    Thank you.

    Hm... Take a closer look at the Calls column of your screenshots. On your 5.3.3 screenshot, DynamicWater.FixedUpdate and BuoyancyForce.FixedUpdate are called 1 and 7 times respectively, which matches your description. However, on your 5.4b12, they are called 2 and 14 times... Looks like the Profiler lagged a bit and recorded two frames. But if you divide the value of "Time ms" column by number of calls, you can see that the actual time spent by DynamicWater and BuoyancyForce is pretty much the same in 5.3.3 in 5.4b12. So it seems like the issue is not CPU consumption.

    I've also just checked on my Windows machine and found no performance differences between 5.3.2 and 5.3.4, so I'm assuming that this is something OS X specific. Perhaps something GPU-related?.. It'd be great if you also compare the GPU Usage tab in the Profiler between 5.3.3 and 5.3.4.

    Of course, I'm not saying that there is actually no issue here, but at the moment, it's really hard to figure out what's actually causing the slowdown... It'd be best if you PM me your project (or make a project that reproduces the problem), so I can investigate the issue.

    By the way, BuoyancyForce Quality of 12 sounds waaay too much. Usually it makes no sense to have quality bigger than 6.
     
  39. PlaymintDev

    PlaymintDev

    Joined:
    Jan 11, 2014
    Posts:
    304
    Thanks for your suggestions, I will look into these and see if I can figure out what is going on. I didn't even notice that they had been called twice, I'll investigate this also.

    I actually struggled with this as it's not documented anywhere, I looked within the online documentation but couldn't find this explained. I will change this based on your suggestions.

    If all else fails, and I can't find a solution, I may take you up on your offer of looking at my project file, but I will exhaust all other options first.

    Regards
     
  40. imtehQ

    imtehQ

    Joined:
    Feb 18, 2013
    Posts:
    230
    is there a way to map the area bigger?
    I know there is this max mesh size, and simply stacking them next to each other will also not work.

    But is there a way?
     
  41. ashleebeggs

    ashleebeggs

    Joined:
    Sep 25, 2015
    Posts:
    4
    Hi I am using this with google cardboard and cannot select objects when water prefab is active. However if water prefab is not active I can select. Not sure why I cannot select objects that are buoyant on the water.
     
  42. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    945
    Good news everyone! Dynamic Water System v.1.3.4 with improved Unity 5.6 is now live on the Asset Store!

    Not really at the moment. In the next update, I hope to make non-interactive simulation work in world space, so they can be stacked together.
    Do you mean selecting in the Editor? Are you sure it is related to Google Cardboard somehow? It's really hard to say anything without at least some screenshots.
     
  43. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,677
    I just tested this on Unity 5.5.3f1 with Unity's GlobalFog effect and the water is not affected by the fog at all. Is there a solution to this?
     
  44. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    651
    Online Documentation link is broken. Should maybe include docs in the package. This forum appears un-monitored.:(
     
  45. Didldak

    Didldak

    Joined:
    Mar 22, 2015
    Posts:
    3
    Any hints how to make this work correctly with HDRP?
     
  46. Didldak

    Didldak

    Joined:
    Mar 22, 2015
    Posts:
    3
    Also the documentation link is 404.. damn
     
  47. M_Shazaib

    M_Shazaib

    Joined:
    Nov 20, 2018
    Posts:
    2
    I imported your project but the water is not working properly objects are falling through without any effect please help