Search Unity

FFT Ocean Water System

Discussion in 'Works In Progress - Archive' started by Aquaminator, Jul 13, 2018.

Thread Status:
Not open for further replies.
  1. Aquaminator

    Aquaminator

    Joined:
    Aug 3, 2016
    Posts:
    18
    Hello there,
    unfortunately, according to the fact that many promising realistic water systems for Unity, which I have bought
    (and spent a lot of money on), are deprecated one by one, I have decided to develop my own.
    (hoping to finish my game someday, which makes strong use of water simulations)

    A prototype already exists (not yet in Unity and also without shaders, but first I was only interested in the wave motion). This water system is programmed with Processing (Java) and is based on a modified Phillips Spectrum for more control over the waves and their direction. The example uses my own FFT routine that has not yet been heavily optimized at this moment.

    Here is a Youtube link:


    You are welcome to write me what you think about it. The next planned steps are the implementation in Unity with shaders. Many Thanks.
     
    Last edited: Jul 13, 2018
  2. sadicus

    sadicus

    Joined:
    Jan 28, 2012
    Posts:
    272
    Good luck to you! I will be using Unity 5.6.5, so if you need any feedback, link a file.
     
  3. sebastiansgames

    sebastiansgames

    Joined:
    Mar 25, 2014
    Posts:
    114
    Looks amazing!
     
  4. AurimasBlazulionis

    AurimasBlazulionis

    Joined:
    Aug 13, 2013
    Posts:
    209
    Looks great! I suggest looking into Campo Santo's blog how they did all the shading and water interaction. It looks interesting.
     
  5. norby

    norby

    Joined:
    Jul 10, 2006
    Posts:
    277
    Look great, keep up the good work :)
     
  6. prduquesne

    prduquesne

    Joined:
    Mar 12, 2018
    Posts:
    14
    This looks amazing! Il be recommending this.
     
  7. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Good luck with the project. I hope it ends for all the beneficiaries.

    regards
     
  8. cs747

    cs747

    Joined:
    Jul 14, 2018
    Posts:
    36
    Looks beautiful. Nice work!
     
  9. Deleted User

    Deleted User

    Guest

    Its a very good first effort. Well done. There is no spray or foam but the dynamics look quite well done. I imagine you have values for roughness of ocean or calmness? If you do get it on the app store quick - so you might make some money.

    Meanwhile, my Q - I am after an ocean effect. Do you have day and night (inc moonlight on waves)? and more importantly can you rig the camera for 2D looking top down? Need to see it from birds eye view.

    Thank you,
     
  10. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Good luck. It looks promissing. Please, just keep in mind the communication with your followers. Even if you don’t want or can’t keep working on this, just let us know what is happening.

    Best regards.
     
    ftejada likes this.
  11. Aquaminator

    Aquaminator

    Joined:
    Aug 3, 2016
    Posts:
    18
    Thanks to everyone for the great feedback. While I'm converting the project to Unity (it's a lot of work ;), here's a little video by changing some parameters that contribute to the representation of the waves.

    (@RamZada: by the way - the top-down view and day-night lighting has nothing to do with the Ocean-Object directly. These things are controlled by the camera-object and the lights in the scene. The Ocean-Object should be treated like any other 3D-Object in Unity can.)

    Until then - If any questions arise, don't hesitate to ask them.

     
    Lahcene, twobob, ftejada and 5 others like this.
  12. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    256
    This is an amazing and very realistic work! What is in the To-Do list?
     
  13. Deleted User

    Deleted User

    Guest

    Hi Aquaminator.

    What i meant was can you position the camera top down for me. I realise looking at your video youve done it at 1:46min. It looks pretty good.
     
  14. Aquaminator

    Aquaminator

    Joined:
    Aug 3, 2016
    Posts:
    18
    Hi there,
    the first version is running now in Unity, but it's still very slow - less than half of the frame rate than in Processing.
    Why, that what's I still have to find out, but I'm working on it ;)

    @RamZada: therefore I've shown that :)
     
    Deleted User likes this.
  15. sadicus

    sadicus

    Joined:
    Jan 28, 2012
    Posts:
    272
    Keep in mind, I am not a code person so, comments are meant to be constructive! The video reminds me of Maya Fluid Dynamics, very jiggly and the foam static, Is there a way to animate and sync the UV with the Wave direction?
    Perhaps this is something you are already aware of and is on the roadmap. What are the Ocean requirments for the game your making? For me, I mostly need a working underwater.

    FEATURE REQUEST

    1. Surface
      • Script to change weater (UniStorm, TrueSky, etc.)
      • waves / wakes / Phosphorus (glow) night foam or Decal / Buoyancy
      • Realistic reflections / blur
    2. Underwater
      • depth based darkness
      • depth Based Under water Caustics
      • realistic underwater fog distance control
      • particle detritus / surface decals
     
  16. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    In addition that, what often seems to be requested in other water systems is (as far as I observed)...
    1. Ability to query the water height, in order to implement proper buoyancy
    2. Shoreline
    3. Water flow direction
    4. Ability to add effects to the water, like raindrops and the wake caused by moving water objects
     
  17. 3dship

    3dship

    Joined:
    Jun 17, 2017
    Posts:
    7
    Looks very realistic, good work !
     
  18. Deleted User

    Deleted User

    Guest

    Aquaminator

    Perhaps you can look at my water - specifically this problem which i am having with water, or in this case WaterShaders.

    Did you get this same problem exporting your water to Unity as i am having with my water?

    https://forum.unity.com/threads/imp...-ocean-ripples-grey-plane-is-imported.540544/
     
  19. Aquaminator

    Aquaminator

    Joined:
    Aug 3, 2016
    Posts:
    18
    Hello, I've uploaded a few videos to show the current state

    own shader, but until now only Fresnel effect implemented


    pure Phillips Spectrum with real-time foam, rendered using the Unity Standard Shader


    modified Phillips Spectrum with real-time foam, rendered using the Unity Standard Shader


    @RamZada: it's not that easy to say anything about it just looking at the image - maybe something is not quite right with the surface normals (or the scaling is just too small)
     
    Last edited: Jul 23, 2018
  20. norby

    norby

    Joined:
    Jul 10, 2006
    Posts:
    277
    Great work, I hope you are able to work this out. It seems creating an realistic ocean is one of the hardest things to achieve unity.
     
  21. Deleted User

    Deleted User

    Guest

    Aqua will you sell this in the Unity store when complete?

    Please disregard screengrabs size they are just taken to upload the main problem. Which is a grey plane. It seems the fbx export leads to a grey plane. Unity does not recognise the ocean shader in Maya 2018. So i have a ocean with mathematical data used for the waves/foam/etc which i input and works perfectly in Maya. Export as anim and fbx model.

    Reload into Unity and i get a grey plane. Almost like GameComponent>Create3DObject>Plane.

    It seems Unity does not know what do with the export so imports it in as a default greyscale shape.

    The water is stunning in Maya. High Res and very realistic.

    Without deterring your fine effort. Go for it.

    GameDev is like that. Finding swift solutions to problems in game.
     
    Liminal-Ridges likes this.
  22. Aquaminator

    Aquaminator

    Joined:
    Aug 3, 2016
    Posts:
    18
    If I somehow manage to develop a "salable" version then I will also think about to offer it in the Asset Store. But until then there are still some hurdles to overcome. But of course it would be nice if everyone who is interested in seeing my ocean in the asset store, leaving a short note;)

    For now, here are some new videos that shows work in progress.


    @RamZada: how many vertices does your mesh have - in Unity, before Version 2017.3 there was a limit of 65535 Vertices per Mesh, because Unity used only 16 Bit for the index. Maybe that's the problem. Since Version 2017.3 you can use the new 32 Bit index format, but you have to change it manually (default is further 16 Bit).

    I'm currently busy dealing with it myself, because of course that would be more beautiful for an ocean mesh like a 16 bit limit, where you have to take care of the division in submeshes, etc. ;)

    By the way, I've seen that there is a free fbx exporter (importer?) in the asset store, maybe thats an option for you to try: https://www.assetstore.unity3d.com/en/#!/content/101408
     
  23. Vincent454

    Vincent454

    Joined:
    Oct 26, 2014
    Posts:
    167
    I'd definitely be interested to buy it, price does not matter if it has features that other ocean systems dont have, for example: Shadows on water (really important), underwater effects (seamless camera transition to underwater would be absolutely fantastic, similar to how it is in dying light http://i.imgur.com/kQXDba4.jpg), shorelines, volume culling, as well as the things sadicus mentioned. The asset store really needs an "ultimate" water asset!
     
    Liminal-Ridges likes this.
  24. Bartolomeus755

    Bartolomeus755

    Joined:
    Jun 20, 2013
    Posts:
    283
    Looks great so far, I'm also very interested to see it on the asset store. Also great would be to have this with bow and stern wave emitters for watercrafts. ;)
     
  25. Napoleon_Blownapart

    Napoleon_Blownapart

    Joined:
    Jun 22, 2016
    Posts:
    2
    WOW! Fantastic work. I saw your newest video with the large swell waves. Looks very nice. I was wondering - you are using some type of SIN graph to create them. Perhaps it would be possible to get a depth value from a ray-cast or other method and it would effect the wave shape. AS SEEN HERE I think that would create the most realistic coast lines of any water sim. The waves might not break - but adding foam and spray would really sell the effect.
     
  26. Aquaminator

    Aquaminator

    Joined:
    Aug 3, 2016
    Posts:
    18
    ... yes, I'll try to implement the whole desired functionality (but I do not want to promise anything too soon) - on the one hand, because of course they are important for a realistic ocean representation and on the other hand because I would like to have them myself in my game ;)

    already finished (or at least almost):
    - Realistic reflections
    - Water flow direction
    - Foam

    (optimistically planed) todo-list:
    - ability to query the water height, in order to implement proper buoyancy
    - depth based darkness
    - depth Based Under water Caustics realistic underwater fog distance control
    - bow and stern wave emitters for watercrafts
    - shoreline
    - particle detritus / surface decals
    - ability to add effects to the water, like raindrops
    - spray
    - script to change weather

    - possibly also precalculated animations to save computing power, since I have also built-in that the wave motion is repeatable and the time/frames untill the repetition can be chosen freely (I have still to think about how it is the the best way to store, so that the generated files are not getting too big ;)

    @Napoleon_Blownapart: these types of waves (and also the Water flow direction) can be generated by the various parameters of the modified Phillips spectrum (and yes - to say it simplyfied, in the end, it is a huge number of weighted SIN and COS functions that produce this spectrum)
     
    3dship, John-G, Funkeys and 3 others like this.
  27. pat_trick

    pat_trick

    Joined:
    May 23, 2016
    Posts:
    27
    I would be interested in this asset if 1) It supports VR rendering (stereoscopic views), and 2) Isn't abandoned in 8 months like PlayWay and UWS were.
     
    twobob and CaptainMurphy like this.
  28. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Good water is hard to do well, that's just the core forget all the extra features like particles and such. Try to please different groups like VR vs high end water for PC, it won't work. You won't be able to maintain it and it will become yet another deprecated water asset.

    My advice stick with what interests you the most and just do a really good job at making that work well.

    Plus you just have some minimum bars now days, like waves *must* be on the gpu and you need to understand the type of cpu budget people actually have available for water.
     
    twobob, Funkeys and one_one like this.
  29. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    I agree with @snacktime on pretty much all counts. Water systems/shaders seem to have had a particularly high rate of abandonment. But it's also a trend that can be seen with other assets: A couple of users demand integrations with a ton of other assets and/or additional features, the scope explodes, the code is getting messy and maintenance becomes a headache.
    I also agree with the 'stick with what interests you' sentiment. It is likely that selling on the asset store is not going to be super-profitable. If you take that into consideration and focus on the aspects that are most relevant to your own projects and/or interests and just put the extra work in to also let other people use it easily, it's likely for everyone's best. I'd argue that such an approach leads to a higher quality asset as well as a happier asset dev who is less likely to abandon it.

    However, I'm not sure I agree that the wave calculations must run on the GPU. There's certainly GPU implementations for FFT, but I'm not sure whether it ends up being much faster (especially with ECS and jobs), especially considering that there are likely benefits for the game logic side of things when computing wave geometry on the CPU. Either way, this is pretty much a 'hard facts' engineering question which you'll probably settle yourself anyway with a couple of tests.
     
    Funkeys likes this.
  30. Rycons

    Rycons

    Joined:
    Nov 23, 2013
    Posts:
    31
    I would be interested in an asset like this. Personally, I would prefer a water asset that scopes much lower than what the current "ultimate" water assets have already tried but has well-written code so that it is easier to maintain especially when implemented in large projects. We also went through the implementation of triton/ceto/playway water and UWS so we can understand the need for a water asset that is easy to support.
     
    Napoleon_Blownapart and one_one like this.
  31. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    256
    Any updates?
     
  32. Aquaminator

    Aquaminator

    Joined:
    Aug 3, 2016
    Posts:
    18
    Hi,
    there are already some updates, but everything is not ready to show - since I had exam phase at the university, I could not work so much on it. But definitely more soon ... ;)
     
    Last edited: Sep 22, 2018
    Idruna, ftejada, 3dship and 4 others like this.
  33. Aquaminator

    Aquaminator

    Joined:
    Aug 3, 2016
    Posts:
    18
    Hello, here's a new video that shows some updates.
    FFT size is now 256 points (in the previous videos it were "just" 128). The wave motion was precalculated and repeats itself after 10 seconds (this time is adjustable). The stored data for this are 300MB large, but it saves CPU or rather GPU utilization (that's a good compromise, right? - Nevertheless, I will also realize the calculations using compute shaders ;). The algorithm for the foam calculation was also reworked (I think it looks a lot better now - the texture is of course interchangeable). What do you think about that?

     
    Lahcene, Kaen_SG, Elecman and 5 others like this.
  34. pat_trick

    pat_trick

    Joined:
    May 23, 2016
    Posts:
    27
    This looks great! I will have to test it in VR to see if it renders stereoscopic correctly.
     
  35. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Looks great. Try it out in HDRP.
     
    Lahcene likes this.
  36. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    256
    Amazing visuals, try it in HDPR as said above
     
  37. Bartolomeus755

    Bartolomeus755

    Joined:
    Jun 20, 2013
    Posts:
    283
    Looks great, amazing work!
     
  38. eatsleepindie

    eatsleepindie

    Joined:
    Aug 3, 2012
    Posts:
    355
    This is exactly the water system I have been searching for! Excellent work and I'm looking forward to future updates on your progress.
     
  39. Aquaminator

    Aquaminator

    Joined:
    Aug 3, 2016
    Posts:
    18
    Hi, here some small but impressive updates (at least I think so).
    With new calculation of the surface normals, subsurface scattering effect and further extensions to the foam system.
    I have also tried the HDRP, but the results were not as good as expected - have to see what else you have to configure there - but I think the current shader comes close to what I imagined ;)
    So have fun watching it and as always write me your opinion ...

    By the way - it's best to open with Chrome to see all the quality options

     
  40. norby

    norby

    Joined:
    Jul 10, 2006
    Posts:
    277
    Wow Wow , this is really nice.
    impressive work

    Norby
     
  41. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    256
    This is getting better with each update. Visually the best one hands down.
     
  42. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    We are in the same position.

    Our requirement for purchasing another ocean asset would be:

    • Single pass stereo VR support (must have)
    • Subtraction volumes for boat interiors (must have)
    • Hull wake/foam support (nice to have)
    • Fog/horizon haze support (nice to have)
    • Performance options (nice to have)
     
    ROBYER1 likes this.
  43. Bartolomeus755

    Bartolomeus755

    Joined:
    Jun 20, 2013
    Posts:
    283
    That looks really amazing, can't wait for this one. ;)
     
  44. SCMcArthur

    SCMcArthur

    Joined:
    Feb 24, 2014
    Posts:
    5
    With the exception of VR support, those are all the things that I'd look for in an ocean asset too.
     
    Bartolomeus755 likes this.
  45. fatality674

    fatality674

    Joined:
    Nov 1, 2012
    Posts:
    24
    Really cool to see this in progress. I'm in the same boat as you in regards to buying water assets. I have been burned a few times.

    If you want my advice with it, people have so many different needs when it comes to water systems. Trying to please everyone will be impossible and will inevitably end up with a lot of scope creep if you try to cater to them.

    Have a good idea of what capabilities you want the ocean to have and stick to it.

    Some people just want an ocean they can drop in a game for visuals, some people want beaches, some people want a physics-heavy approach (myself!) for simulation etc.

    I think UWS failed because they wanted to appease everyone and ultimately fell short on all fronts. Same with Ceto.

    Work out what type of water asset is within your scope and focus on that.

    Good luck with the project!
     
  46. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Looks great. Good luck with this!
     
  47. digimbyte

    digimbyte

    Joined:
    Jun 23, 2012
    Posts:
    58
    I'm keen on trying this, I'm after a semi realistic water with acoustics, depth effects, and buoyancy where items float in place (sort of) pretty much everything UWS had but with muliplayer compatible with syncronious low latency solutions
     
  48. Bartolomeus755

    Bartolomeus755

    Joined:
    Jun 20, 2013
    Posts:
    283
    I hope it's still in development, this water asset looks really promising!
     
  49. CGBull

    CGBull

    Joined:
    Feb 12, 2017
    Posts:
    82
    Excuse me. How can i calculat this fome of video11?
     
  50. Pourya-MDP

    Pourya-MDP

    Joined:
    May 18, 2017
    Posts:
    145
    It has the potential to become the best water system in store
    I really mean it
    And im one of the buyers
    Anyway any update on it bro? @Aquaminator
     
    Liminal-Ridges likes this.
Thread Status:
Not open for further replies.