Search Unity

Physics Dynamic Water Physics - Realistic. Fast. Universal.

Discussion in 'Tools In Progress' started by NWHCoding, Apr 21, 2017.

?

Which water asset do you use with DWP?

  1. Crest

    112 vote(s)
    54.9%
  2. AQUAS

    15 vote(s)
    7.4%
  3. RAM

    17 vote(s)
    8.3%
  4. Ocean Community Next Gen

    6 vote(s)
    2.9%
  5. Ceto

    4 vote(s)
    2.0%
  6. SUIMONO

    7 vote(s)
    3.4%
  7. Ultimate Water System

    6 vote(s)
    2.9%
  8. Other Flat Water Asset

    8 vote(s)
    3.9%
  9. Other Water Asset With Waves

    29 vote(s)
    14.2%
  1. reedthegod

    reedthegod

    Joined:
    Apr 20, 2020
    Posts:
    3
    YAY! FINALLY WAVES THE ONE THING I BOUGHT THIS FOR!
     
  2. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    I'd like to see a demo of that.
     
  3. stocks109

    stocks109

    Joined:
    Jul 18, 2013
    Posts:
    5
    Hi, what ocean / wave system do you recommend for this plugin that can support both mobile, console, and PC-based VR platforms?
     
  4. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
  5. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    If you are using Dynamic Water Physics 2 I would recommend Crest for sure. It is open source and getting more and more polished with each update - and they come almost on daily basis.
     
  6. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
  7. unity_HbZilIZAWyFuAg

    unity_HbZilIZAWyFuAg

    Joined:
    Feb 5, 2020
    Posts:
    8
    I am trying to modeling a ship but when I run the program the ship tilts on the left side.
    I have done an other ship before and I didn't have any problem.
    Can you help me with this?
    Thank you
     
  8. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    This one is easy to fix. Your center of mass is too high and therefore it tips over.
    Just attach center of mass script that is included and lower the value on the Y axis.
    If you already did that and it still tips over, make sure that the rotation of your model is correct (X-right, Y-up, Z-forward).
     
  9. unity_HbZilIZAWyFuAg

    unity_HbZilIZAWyFuAg

    Joined:
    Feb 5, 2020
    Posts:
    8
    Thank you for the tips.
    I am trying but in order to stay straight I have to lower the CoM with a quite a high value such as 9 and the draft of the ship is 6.
    The axis are correct now (they weren't before).
    I solved the problem using the hull of the first ship scaling it. The only remained issue is that the ship is rolling too much when I have rough sea. Can you explain what are the following parameters:
    -Skin Friction Drag
    -Dynamic Force Power
    -Velocity Dot Power
    thank you
     
  10. unity_HbZilIZAWyFuAg

    unity_HbZilIZAWyFuAg

    Joined:
    Feb 5, 2020
    Posts:
    8
    I read what the parameters are on the code.
    But I am still not able to have a good behavior in rough sea with the second ship: it jumps and turn a lot in all axis.
     
  11. unity_HbZilIZAWyFuAg

    unity_HbZilIZAWyFuAg

    Joined:
    Feb 5, 2020
    Posts:
    8
    I am using DWP2 with Crest.
    I am trying to modelling some big ships ,such as a Container Carrier with 325m of length. No matter what parameters I change, it seems to me that it is always rolling too much
     
  12. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Hello,
    please try inreasing the angular drag on the Rigidbody a bit.
    Normally large ships have some kind of roll stabilization but this has not been implemented in DWP2.
    Check this video:

    Or this Wiki article: https://en.wikipedia.org/wiki/Stabilizer_(ship)
    Increasing angular drag will help to some extent but a small script that applies counter torque to the ship would be better. I.e. when the ship is tilted left add torque in clockwise direction and vice versa.
    I have added this as a TODO.
     
  13. Zeevex

    Zeevex

    Joined:
    Jan 15, 2018
    Posts:
    28
    Hey! i'm looking at creating a river simulation, objects flowing down stream.. specifically a raft
    the asset R.A.M. seems to cover the shader part of this, does your asset have support for R.A.M.?
    and if so, how well does it handle drops/slopes in the river

    Kind regards!
     
  14. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    I have contected R.A.M. publisher about two weeks ago and nothing. But since it is quite requested I will see what I can do. DWP2 supports both waves and water flow. I am preparing to do a larger update in the future.
     
  15. obstudio

    obstudio

    Joined:
    Sep 30, 2016
    Posts:
    58
    try on discord
     
  16. unity_HbZilIZAWyFuAg

    unity_HbZilIZAWyFuAg

    Joined:
    Feb 5, 2020
    Posts:
    8
    I am modeling a container carrier.
    I am simulating a propeller that has always the same force and the ship is always reaching the same maximum speed, such as 17 knots.
    If my ship collides with something it happens that ,using the same force, the ship reaches a much bigger speed, such as 20 knots.

    I am applying the forces to the rigid body of Ship_local_pivot, the waterobject script is in "hull" gameobject and the collider is in "CollisionDetect" gameobject


    Can you understand why this is happening?
     
  17. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Could it be that the collision pushes the ship slightly out of the water? This would reduce the drag on the hull and allow the ship to go faster.
     
  18. unity_HbZilIZAWyFuAg

    unity_HbZilIZAWyFuAg

    Joined:
    Feb 5, 2020
    Posts:
    8
    After further tests I understood that this is happening always in a certain zone of a terrain. So it is not due to a collision.
    Is there a way to know the value of the drag in each point?
     
  19. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    That is interesting. What water are you using? A flat plane, Crest or something else?
     
  20. unity_HbZilIZAWyFuAg

    unity_HbZilIZAWyFuAg

    Joined:
    Feb 5, 2020
    Posts:
    8
    We are using Crest
     
  21. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    In that case - Crest uses LODs. I.e. the waves get finer and finer the closer you are to the origin. Could it be that if you are not using floating origin that the ship speeds up over LOD0 where the waves should be the highest resolution.
     
  22. ash4640

    ash4640

    Joined:
    Jan 19, 2018
    Posts:
    66
    I'm just wondering if I can delete the Demo Content folder after import DWP2, it is around 200mb; also is there a tutorial for integrating with Crest
     
  23. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Hello. v2.2 will be getting rid of Demo Content folder and everything will be in a single directory so while you could in 2.1, the answer is no for 2.2. Besides, except for using space on your drive these files will not increase the size of your build.
    As for Crest tutorial: http://dynamicwaterphysics.com/doku.php/WaterAssets
    v2.2 will have some major improvements for Crest integration and make integrating 3rd party assets much easier tho. Check the posts above for the changes. The update is expected in a few days.
     
    Last edited: Jul 12, 2020
    ash4640 likes this.
  24. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    I am currently rewriting most of the docs for DWP2 2.2 as these have been updated so many times that I feel they lost some of the usefulness and do not cover all the bases.
    Also, in 2.2 a new type of WaterDataProvider will be introduced: RaycastWaterDataProvider. RaycastWaterDataProvider can be used with any object that has a Collider attached to it. This should be useful for R.A.M. style assets or scenes that have rivers/streams/waterfalls implemented as a mesh with a scrolling texture.
     
    dsilverthorn and 3dship like this.
  25. unity_HbZilIZAWyFuAg

    unity_HbZilIZAWyFuAg

    Joined:
    Feb 5, 2020
    Posts:
    8
    I have a gameobject that represent the ship, it has a rigidbody with the mass of the ship.
    This gameobject has several children:
    -one gameobject that represent the "hull" of the ship and that contains WaterObjects script;
    -some of the other children have colliders that I use for several purposes.
    If one of these colliders is not symmetric respect the center of the ship and the "hull" collider the ship is going to stay bent on a side .
    Can you explain what is happening here?
    Thank you
     
  26. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    If I understood correctly the colliders for the object are not fully symmetric and therefore the ship tilts to the side?
    This happens because unity calculates center of mass as a center of all colliders, as if they all have uniform mass.
    To fix this add CenterOfMass script to your ship (to the object containing the Rigidbody) and adjust the X value in play mode until the ship is level. Then exit the play mode and use that value for center of mass.
     
  27. NyeinZL

    NyeinZL

    Joined:
    Mar 17, 2019
    Posts:
    10
    Hello!
    Could you please upload video tutorials for RAM and Crest.
    I followed the pdf manual and the boats and objects were not float.
    I am stuck.
    The demo scene of DWP2 works very well.
     
  28. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Hello,
    the highest supported version of Crest in DWP1 is Crest 6. Later versions have different API.
    RAM is not supported and never was in DWP1.
    DWP1 and 2 are very different assets with not much in common (ship controller is similar but the WaterObject code is completely new).
     
  29. NyeinZL

    NyeinZL

    Joined:
    Mar 17, 2019
    Posts:
    10
    I am using DWP2
     
  30. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Ah, OK then. Please also check: http://dynamicwaterphysics.com/doku.php/WaterAssets
    just in case the offline docs are outdated (should not be).

    Which one are you using, Crest or RAM? I am asking because they have quite different setups.
    Also, could you say which steps have you made? Does it float as if using flat water (i.e. does not register waves) or falls just straight through?
    And finally, do you get any warnings or errors?
     
  31. NyeinZL

    NyeinZL

    Joined:
    Mar 17, 2019
    Posts:
    10
    upload_2020-8-29_22-3-6.png 1.

    I tried both Crest and RAM.
    The above is screenshot from RAM.
    The followings are what I did.
    1. I opened the demo scene of DWP2.
    2. I disabled Water from Environment.
    3. I added RAM Lake Polygon. Tag Water and Layer to Water (layer 4)
    4. I changed RAMwaterprovider.cs.txt to RAMwaterprovider.cs.
    5. I created Empty Object and assigned RAMwaterprovider.cs.

    Play and all the objects were not float.
     
  32. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Could you PM me your project and I will take a look at it. Just remove the Library folder to reduce size. This will probably be the fastest way for me to debug it.
     
  33. bobAZ2019

    bobAZ2019

    Joined:
    Mar 28, 2019
    Posts:
    28
    hi,

    i'm using Unity 2019.4.11f1 and DWP 2.2.3.
    I attached AUDIO SOURCE to the "Ship" but i'm getting error below:
    No AudioSource assigned to Running Source field of object Capsule

    i'm using the DuckIdle as the audio clip.
    what can be the problem and how to fix it?

    thanks.
     
  34. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    @NWHCoding I have purchased DWP2, and it is really good! In our use case, we need a global ocean current vector and force. Can you implement this, so that this global vector force works realistic on the faces under water? Would really appreciate it. We did our own implementation, but it isn't work 100%. Also it would be more performance optimal to do this in the same pass when you add your forces to the faces.

    Have a great weekend!
     
  35. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    You most likely have to assign your AudioSource (not AudioClip) to the Running Source field of ship controller.
    DWP2 does not create AudioSources by itself so you have to manually add this component and drag it to the corresponding field under Engine tab.
     
  36. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Hello,
    luckily there is something like this already implemented.
    Please check WaterDataProvider for Crest and you will notice that there is code for querying water velocities.
    In short - if you are working with your own WaterDataProvider you just need to implement the function for getting velocities and set the values there. If you just need one velocity for the whole scene you can use the provided fill array function (you will be able to see this in some WaterDataProviders - fastest way to fill an array) and set the global velocity in one line for all objects in the scene.
     
  37. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    Thank you very much for your quick reply. Keep up the great work! Check out our work at https://www.morildinteraktiv.no
     
    Fibonaccov likes this.
  38. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    @NWHCoding I have a question I hope you can help me with; When I have a water object, and add a constant force in z-direction. It then reaches a certain velocity. If I increase the force10 times, the velocity also increases 10 times. Is this correct? From my understanding this resistance should not be linear - but I am not sure.
     
  39. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    There are a few factors:
    - As the boat speed increases it moves from displacing water to gliding over it. Especially if the boat is very light.
    - Default skin drag under WaterObjectManager is quite low.
    - There is no air drag. Use Rigidbody Drag field to approximate this. Somewhere in the area of 0.01-0.05, depending on the shape.

    So if you increase the force/speed enough at one point it will start pretty much flying over the water with only a small part of the hull touching. And lastly, it is an approximation - not a hardcore simulation - so a bit of tweaking of the settings will always be needed to get the feel you want.
     
    olavrv likes this.
  40. Deleted User

    Deleted User

    Guest

    Hi,

    We've currently have DWP 1 integrated on many objects. I would like to know will it take long to migrate DWP 2,
    since performance is very critical for us. It would be great to have some rough estimation for 1 vessel migration.

    Thanks in advance.
     
  41. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Hello,
    the assets are pretty much completely different. That said it depends on how many objects you have to (re)set-up. There is a wizard included that should speed things up or you could select all the objects you need to convert and batch modify them.
    The performance gains should be huge (500%+) due to multiple major changes such as usage of ECS-like approach and multi-threading. Also, number of water queries has been reduced three times meaning that if you use wavy water it will run even faster. The only downside is that you need to run WaterObjectManager.Synchronize() after adding an object (not removing) to re-allocate native arrays which can be expensive.
     
  42. _met44

    _met44

    Joined:
    Jun 1, 2013
    Posts:
    633
    Hello,

    Considering getting DWP2 and have a question i cant seem to find an answer to, really sorry if i missed it somewhere.

    Does it support runtime generation of boats ? meaning we dont know in advance the size or shape of the boat, so after assembling several objects into a boat we have the required API to specify at runtime floating points or whatever is needed to make it work.
     
  43. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Yes it does but there might be some issues if it is high poly. WaterObject script can use the original mesh from the MeshFilter to simulate the object or a simplified mesh. The algorithm for mesh simplification/decimation is not intended for runtime use so it would be best if the boat mesh did not have more than ~100 triangles so that the simplification is not needed.
    DWP2 does not use floating points but the mesh triangles so you would need to provide a mesh that represents the hull shape.
     
    _met44 likes this.
  44. _met44

    _met44

    Joined:
    Jun 1, 2013
    Posts:
    633
    sounds good, shouldnt be a problem to come up with a low poly version.

    thanks a lot for the information going to try it out!
     
  45. gamextar

    gamextar

    Joined:
    Jul 4, 2021
    Posts:
    9
    Hi, great asset but I'm having some issues with it. I'm not being able to use my own objects, they dissapear from the scene, I guess they just fall through the water. Tried with the included pins, rods etc and it works ok, but as soon as they touch the water they move for about 2 seconds and they stop, while in your demo they keep moving for a while. I use stylized water 2, latest version without waves. Tried enabling waves in SW2 but they don't seem to have any effect on the objects ( on the pins, rods etc)
     
    Last edited: Jul 20, 2021
  46. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Hello,
    make sure to call
    WaterObjectManager.Instance.Synchronize()
    after adding new WaterObjects to the scene. It is suggested to add all the objects that you need and then call the function since it is quite performance intensive due to the need to resize native arrays.
    If the objects stop bobbing or moving around too soon make sure to check the WaterObjectManager settings, especially the skin drag (lower = less friction) and dynamic force coefficient (lower = less impact force).
     
  47. gamextar

    gamextar

    Joined:
    Jul 4, 2021
    Posts:
    9
    Thanks for your quick response, Is there any way to get some side movement in a flat water plane so they don't look so static over the water ? thank!
     
  48. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    You could add some random forces to the object through Rigidbody.AddForce() or AddForceAtPosition(). Or maybe even better something such as a sine function to make them look as they are bobbing around. Or the combination of the two.
    Something like:
    Code (CSharp):
    1. rb.AddForce(Mathf.Sin(Time.realtimeSinceStartup) * rb.mass * 0.1f * Vector3.up);
    Just writing that off the top of my head but something similar.
     
  49. WizardingStudios

    WizardingStudios

    Joined:
    Mar 4, 2017
    Posts:
    13
    Hi, I would like to buy it immediately. However I need this water shader to work with it:

    The shader is so simple, can I ask you to insert it, working with a boat, in this awesome asset? I will buy the same day. Many thanks.
     
  50. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    From what I can see from the video there is a function that returns the water height at position meaning that creating a WaterDataProvider for it would just require copying one of the existing WaterDataProviders (e.g. the Lux one) and replacing the water height function call with the one for the asset above.