Search Unity

PlayWay Water - high quality water system

Discussion in 'Assets and Asset Store' started by zuzzu, Oct 9, 2015.

  1. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    I'm proud to present a water system that I've been developing for games at PlayWay for the last few months. It took many nights and caffeine drinks to complete it in parallel to the game projects I've been working on, but here it is.

    I'm doing some final polishing right now, before I'll submit it to the Asset Store this weekend. I hope that some of you will find it useful during your everyday work.

    upload_2015-10-9_6-57-57.png

    Waves simulation
    Simulation is based on the recent oceanographic research and is very convincing. Fast Fourier Transform is used to simulate tens of thousands of waves in realtime, while Gerstner Waves sampled from the same spectrum are used as a fallback.

    Weather changes at runtime are fully supported.


    Shader
    Based on Unity 5 Standard Shader, but heavily improved for the fluids. New features include improved microfacet model that takes waves smaller than a pixel into its formula. This ensures that water will look good at all angles and distances. It's sharp from up-close and completely smooth at the planetary perspective.

    Another notable feature is ray-march based, volumetric lighting. When viewed from above of water it is seen as a subsurface scattering, but when viewed from the underwater it makes the effect of "dancing lights" and dark depths.

    Some more self-explaining and common features include tessellation, planar reflections, refractions and reflection probes support.

    upload_2015-10-13_10-41-44.png

    Foam and spray simulation
    Foam is self explaining. Spray is simulated with particles on GPU and appears when wave gets too big and breaks. Compute shaders are involved.

    Hardware requirements
    Adapts to the target hardware and works with all shader models. It's done fully automatically so change your build platform in the Unity settings and you are good to go.

    Mobile devices support is currently a beta, but I've had it running pretty well on few devices including iPad 2. Possibly you've heard about its infamous fillrate. Please let me know of any issues, I'm willing to put my work into fixing compatibility issues on mobile platforms over time.

    upload_2015-10-9_7-3-23.png

    Physics
    Very realistic, multithreaded and has minimal impact on performance. Period.

    I've simulated 1500 objects using it without noticeable performance hit. Computes drag and buoyancy forces. Computations are done only if necessary.

    Profiles support
    You may create water profiles in your assets library and interpolate between them at runtime. It improves productivity and separates the artist workflow.

    upload_2015-10-9_7-27-38.png

    Integrates cleanly into rendering pipeline
    Supports forward and deferred rendering mode and writes correctly into the depth buffer in both of them. Supports all image effects I've tested including standard assets ones and SCION.

    The only artifacts that I'm aware of are transparent objects submerged completely in water. I have some ideas to solve it in the future though.

    Volumes
    This one is pretty cool and I plan to create a dedicated video to demonstrate some of the possibilities that it puts in your hands. You are not limited to simulate endless seas. You may create a puddle or just a glass of water and define it's volume with colliders (including convex meshes). Physics will respect that and no fluid forces will be applied outside. Underwater image effects will also be applied only within the volume.

    It may also work in the opposite manner. You may create subtracting volumes which will remove water from their insides. It is a must have for ships and boats, but it also works for fully submerged objects like submarines or underwater bases. Best of all - it correctly renders the transition between air and water that may be visible through transparent objects like windows inside ships or all over the glass in underwater bases.

    Volumes.gif

    Underwater image effect
    Applied correctly in transition between air and water. Makes distant objects blurry and makes them fade away in a physically correct manner. Environment gets darker at the depth. Automatically applies underwater audio effect.

    When you get your camera out of the water a "wet lens" image effect will be applied for some time.

    Plans for 2015
    Some of this is already in progress. Research already done.
    • Caustics,
    • Marine snow,
    • Shoreline waves,
    • Dynamic waves and foam created by physics,
    • Mobile platforms out of beta.

    Additional assets
    Asset bundle will also contain a few additional PBR assets:
    • Galleon,
    • Boat,
    • Seagull with 3 animations,
    • Pontoon and lifebuoy.

    Other stuff
    Network water synchronization component is provided. You may define a seed for the water to make it predictable in cutscenes etc.

    Water may be rendered using one of built-in primitives: radial, projection or uniform grid. Custom meshes are also supported and useful for small lakes, puddles etc.

    Full source code included. All scripts are written in C#.

    Links:
    Asset Store
    Web Player (Weather Demo)
    Web Player (Galleon Demo)
    YouTube - Galleon Demo
    Documentation
     
    Last edited: Nov 24, 2015
  2. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,131
    Looks fantastic!
    Would it also look so good for very smal waves like on a small lake?
    I´m doing ArchViz....
     
  3. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    Thank you ;)

    Yes, one of our teams has used it for a lake in their game. I will post some more screenshots soon.
     
  4. Gozdek

    Gozdek

    Joined:
    Jun 21, 2015
    Posts:
    356
    It looks very, very, very nice!
     
  5. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Yup, Ill be watching for this one. Any idea on what you will be asking for it?
     
  6. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    Thanks. The introductory price will be 109$.
     
  7. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,184
    Wow! Just wow!

    That is some really AAA water here.
    Put in the shore line waves and we are good to go.

    edit: a demo with an fps counter would be nice, so we could test the performance.
     
    theANMATOR2b and Cascho01 like this.
  8. SAOTA

    SAOTA

    Joined:
    Feb 9, 2015
    Posts:
    220
    Where did this thing pop up from!! Nice.
     
  9. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,131
    Bump
     
  10. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    Sure ;) I will build a web player with the galleon demo (the one on video) during this weekend. The recording was done with high settings on decent graphics card (GTX 960) at 54-60 FPS. On dx12 it's a lot faster (70-80 fps), not sure why.

    There is a noticeable drop in FPS during the weather transition in demo, but according to the profiler it's caused by Unity's Environment.UpdateGI. It shouldn't be a problem with Time of Day and other weather systems.

    Thank you all for the kind words.
     
  11. b4c5p4c3

    b4c5p4c3

    Joined:
    Jan 4, 2013
    Posts:
    537
    It looks pretty cool
     
  12. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,131
    The very best in my eyes would be a switch to disable/enable only the water and then compare the framerate.
    This way we could exactly determine how fast it renders!
     
  13. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    I plan to add quality settings gui to this demo. Such option sounds like a good fit to it, sure.

    It's actually lighting fast, it has started as a mobile project. Settings on the video are a bit of overkill. Here is how it looks on low settings running at 420 fps:

    upload_2015-10-9_11-26-39.png
     
    wolfen231 likes this.
  14. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Wowzuh. Hmmm. Ill need a demo for that one then HAHA. No offense, the shots are great, but I certainly would want to be able to see it in action in a web player demo or something. =)
     
  15. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Yeah, even them low settings look pretty darn good. Will it support ES2? If so how does it look on ES2 devices? Water can be a bit tough with ES2 to make look great.
     
  16. Devision4

    Devision4

    Joined:
    Jan 12, 2013
    Posts:
    1,329
    When do you release it?
     
  17. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    Yeah.. should run on most of them, but it will look like Unity's water4.

    Next week.
     
  18. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Ahh yeah, well at least you are making it simple to set up. If you post the manual that would be even better than a demo. I like to see "how" something is set up and what all that entails to use it before I make a purchase. I can also tell from that if it will conflict with any of my other things.
     
  19. nosyrbllewe

    nosyrbllewe

    Joined:
    Oct 18, 2012
    Posts:
    180
    Looks really great. I might have to pick this one up.
     
  20. Plutoman

    Plutoman

    Joined:
    May 24, 2013
    Posts:
    257
    Oh this looks neat. If you get dynamic, physics based waves - just from a player walking through the water, for ex - I would definitely pick it up at almost any price.
     
  21. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    I will post manual and demo later today or tomorrow. Got a small delay, but nothing to worry about.

    I've found a way to improve water on old SM 2.0 mobiles. Not all devices will handle it performance-wise, but most should. Looks pretty nice, especially in motion.

    upload_2015-10-12_13-10-45.png

    I've also added global water quality settings. It is imitating Unity's quality settings GUI for the ease of use. You may see it on the right side of screenshot below. It is completely optional and, if you like, you may set the same parameters (and some more) with your scripts.

    upload_2015-10-12_13-4-56.png
     
    theANMATOR2b and elias_t like this.
  22. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    That's pretty cool on the quality settings. Also the sm 2.0 looks great too. Nice work!
     
  23. KingLlama

    KingLlama

    Joined:
    Jul 18, 2015
    Posts:
    180
    This looks beautiful. Posting to wait for it to be submitted.
     
  24. Reiner

    Reiner

    Joined:
    Dec 2, 2012
    Posts:
    211
    looks very nice :)
     
  25. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
  26. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,184
    Nice!

    Any ETA for shorelines?
     
  27. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    Probably this month. That's on top of my list.
     
  28. SAOTA

    SAOTA

    Joined:
    Feb 9, 2015
    Posts:
    220
    Beautiful.
     
  29. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,131
    The shots are great!
    Is it true that I don´t see any repetetive patterns/waves? Would be GREAT!
     
  30. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    Yes, that's something that shader takes care of. Patterns on waves and foam should never be visible, unless some crazy settings would be used.

    On the shots there is still a slight pattern produced by volumetric lighting, but I'm going to fix that today.
     
    AdamGoodrich likes this.
  31. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,131
    I meant visible tiling of used textures:
     
  32. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    Yeah, it won't be a problem for water.

    If you ask about terrain then I've mixed four textures to make it less pronounced. I think that there are also some shaders in the asset store which use perlin noise to solve the problem.
     
    SAOTA likes this.
  33. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
  34. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,131
    No I meant the water, but now it´s clear to me that there´s no visible tiling to worry about :)
     
  35. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    This looks great... What about the water's edge, edge-foam/spray, and underwater caustics?
     
  36. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    Edge blending is there. Foam on edges not, but is high on my list.

    Underwater caustics should make it there later this year. I've already did one implementation, but decided to not publish it and use some other method later.

    Edit: You may be sure I'll add it though, as it is a must-have in one of our most important games.
     
    Whippets likes this.
  37. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    Web player is online ;) Check it out.

    Submission to the Asset Store is also on its way. Afaik it may take a week or so for Unity to process it so please be patient.
     
  38. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,184
    Houston, we have a problem:

    Untitled4.jpg Untitled2.jpg Untitled1.jpg Untitled5.jpg Untitled3.jpg

    ati/amd 5870. catalyst 15.20, win7 64 bit.

    As far as I know the problem with ati/amd cards and shaders is that they are picky with float/half/fixed precision declarations in the shader.
     
    bartm4n and Seneral like this.
  39. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,746
    Beautiful demo. Definitely putting this on my list, depending on the shore features. :)
     
    Whippets likes this.
  40. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    Thanks, working on it. Did some tests on amd gpu earlier (hd 7770), so it's possibly something specific to that model.

    If someone else with amd gpu could test it, I would appreciate that.
     
  41. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    On a GTX750 - 31 fps on Fantastic, 55 fps on Fastest
     
  42. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    Thanks, pretty good result. There are lots of Image Effects involved in this demo

    I'll add a toggle later to disable them.
     
  43. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    Is shore-line stuff already added? If so, can we have a demo from beach and cliffs?
    Does it LOD at all to the horizon, as obviously waves disappear quite quickly apart from the white crests?
     
    zuzzu likes this.
  44. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    No, I've listed shoreline waves in plans for 2015 in the opening post.

    Waves don't disappear, but their normals are faded at a distance by the shader (it's customizable) and trilinear filtering. That's actually needed as they tend to pixelate badly. That happens in real-world photos too: link. It's very distracting.

    On the subject of horizon LOD - maybe some day. That would probably give negligible performance boost as most of the hard work is done by the Fast Fourier Transform. Pixel shader of distant water would be 20% of screen pixels at most.
     
    Last edited: Oct 14, 2015
    Whippets likes this.
  45. Uli_Okm

    Uli_Okm

    Joined:
    Jul 10, 2012
    Posts:
    86
    Any plans to work in effects like ship wakes?
    And it already looks amazing!
     
  46. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    Thanks ;) Yes, that's already in progress, but probably won't be there before December.
     
  47. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,935
    Yeah, but it doesn't happen with the human eye, because we have focus. In this photo, the camera is set up so that the entire range is in focus, and that can't really happen with human vision.

    I'm just agreeing it needs smoothing out :)
     
    Whippets likes this.
  48. kasulogamestudio

    kasulogamestudio

    Joined:
    Mar 22, 2012
    Posts:
    130
    Following, looks really good... release plans? XD
     
  49. zuzzu

    zuzzu

    Joined:
    Feb 2, 2013
    Posts:
    404
    I'll send it to the store in few days at most. Two bugs still need to be fixed :rolleyes:

    This + lots of waves smaller than a pixel. MSAA helps, but that's not really a solution these days ;)
     
    Last edited: Oct 14, 2015
    KingLlama likes this.
  50. Grosnus

    Grosnus

    Joined:
    Mar 4, 2015
    Posts:
    15
    It looks really good! Is it possible to create water at different heights using this system?
    Let's say I have a river that ends with waterfall, at the bottom of the waterfall there is a lake - would it be possible to create both the river at one level and the lake at another?
     
    Mr-Logan, gameDevi and zuzzu like this.