Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Dynamic Water System [Released]

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

  1. cjrussel14

    cjrussel14

    Joined:
    Jun 20, 2014
    Posts:
    69
    i set the buoyant to my character ... ok i will try,
     
  2. cjrussel14

    cjrussel14

    Joined:
    Jun 20, 2014
    Posts:
    69
    ok i managed to make it work.. what script should i use for a human that when run through water there is a splash .?
     
  3. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    DW_CharacterRipples script. See an example of how to use it in the Character demo scene.
     
  4. cjrussel14

    cjrussel14

    Joined:
    Jun 20, 2014
    Posts:
    69
    ok it works perfectly .. sorry for such question i'm so sleepy awhile ago i became lazy to figure things out :)

    any way i notice if i set the quality around 200 it getting slower in gameplay.. im developing for mobile device
     
  5. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    Hi,
    I've recently updated to unity 4.5.5f1 and now my water tech is broken, any ideas? i've reinstalled, updated...
    i'm using DX11, was fine a few weeks ago. thanks!

    DllNotFoundException: DynamicWaterNative
    LostPolygon.DynamicWaterSystem.DynamicWaterNativeLibrary.SolveWaveEquationNative (Int32 gridSizeX, Int32 gridSizeY, Single timeDelta, Single damping, System.Single& maxValue, System.Single[] field, System.Single[] fieldNew, System.Single[] fieldSpeed, System.Byte[] fieldObstruction)
    LostPolygon.DynamicWaterSystem.DynamicWaterSolverSimulation.StepSimulation (Single speed, Single damping) (at Assets/DynamicWater/DynamicWaterSolverSimulation.cs:66)
    LostPolygon.DynamicWaterSystem.DynamicWater.StepSimulation () (at Assets/DynamicWater/DynamicWater.cs:839)
    LostPolygon.DynamicWaterSystem.DynamicWater.FixedUpdate () (at Assets/DynamicWater/DynamicWater.cs:826)
     
  6. cjrussel14

    cjrussel14

    Joined:
    Jun 20, 2014
    Posts:
    69
    when i put underwater script on the main camera it ask for a collider.. what collider should i use?
     
    Last edited: Nov 27, 2014
  7. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    also getting this:

    DllNotFoundException: DynamicWaterNative
    LostPolygon.DynamicWaterSystem.DynamicWaterNativeLibrary.SolveWaveEquationNative (Int32 gridSizeX, Int32 gridSizeY, Single timeDelta, Single damping, System.Single& maxValue, System.Single[] field, System.Single[] fieldNew, System.Single[] fieldSpeed, System.Byte[] fieldObstruction)
    LostPolygon.DynamicWaterSystem.DynamicWaterSolverSimulation.StepSimulation (Single speed, Single damping) (at Assets/DynamicWater/DynamicWaterSolverSimulation.cs:66)
    LostPolygon.DynamicWaterSystem.DynamicWater.StepSimulation () (at Assets/DynamicWater/DynamicWater.cs:839)
    LostPolygon.DynamicWaterSystem.DynamicWater.FixedUpdate () (at Assets/DynamicWater/DynamicWater.cs:826)
     
  8. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Sorry for the slow responses everyone.
    @HeadTrip
    @Exbleative
    Could you please try creating a new project, importing DynamicWater into it and see if it works? From what I can judge, that error can mean two things:
    1) Assets/Plugins/DynamicWaterNative.dll file is missing.
    2) There is some kind of weird Unity licensing issue... Hard to say.

    Do you use Free or Pro? On what operating system?
     
    Last edited: Dec 2, 2014
  9. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    UnderwaterFog script automatically adds required components when you enter Play. It needs a Kinematic Rigidbody and a zero-sized BoxCollider or SphereCollider.
     
  10. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    200 is way too much for current day mobile devices. Lower it to something like 120.
     
  11. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    Win7, Unity Pro. I tried loading the pool scene with dx9 and dx11, there are no 3d wave geometry effects going on, I get the following error again:

    DllNotFoundException: DynamicWaterNative
    LostPolygon.DynamicWaterSystem.DynamicWaterNativeLibrary.SolveWaveEquationNative (Int32 gridSizeX, Int32 gridSizeY, Single timeDelta, Single damping, System.Single& maxValue, System.Single[] field, System.Single[] fieldNew, System.Single[] fieldSpeed, System.Byte[] fieldObstruction)
    LostPolygon.DynamicWaterSystem.DynamicWaterSolverSimulation.StepSimulation (Single speed, Single damping) (at Assets/DynamicWater/DynamicWaterSolverSimulation.cs:66)
    LostPolygon.DynamicWaterSystem.DynamicWater.StepSimulation () (at Assets/DynamicWater/DynamicWater.cs:839)
    LostPolygon.DynamicWaterSystem.DynamicWater.FixedUpdate () (at Assets/DynamicWater/DynamicWater.cs:826)

    I then created a new project, including Dynamic water and nothing else, which works without error. So some kinda conflict I guess?

    My other included plugins are:
    • Playmaker
    • Oculus Rift
    • 3dception audio
    • Marmoset Skyshop
     
  12. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    This is odd, but it seems like Unity can't recognize the dll for some reason. Please recheck if "Assets/Plugins/DynamicWaterNative.dll" is present in your project, and if it does, try force-reimporting it by using Reimport from the context menu.
     
  13. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    That dll was indeed there. Reimported it and still no good I'm afraid. Same dll error occurs.
     
  14. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Maybe try "Assets - Reimport All" as the last resort? I'm out of ideas otherwise, and I can't reproduce the issue to fix it... It'd be great if you are able make a smallest possible reproduction project and send it to me, so I can actually find the source or the problem without any guesswork.
     
  15. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    I tried this as well, deleted all water.. re-imported. I still get the same missing dll error, even with the Demo scenes. This started for me with Unity 4.5.5.f and is there in Unity 4.6.
     
  16. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Just one other thing: try building a standalone PC build even if you get DllNotFoundException in the editor. Will it work for you in a standalone build?..
    I am trying to find any information about similar issues and it looks like Unity is indeed somewhat quirky about loading native dll's...
     
  17. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Also one more idea: try creating "Plugins/x86" directory and moving DynamicWaterNative.dll from "Plugins/DynamicWaterNative.dll" to "Plugins/x86/DynamicWaterNative.dll".
     
  18. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Just found another one possible reason: you guys don't have Microsoft Visual C++ 2010 Redistributable installed. It can be found here:
    http://www.microsoft.com/en-us/download/details.aspx?id=5555

    P.S. It's getting a little embarassing, but please understand that I am just making guesses because I can't reproduce the problem. I'm sorry for possibly wasting your time, but I'm doing the best I can.
     
  19. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    This fixed it for me, woohoo! Something you can fix for later? fresh installs, new projects...
    thanks!
     
  20. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Phew! Glad it worked, thanks for checking it. Well, it seems like for some reason it does still works on new projects, but I think I'll make a small update available on Asset Store just to fix this issue very soon. Until this happens, the workaround is like that - just move the dll.
     
  21. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Okay, the update to 1.3.2c should now be live on Asset Store. The only change is that it now automatically relocates DynamicWaterNative.dll to "Plugins/x86/DynamicWaterNative.dll" on Unity 4 and newer.
     
  22. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    This worked for me as well. I did have some issues with the update with Unity crashing, but... Unity crashing isn't exactly odd. Eventually manually removed it from the plugins directory and all is working. Now I'm just trying to find a water shader that is identical to the one that comes with Unity's Pro water, but doesn't have all the artificial 2d waves which also simply doesn't play nice with your water. Just want the realtime reflection/refraction stuff which I believe is done with render textures? If you can point me to something that'd be great!
     
  23. Lafinetoxine

    Lafinetoxine

    Joined:
    Aug 29, 2013
    Posts:
    1
    I am also searching for the exact same shader, if someone sees something around please post it here. It would be nice to have it bundled with the Dynamic water system.
     
  24. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    I've imported 1.3.2c into Unity 5 beta 20.

    Fails to compile with the following errors:
    Assets/DynamicWater/Demos/Assets/Scripts/DW_DragRigidBody.js(23,41): BCE0019: 'ScreenPointToRay' is not a member of 'UnityEngine.Component'.
    Assets/DynamicWater/Demos/Assets/Scripts/DW_DragRigidBody.js(66,38): BCE0019: 'ScreenPointToRay' is not a member of 'UnityEngine.Component'.

    I resolved these errors with the following fixes:

    Demos/Assets/Scripts/DW_DragRigidBody.js (line 23)
    if (!Physics.Raycast(mainCamera.gameObject.GetComponent(Camera).ScreenPointToRay(Input.mousePosition), hit, 1000, layers.value))

    Demos/Assets/Scripts/DW_DragRigidBody.js (line 66)
    var ray = mainCamera.gameObject.GetComponent(Camera).ScreenPointToRay (Input.mousePosition);

    Upon loading any of the demos I get a prompt to add Missing tags and layers automatically. I confirm yes and get the prompt again. I confirm again but if I check Tags and Layers they aren't being added to the project.

    Looks like it just needs some minor fixes to be compatible.
     
    Last edited: Jan 26, 2015
  25. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    There's a lot more fixes to be done for it to work nicely in Unity 5, actually. I already have an internal version that is mostly compatible with Unity 5 Beta, but almost every new beta breaks something again :/
     
  26. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    I'm very interested in purchasing your asset although I wonder just what the size limitation might be. I need the water to fit in the yellow/orange water canals you see here. There are brown bridges that give you a reference of size for a character that walks over them. I'm aware that there can be performance issues I will be having waterfalls in key locations and have everything use Frustum and occlusion culling where possible and perhaps in the near future amplify texture or mesh baker/mesh baker lod to speed things up. I would like to try a multi-threading asset but I don't think WebGL in Unity is compatible with that yet. Do you think your Dynamic water will work in this situation?
    upload_2015-1-27_22-49-9.png
     
  27. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    @Ascensi
    Sorry for the slow reply. Whether or not it will work for your scene depends on what effect you want to get. Fully interactive ripples like in Pool or Character demos definitely won't work nicely. However, if all you need are non-interactive waves like in the Boat demo - then yes, that is possible, as you can make a lot of water tiles that will actually tile and be effectively culled.
     
  28. DoctorMobius

    DoctorMobius

    Joined:
    Oct 2, 2014
    Posts:
    15
    I bought your uIntelliSense product and I'd love to buy this too, do you have an ETA for a Unity 5 compatible version?
     
  29. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    ETA for Unity 5 compatible version is around a week or so.
     
  30. imtehQ

    imtehQ

    Joined:
    Feb 18, 2013
    Posts:
    232
    Is it compatible with unity 5?
     
  31. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Not yet. Unity 5 compatibility update is somewhat delayed as I was busy making Unity 5 updates for my other assets, and, unfortunately, that took more time than I've expected. But I'm working hard on updating Dynanic Water System as well. It won't be just added Unity 5 compatibility, some new features and improvements will also land.
     
  32. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    639
    Hi, if I were to use this for a larger body of water, just to have some slight waves and making the boat rock (on something like a large pond/small lake) does the entire body of water need to by dynamic water?

    What I am asking, is if there is a way to only make lets say a 10m radius around the boat actually use dynamic water, but the rest of the water is just using a flat mesh with whatever shader. Does that make sense? So as the boat moves, just the small radius of water around the boat is using dynamic water calculations.

    Or maybe if all I want is to have slight "waves" to make a fishing boat rock a little bit to give some more depth, I can cut back on the quality of the dynamic water so much that even though it is a larger mesh, it won't take up much performance?
     
  33. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    That's not currently possible, unfortunately. The water simulation is done in local space, so if you move the water plane, the ripples would also move with it, and that will look weird and wrong. A possible way is to construct water from tiles and enable/disable the ripple simulation on the nearby tiles, but that is a very convoluted path and I currently have no plans for implementing that since I'm not even sure if the performance gain will be worth it.
    Yes, this you can do. In fact, that's exactly what happens in the Boat demo scene - only big ambient waves are calculated, and the dynamic simulation is fully disabled. Ambient waves depends much less on the resolution of the mesh, so you can make the water body many times larger.
     
  34. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Hi everyyone,

    update to 1.3.3 is now live on Asset Store!
    This a patch update that just fixes Unity 5 compatibility, so it's recommended to update if you were using Dynamic Water System with Unity 5 previously.
    I also want to say that there is a big update in the works. It'll add some new features, increase the overall performance and basically make everything look nicer and work better. It was originally meant to be released somewhere around this time, but, as I was adding and changing more and more stuff, it quickly got out of control :) I want this next update to be polished, so it'll take some more time, but until it's out, there should be no problems in Unity 5 with the 1.3.3 patch.

    Cheers,
    - Serhii
     
    Last edited: Mar 30, 2015
  35. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    639
    So the "big waves" on a larger scaled mesh are inherently more performant, and will work great for just having a boat being rocked around in the water? Sweet!

    And I think I read you can use any shader, so I can just apply this to the Unity pro water very easily?
     
  36. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Yes, you should be able to use the Unity Pro water shader. The only catch I can remember off the top of my head is that you probably can't use realtime reflections. That's because Unity Pro water only works with totally flat water bodies, so if waves are big enough, realtime reflections will look detached and really out of place.
     
    Last edited: Mar 30, 2015
  37. Wuchi3d

    Wuchi3d

    Joined:
    Apr 2, 2015
    Posts:
    2
    Hello,

    I have a question. I purchased this package and i need your swimming pool to use it in my project...but i have problem with combined meshes (it does not show) says missing mesh...is there a way to fix this ?

    Best regards,
    Wuchi3d
     
  38. studio-g9

    studio-g9

    Joined:
    Mar 23, 2015
    Posts:
    3
    dw_boat, dw_boatmobile, dw_buoyancy, dw_buoyancymobile scene is broken on 1.3.3 version.
    please send me demo scene files
    my email is admin@studiognine.com
     
  39. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,291
    Nice, thanks for updating.
     
  40. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Sorry for really slow reply everyone, was busy moving to other country.

    Seems like both of you are having similar issues, but it's really hard to tell what's exactly broken without any additional information. I've just the the latest package in Unity 5.0.1 and everything seems fine. What Unity version are you using? Could you provide a screenshot of the problem?
     
  41. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Hey there, I have a few questions that I hope you can answer reasonably quickly as others are waiting for me to get along with what I'm meant to be getting along with hah, certainly if you can answer some concerns you'll be of great help

    Firstly, I'd like to be able to wrap the effect around a sphere using the time honoured wrap 6 planes to a sphere method, the script doing this would recalculate the normals appropriately - would the behaviour of the water stay the same?

    Regarding buoyancy, the above would mean altering the gravity to point to the centre of the local body, I'm presuming that shouldnt be too bad, however I have gerstner based waves being calculated in the vertex shader and while these should react kind of appropriately with the ripples, would they be able to interact with the buoyancy? And would the waves need to be moved to the CPU - would this result in a lot of slowness, would running it on another thread help?

    As wrapping to a sphere would mean 6 dynamic water planes, could this prove slow too?

    And finally, outside deliberately tackling the pixel shader in something in shaderforge or similar, could you advise on a way to get the roughness value in the deferred gbuffer exposed for SSR techniques, I'm hoping to recreate slightly rougher water surfaces to account for miscellaneous flotsam, and anything the SSR fails at be dealt with by a skybox

    Thankyou for your time and I hope all that makes sense
     
  42. jmills

    jmills

    Joined:
    Apr 15, 2013
    Posts:
    11
    I recently purchased Dynamic Water System from the Unity Store and noticed that while it works very well with meshes and 3D objects, it doesn't seem to correctly draw sprites when they are submerged or half submerged. Depending on the draw order I pick for the Sprite, the part of the sprite which overlaps the water either is drawn submerged or above water , but it has nothing to do with the depth of the sprite relative to the water. In the following two screenshots, the penguin is above the water's Y level ( and is thus closer to the camera ).

    This is when the draw order is zero:




    This is when the draw order is one:



    If you move the penguin over the water, you get the exact same results, except the entire penguin is either blue tinted or normal colored, according to draw order zero or one, respectively.

    Is there any way to fix this? It also seems to do the same thing with Unity's standard transparent shader.
     
  43. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    @jmills
    I can't see the screenshots because you've used private Dropbox URL, but doesn't matter, I understand the issue.
    Not sure what effect you are trying to achieve with 2D sprites, but this has nothing to do with Dynamic Water in particular, it's just how things work when drawing semi-transparent objects. Here's a good explanation:
    http://answers.unity3d.com/questions/24498/why-does-it-say-set-zwrite-to-off-when-semi-transp.html
    The reason why depth doesn't influences anything is because, well, sprites have no concept of depth. They do not write to the Z-buffer, so there is no way to determine if a sprite pixel is submerged or not.
    The best that can probably be done here is to use alphatest+z-write. I've attached the modified shader that should do the job. The downside is that it'll only work with sprites that are mostly opaque, and some aliased edges will unevitably appear.
     

    Attached Files:

  44. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    @lazygunn
    Sorry for the extremely slow reply. For some reason I didn't get the notification :/

    In two words: no, it is not possible to bend the water like that. Dynamic Water is heavily optimized by using the fact that water body is basically a heightmap, so changing that would break all sort of things. Recalculating the normals is another problem - you'd have to do some extremely quirky calculations in order to calculate normals correctly where the water planes intersect.

    The buoyancy won't work with this scenario either, as it assumes the water body is not warped like you want it to.
    Waves are already calculated on the CPU, but calculating Gerstner waves on the CPU is indeed an intensive task.

    In two words - you can't do that with Dynamic Water.
    Well, I'm not an expert in SSR, but I think roughness is stored in the Alpha channel in Unity 4.x. Deferred G-Buffer layour is different in 5.x, but I don't know about it for sure.
     
  45. luohj

    luohj

    Joined:
    Jun 8, 2015
    Posts:
    2
    Just now, I downloaded the "Dynamic Water System" v1.3.3.0, and then import into Unity5.0.0f4, when open "DW_Boat.unity", "DW_BoatMobile.unity", "DW_Buoyancy.unity", "DW_Waterfall.unity", in the Hierarchy, there is nothing. But open other scene, it is normal.
    Could you please improve this problem?
     
    Last edited: Jun 8, 2015
  46. le4feo

    le4feo

    Joined:
    Apr 6, 2015
    Posts:
    1
    Is the water in "Dynamic Water System" able to change is form freely? For example, I place the water in a cube and if I tilt the cube, the water will flow and its shape will change accordingly.
     
  47. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Hi there, this is a known bug of Unity 5.0.0f4. Please update to the latest Unity 5 version and it should be fine.
     
  48. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Sorry, Dynamic Water is not capable of that. Water is impleneted as a plane with added ripples, it can't flow freely.
     
  49. luohj

    luohj

    Joined:
    Jun 8, 2015
    Posts:
    2
    Performace Problem
    For the Pool Scene, when I run your Android Demo (.apk) in my android device, the FPS is 60fps; but when I build it with t Unity 5 (5.0.2f1) and run in the same android device, the FPS is only 32fps.

    Would you please tell us how to imprive the performace problem in Unity5?
     
  50. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Well, this has nothing to do with Dynamic Water System itself. The demo was built using Unity 4, and there's a ton of things different between Unity 4 and Unity 5. Apparently, Unity 5 suffers from some performance problems on Android:
    http://forum.unity3d.com/threads/very-poor-performance-on-android-after-upgrading-to-unity-5.306572/
    http://forum.unity3d.com/threads/ge...ter-upgrading-to-android-5-0-lollipop.281496/
    That said, I am using Nexus 4 for testing and I've been able to reproduce your problem - the FPS indeed drops 2x compared to Unity 4. I've then removed the water and all the buoyant objects from the scene and FPS was still low, which means the source of the problem is not Dynamic Water System. After that I've disabled the shadows in Scene/Light and got 60 FPS back. So try that - disabling shadows, hopefully it'll help you too.