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

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)
    55.2%
  2. AQUAS

    15 vote(s)
    7.4%
  3. RAM

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

    6 vote(s)
    3.0%
  5. Ceto

    4 vote(s)
    2.0%
  6. SUIMONO

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

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

    7 vote(s)
    3.4%
  9. Other Water Asset With Waves

    29 vote(s)
    14.3%
  1. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    Update on the progress of the update.
    The next version will most likely be DWP2 since the code base was pretty much all rewritten. The reason for this is that everything is done inside a job (multithreaded) and there will be multiple API-braking changes. Also, performance on multi-core CPUs will be greatly improved. I am working on the development parallel with the game that will be using it and that is the reason it is taking more time than usual, but then again it is essentially a new asset so testing that it is getting in 'real world' will not hurt it.
     
  2. Bartolomeus755

    Bartolomeus755

    Joined:
    Jun 20, 2013
    Posts:
    283
    Sounds great, looking forward to the next version. ;)
     
  3. obstudio

    obstudio

    Joined:
    Sep 30, 2016
    Posts:
    58
    please add functions for start/stop engine etc similar like in car physics
     
    Bartolomeus755 and 3dship like this.
  4. Bartolomeus755

    Bartolomeus755

    Joined:
    Jun 20, 2013
    Posts:
    283
    Another great feature would be an (basic) fuel system. ;)
     
  5. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    Great ideas. I must say that the original intention of the asset was NOT boat physics package but rather universal asset for making things interact with water realistically. Still, demand seems to be high for ships, etc. so thank you for your suggestions.
     
    dsilverthorn and Bartolomeus755 like this.
  6. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    I bought this asset for a ship simulator as well, and I'll appreciate if you add more ship simulator features.
    And besides, I also bought Vehicle Physcis and I wish if you can refactor them to share the common components as much as possible. Thanks.
     
    NWHCoding likes this.
  7. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    835
    Will DWP2 be a free upgrade or a separate purchase?
     
  8. MrG

    MrG

    Joined:
    Oct 6, 2012
    Posts:
    363
    Also interested in the ETA for DWP2 and your plan for upgrading since DWP is on sale now.
     
  9. netpost

    netpost

    Joined:
    May 6, 2018
    Posts:
    388
    I interested in buying the asset and would like to know this too.
     
  10. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    To answer about the upgrade:
    It will most likely be a paid update and while I usually do not charge for updates, there will be only a few lines of code shared between the two and therefore it would be named DWP2. Still, the upgrade will be less than half the price of the asset itself. This means a lot of new code added, testing, etc.
    Also, doing a paid upgrade would enable me to spend more time on improving the ship simulator aspect of it which originally was not even a part of it, and other aspects of the asset. Still, I would like to hear the input from the customers about this.

    Also, I have just yesterday started full-time work on the update. The multi-threading aspect of it has been finished and objects float nicely and much better than in the previous version (not to mention that everything is done in a job which brings some crazy performance gains). This required a complete rewrite and a lot of work will be needed to re-implement all the other features. Also, since I have been working exclusively in Unity and developing a lot of projects since the original DWP was released - which is about 2 years now - I have also gained quite a lot of knowledge that I can't wait to apply to the asset.
     
    Last edited: May 5, 2019
  11. Vincent454

    Vincent454

    Joined:
    Oct 26, 2014
    Posts:
    165
    Sounds good! If I buy the asset on sale right now and then upgrade later, do I pay less than waiting for DWP2 and buying that, or would you recommend me to wait?
     
  12. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    The update is most likely going to be $9.99 so with the current price of DWP (50% off) you will save a few $ by doing an upgrade, rather than buying the asset at a full price later. Of course, if you first want to test DWP2 to see if you like it and not that worried about those few $ you can also wait.
     
    Efril and Vincent454 like this.
  13. netpost

    netpost

    Joined:
    May 6, 2018
    Posts:
    388
    The update price is more than fair. I already own Vehicle Physics and it is FANTASTIC so I see no reason to wait to purchase Dynamic Water Physics 1 while waiting for the DWP 2 update. I am buying today :)

    Thanks.
     
    NWHCoding likes this.
  14. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    Here is a preliminary performance torture test. Running water physics calculations on 1000 primitive cubes using standard Unity settings:

    upload_2019-5-5_18-21-34.png

    This equals 12,000 simulated triangles or roughly 200 ships with average CPU time of 6ms with only one function call and 0B of GC:
    upload_2019-5-5_18-24-19.png

    Since the scaling is almost perfectly linear this means that for 1200 tris or 20 ships CPU usage would be about 0.6ms per fixed update. I highlighted linear because unlike in the previous version DWP2 does not calculate water physics on per-object basis but rather gathers all data from all objects and processes them in a single job Schedule() call.
    Now, this has a challenge of managing adding new objects to the scene at run-time after things have been initialized but I am going to make this invisible to the end user as much as possible.
    So much from me for now, will update you with the progress.
     
  15. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    835
    I'm ok with that. I am glad you are telling us up front so we know, and I appreciate you doing that.
    I'll buy in now as your update fee is fair. I know you have to put a lot of work into it, so I'm glad to support you.
     
    Last edited: May 6, 2019
    NWHCoding likes this.
  16. Bartolomeus755

    Bartolomeus755

    Joined:
    Jun 20, 2013
    Posts:
    283
    Can't wait for the new update and I have no problem to pay an update price. ;)
     
    NWHCoding likes this.
  17. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    835
    I just picked it. Looking forward to testing and implementation.:D
     
    3dship and NWHCoding like this.
  18. cabanel

    cabanel

    Joined:
    Sep 22, 2014
    Posts:
    66
    Ciao uso United 2018.3.14 e voglio inserire Crest ( 9191cb0 il 6 mar) con Dynamic Water Physics (1.3.1) Ho seguito la procedura, e ho l'ultimo WaterInterface.cs

    [code = CSharp] figlio UnityEngine;
    usando Crest;
    using System.Linq;

    // CREST

    /// <sommario>
    /// Classe per il recupero dell'altezza dell'acqua in posizione.
    /// Collega questo script al tuo sistema idrico e imposta il tagoggetti su "Acqua".
    /// </ summary>
    [RequireComponent (typeof (OceanRenderer))]
    WaterInterface di classe pubblica: MonoBehaviour
    {
    private Vector3 position = Vector3.zero;
    altezza del galleggiante privato;
    private SamplingData samplingData = new SamplingData ();
    privato OceanRenderer oceanRenderer;

    vuoto privato Awake ()
    {
    oceanRenderer = GetComponent <OceanRenderer> ();
    }

    public float GetWaterHeightAtLocation (float x, float z)
    {
    position.x = x;
    position.y = 0;
    position.z = z;

    var rect = new Rect (posizione, Vector3.zero);

    provare
    {
    oceanRenderer.CollisionProvider.GetSamplingData (ref rect, 1f, samplingData);
    oceanRenderer.CollisionProvider.SampleHeight (posizione ref, samplingData, out height);
    oceanRenderer.CollisionProvider.ReturnSamplingData (samplingData);
    altezza di ritorno;
    }
    catch {return 0; }
    }
    } [/ Codice]



    mi dà questo errore:



    Asserzione non riuscita
    UnityEngine.Debug: Assert (booleano)
    Crest.GPUReadbackDisps: ComputeUndisplacedPosition (Vector3 &, SamplingData, Vector3 &) (in Risorse / Crest / Crest / Scripts / GPUReadback / GPUReadbackDisps.cs: 51)
    Crest.GPUReadbackDisps: SampleHeight (Vector3 &, SamplingData, Single &) (in Risorse / Crest / Crest / Scripts / GPUReadback / GPUReadbackDisps.cs: 137)
    Crest.CollProviderCache: SampleHeight (Vector3 &, SamplingData, Single &) (in Risorse / Crest / Crest / Scripts / Collision / CollProviderCache.cs: 66)
    WaterInterface: GetWaterHeightAtLocation (Single, Single) (in Assets / DynamicWaterPhysics / Scripts / WaterInterface / WaterInterface.cs: 35)
    FloatingObject: FixedUpdate () (in Risorse / DynamicWaterPhysics / Scripts / FloatingObject.cs: 204)


    Grazie
    Flavio
     
    Last edited: May 9, 2019
  19. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    835
    Testing- or trying to- with River Auto Material.
    I'm getting a bunch of errors from R.A.M. when I install DWP.
    RAM runs fines without DWP but does not work while DWP is installed. The create splines do not show up in hierarchy and errors are thrown on the Lake Polygon script.

    Has anyone else had any success with RAM working while DWP is installed?
    I'm going to try doing my creating of the river system and then installing DWP again, to see if they can work together at all.
    Using 2017.4.25

    Otherwise, DWP got quick integration with Aquas and it is working great there.:)
     
    Last edited: May 11, 2019
  20. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    Will check this but my best guess is that you are running CREST without floating origin on a large size map and running out of wave data / LODs. Does this happen all the time or only when getting far away from origin?
    Also, if you are using OpenGL (Linux/MacOS) CREST will throw a similar error as its compute shaders do not support OpenGL.
     
  21. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    Hello,
    Any specific errors you get when using DWP with River Auto Material? DWP uses its own namespace for the core scripts so it could be that the scripts from demo (of which some might not be in a namespace) could cause duplicate script errors. It would be great if you got a few errors to share - either here or at nwhcoding@gmail.com
     
    dsilverthorn likes this.
  22. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    835
    It was 16 of them
    All in RAM.
    I will set it up again and list the errors. I’ll try removing the demo and see if that is the reason. :)
    It is weird because of the naming conventions.

    Is there a way to get DWP to work with RAMs rivers? It does work on the lakes, but when I position a boat on the river, it just falls through to the ground beneath. Tried setting them with water tags and layers but it doesn’t work.
     
  23. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    If the river is not flat - which I assume it is not - there will be a need for WaterInterface for RAM which I have not yet done. In other words: you have to tell DWP where the water is or it will assume flat water plane with water height at water.transform.y.
     
    dsilverthorn likes this.
  24. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    DWP2 is coming along nicely. I have invested some time in a better editor (ignore the temporary banner):

    upload_2019-5-12_12-2-17.png

    Starting from top to bottom:
    - Instead of decimation percentage now there is a target triangle count field. This makes it easier to get the wanted triangle count on a dummy mesh.
    - Besides the In-Scene preview that was available in DWP, DWP2 also has an in-editor preview for quick look previewing.
    - Warnings area shows setup errors before the play mode is entered. Things like missing rigidbody, missing colliders and scale problems will show up as warnings or errors. This has been done in hope to prevent obvious setup errors which have happened even to me (rigidbody without a collider anyone?).

    Also, since all the computation has been moved into one place (WaterObjectManager), the settings have been moved too. Since DWP2 all the settings for all objects will be adjusted from one place:

    upload_2019-5-12_12-7-56.png

    Moving onto porting over the water effects from DWP1 and after that will come improvements to the ship simulator aspect as well as better integration with different water assets - especially CREST which seems quite popular lately.
    WaterInterfaces will be completely removed and instead Scripting Define Symbol will be used to enable each of the supported water systems.

    Now back to work :)
     
    Vincent454, 3dship and xDeveloper like this.
  25. obstudio

    obstudio

    Joined:
    Sep 30, 2016
    Posts:
    58
    One more suggestion. Consider putting all keys mapping in single file so it can be easier to redefine.
     
    NWHCoding likes this.
  26. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    835
    Yes. That would be the problem with the rivers.

    But it would be cool to be able to, for instance, ride a barrel over a waterfall.:)

    For now, I'll just do the flat rivers and have the waterfalls and streams running into the flat river.
     
    NWHCoding likes this.
  27. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    835
    Question: I am only just getting to testing now, but loving it...

    Can water current move objects down a river?
    Or simulated so so they can bounce around rocks or side of riverbank, etc. using the terrain/mesh colliders to redirect the motion?
    Like a raft that moves on its own and you only need to change directions?
    As well as debris that will move down the river on its own?
     
  28. gyl09

    gyl09

    Joined:
    Jul 21, 2017
    Posts:
    9
    Hi,
    in the description of the asset you said "Uses dummy mesh simplified by the built-in algorithm meaning high-poly objects do not affect performance.". Is it built-in from your asset? Or something in Unity (when you check the option convex for instance)?
    If it's a feature included in your asset ,does it produce concave mesh compatible with Unity constraints (convex required for non kinematic rb)? Or do I need to create manually a composite set of collider to approximate the shape?
    Thank you.

    EDIT: Just see your screenshot of DWP2, and see the button "Generate Dummy mesh" so I have my reply for the first part of the question ;-)
     
  29. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    Everything you need is included in the asset. Of course, if you want more control you could always use Blender to create the shapes but the included decimator has both options for reducing the number of triangles and making the mesh convex. The libraries used for this will stay the same for DWP2 as they proved to be quite robust so far.

    Now, the collider has nothing to do with DWP. You can use any shape of the collider you want. The dummy mesh is just a visual representation of the data passed to the water physics section and you could use a box collider on a sphere-like mesh and it would not care. Colliders are not used at all by DWP (except for the fact that rigidbodies require them to work, but that has nothing to do with DWP).
     
    gyl09 likes this.
  30. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    FloatingObject (or WaterObject in DWP2) is moved around ONLY using rigidbody.AddForceAtPosition() and therefore it will interact with the environment just like any old regular rigidbody would.
    As for water current - if you can get a vector for the current (its direction) - you could just add one more force to the rigidbody in the direction of the current.

    EDIT: You just gave me a great idea. I will implement current calculations directly into the algorithm for DWP2 so people can set a single vector for each WaterObject and the rest will be calculated by the physics algorithm. This will be better than the method above because it will take into account geometry of the object in the current.
     
    dsilverthorn likes this.
  31. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    835
    Awesome!

    Here is a scenario, you are building a town, so you take your boat up river and do some logging, you cut down trees and push them in the river. Then the logs float away, while you continue chopping trees.
    When done, you jump in your boat and head down the river to collect your logs to build your town. ;)
    Just a little idea that just came to me.

    I'd also like to go over a waterfall.:D
     
  32. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    Seemed like a sound idea until you got to the waterfall part - and not from the aspect of the asset but from the aspect of staying alive :D
     
    Vincent454 likes this.
  33. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    835
    A little too adventurous I guess:rolleyes:
     
  34. MrG

    MrG

    Joined:
    Oct 6, 2012
    Posts:
    363
    NatureManufacture has said that buoyancy is coming to RAM, and I'd expect the flowmap would also apply flowing current forces to floating objects.
     
    dsilverthorn likes this.
  35. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    835
    Keeping my fingers crossed!
     
  36. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    A short update on the progress.
    The water part of the asset is pretty much done. I have spent last two days optimizing and tracking bugs and now it is where I want it to be. The job system allowed for more complex processing resulting in increased realism and stability which really shows when there is a small number of triangles or triangles with large areas.

    Next on the schedule is integration with different water assets, and the ship controller after that.

    If you have any ideas for the ship controller, what you would like to see, etc. now is a great time to mention it.
    Already got a request for engine start/stop and improved input handling.


    upload_2019-5-17_11-54-36.png
     
    Last edited: May 17, 2019
    dsilverthorn and 3dship like this.
  37. obstudio

    obstudio

    Joined:
    Sep 30, 2016
    Posts:
    58
    1. Integration with Rewired
    2. Anchor - that prevent boat from moving even on full throttle - something like neutral gear
    3. Close everything in single namespace
    4. Emergency Ascent for submarine
    5. Method for activating/deactivating ship/boat
    6. Method for vertical movement of submarine with received input instead of only SetDepth
     
  38. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    • Variety of Sinking mechanism's eg normal sinking, bow/Stern sinking and port/starboard roll over.
    • Drag based on hull amount in water.
    • Support for float planes.
    • Roll based on speed/rudder position.
    • Reverse effect of ship ploughing into water due to hull shape for flat hulls at rear.
     
  39. cabanel

    cabanel

    Joined:
    Sep 22, 2014
    Posts:
    66
    sembra esserci un problema con Crest,
    questa è la versione del tuo esempio che mi hai inviato (DWP_CREST_TEST) quando aggiungi una sfera con lo script RegisterSeaFloorDepthInput
    Ti ho mandato una mail con l'esempio
     
    Last edited: May 17, 2019
  40. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    I am not the author of Crest and do not know why this would be happening. I would recommend reporting it as a bug over at the Crest git repo.
     
  41. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    Thanks for the ideas.
    1. Will not be directly implemented since that would require people to buy Rewired but there will be a single file for assigning all the inputs so it will just be a matter of replacing standard input code with Rewired code.
    2. Great idea. Added to TODO.
    3. Already done (for DWP2 that is)
    4. Submarine definitely needs more love. Combined with 6. I will actually implement submarine ascent / descent as an axis (more input = faster)
    5. Added to TODO.
     
    zyzyx likes this.
  42. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    Hello and thank you for the ideas:
    • Sound good, sinking needs some love for sure. It seems to be in quite a high demand.
    • Already implemented. You have to be aware that DWP is entirely geometry-driven so the shape of the boat is the one that dictates this.
    • Float planes are not physically possible since by definition float plane would have 0 height meaning 0 volume. Combine that with mass and you have infinite density. What you can do is squish the cube to a small thickness. DWP1 had some problems with large cubes due to calculation inaccuracies (due to performance reasons) but it has been solved in DWP2.
    • See 2). Can be achieved by simulating the rudder itself as a floating/water object too. Check the racer example and the rudder setup there.
     
  43. cabanel

    cabanel

    Joined:
    Sep 22, 2014
    Posts:
    66



    in the crest example it doesn't happen, only with the version you sent me (last compatible)

    this last crest



    this is your have send me
     
  44. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    I have just sent you that scene so you can see the setup. You can use the newest version of course.
    In case you missed the email with the newest WaterInterface for Crest I attached it to this message too.
    DWP2 will do away with WaterInterface so hopefully less confusion on that front.
     

    Attached Files:

  45. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    Expect a minor update in a day or two for DWP1. The included WaterInterface is for Crest 5 and needs to be updated due to Crest 6 and up having different API. In the message above is the correct script which will be added in the update.
     
  46. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    DWP1 does not require a specific version but DWP2 will require 2018.4 (LTS).
    I have just tested with 2000 primitive cubes stacked in a 10x10x20 shape and getting 120-140 FPS with about 6-8ms of CPU time for the scene and 0B of allocation, with all water objects being active and simulated. Due to the way caching is implemented inside DWP2 it is cheaper to run one object with many triangles than multiple objects with a small number of them as the job data still needs to be populated. Might I as why you need so many objects at the same time? Just curious.
     
    Last edited: May 17, 2019
  47. cabanel

    cabanel

    Joined:
    Sep 22, 2014
    Posts:
    66
    this update will be important to me
    thank you
     
  48. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    835
    5. Method for activating/deactivating ship/boat:)
    a method to switch to first/third person character on board- deactivate controls.
     
  49. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    835
    "Drag based on hull amount in water."
    Drifting with simulated current for when stopped to make it more difficult to stay in a spot, like for dive locations, etc.
    or for a raft adrift after a sinking.
     
  50. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,685
    This will be covered by the fluid velocity that I am working on at the moment. Some assets offer flow maps (Crest, for example) which can then be applied to the objects. DWP2 uses this info for physics calculations.
     
    dsilverthorn likes this.