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

Realistic Water

Discussion in 'Assets and Asset Store' started by kripto289, Mar 21, 2015.

  1. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    6.png Hey there. I decided to create a new effect of water that runs on a pc / mobile.

    Worked on Unity4 and Unity5.

    About perfomance.
    On pc load like the standard water4. Dynamic ripples calculated in another cpu thread, so do not load the main thread and gpu.

    On mobile (for example poverVR 544mp2, 4 cores 1Ghz, that's about as iphone 4s) water shows 60-80 FPS with distortions/refraction/caustic in real time. Even on mali-400 mp1 (2008 year gpu) about 20-30 fps with infinite water.

    I'm waiting for your feedback :)

    Demo for PC https://www.googledrive.com/host/0B...4WG5fbGdsQUJ6OV9vaTBxOWNpSEFWM0hqMGc/Web.html
    Demo for android https://www.googledrive.com/host/0B...QUJ6OV9vaTBxOWNpSEFWM0hqMGc/Android/Water.apk

    Asset store link https://www.assetstore.unity3d.com/en/#!/content/33434

    The discussion below for the older version (1.0.0.0).
    For the current version (2.0.0.0) of the water, some posts not actual!
     
    Last edited: Sep 11, 2015
  2. Tom163

    Tom163

    Joined:
    Nov 30, 2007
    Posts:
    1,290
    One wish that you might want to consider: Make the scale configurable. I'm working on a project where the map (using Unity Terrain) is actually a world map, not an FPS-scale map, and the only way I can use the regular Unity (Pro) water is by making it 100% reflective, because the shader assumes meter scale and gives no easy way to tune it, so my ocean looks like a shallow puddle if I don't.

    I'm sure I'm not the only project not using FPS scale or assuming 1 unit = 1 meter.
     
  3. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    My water works almost the same as a standard unity pro water. That is the plane with animated mesh and scale settings for this animation. For example, to the great world, you can dynamically generate the plane and they will stick.
     
    Last edited: Sep 11, 2015
  4. Tom163

    Tom163

    Joined:
    Nov 30, 2007
    Posts:
    1,290
    Yes, but what is the refraction depth? In my big world scene, the scale is 1 unit = 1 km. So my ocean floor is 1-2 units below the water surface. In Unity standard water, that means I can see it very clearly, and that makes it look not like ocean at all.
     
  5. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    Ocean water is based on a different principle. My water is more suitable for river / lake / beach, etc.
    But basically, you can adjust color / depth / transparency, although the ocean need more settings.
     
  6. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    This is nice. But could you show some pictures where the water looks deeper, more muddy, less clear? I need something for a river but while this is lovely, it looks better for a crystal clear pond. Thanks.
     
    hopeful likes this.
  7. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,052
    looks nice! Please give us some more parameters to tweak in the web player. Color, transparency etc... and maybe a little zoom in the camera.
    Looks great so far :)
     
    Teila likes this.
  8. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    Perhaps you mean something like that?

    sdfdsf.png


    Okay, I will update the demo soon.
     
  9. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    That looks good! Is that actual murkiness in the water or shadows? I will look forward to the updated demo. Unity water is driving me nuts. :)
     
    DesertRaven and protopop like this.
  10. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,557
    beautiful - it looks good enough to drink.

    Will it be on the asset store soon? And does it work on IOS?
     
  11. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    Also found some bugs in the shader.
    Now the water is slightly better :)
    dfgdfg.png
    Also, I will try to rewrite the shader code, to achieve a more realistic murkiness / shadow.

    Already available in the store assets (now add a link in header)
    https://www.assetstore.unity3d.com/en/#!/content/33434
    Alas, I have no way to test for ios. But my current tablet has the same gpu on iphone 4s.
     
  12. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,052
    Looks really nice. Eager to mess with the updated web player demo. Might be purchasing.
     
  13. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    Demo is updated. I added a few tweaks of water.
     
  14. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    The demo at the top of the thread has more sliders, but other than the top one, they don't do anything at all. Even changing the color has no affect. Not sure why, but it doesn't really show anything other than shadows, which was in the original demo. I think your new demo is broken, at least the PC one.
     
  15. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    The sliders on the demo worked for me (Windows 8.1).

    This water looks great. However, shopping for water is problematic as the solutions are typically targeted toward one sort of scenario. And usually you can't get one water asset to work in conjunction with another; only separately. It would be nice to be able to get something that hits all the marks: performance, beauty, realistic look for pools, ponds, lakes, rivers, and oceans, which can flow through rocks along a declining height, and which also allows for dynamic ripple-reactions and splashes in relation to obstacles in or entering the water. But I'm probably dreaming. :)

    This water looks absolutely perfect for koi ponds and tidal pools. Good job!
     
  16. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,052
    same here :( I'm on firefox... I know there was an update I didn't do yet. So maybe that's why...
    Edit: nope, my browser is up to date.
    Maybe upload a video of you tweaking the parameters at run time... not sure what the fix could be
     
  17. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    I'm on Firefox as well, but up to date. I was able to get new colors using the color pickers and adjust transparency and so forth.
     
  18. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    Strange. My demo works in firefox / chrome / ie on different computers. I'll try to build again.
    The colors are chosen randomly, so it may not look very nice in this video :)
     
    Gozdek and PROTOFACTOR_Inc like this.
  19. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,052
    thanks for the video.
    definitely looks cool! :)
     
  20. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Not getting the demo to run on Chrome.
    In the video the water seems very busy, can this be edited?
     
  21. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    I tried on Firefox. Chrome locks up when I try to run Unity demos.

    Video looks really good. One more question before I buy....does it have directional animations? Can my river flow in one direction and is that easily set? I assume it is but want to make sure it is not just for lakes or oceans.

    Thanks!!
     
  22. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    What a "busy water"? Strong waves? You can adjust the wave as you like.
    asdfds.png
    I will try to send a demo to another hosting or try to compile webGl version.
    Yes, you can change the flow direction and speed. (Setting "wave direction (XY))
    Also, may be i will add flow map in the future. But in the current version can be configured only linear motion.

    I also made some fixes in the shader. But not yet published. So if you buy it, then write me an email "kripto289@gmail.com", I can send the new version.
     
    Don-Gray likes this.
  23. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Thanks, Kripto! I am certainly going to buy it as the current water just doesn't hack it for me. How is performance computer to the Water4 shaders? They are fine for me, so as long as yours isn't more of a performance hog, I am happy. :)
     
  24. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    About perfomance on PC (1920x890 in play window, max quality without shadows, CPU amd athlon x4 2.8Ghz, GPU ati 4870 512mb):
    Default scene CPU ~4.8ms, Renderer Thread ~1ms
    Water4Advanced CPU ~7ms, Renderer Thread ~1,4ms
    My water(without projector-caustic) CPU ~7.8ms, Renderer Thread ~1,4ms
    My water with caustic CPU ~9.3ms, Renderer Thread ~1,5ms.

    dfgdfg.png
     
    Last edited: Apr 9, 2015
  25. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Looks good! :)
     
  26. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Beautiful water. Bookmarked.
    What about the API. I mean, what if i want to put a boat? Do you have functions that allow us to know the "vertical (Y)" of an XZ position?
     
  27. siliwangi

    siliwangi

    Joined:
    Sep 25, 2009
    Posts:
    303
    Does it compatible with unity 5 ?, when the environment getting darker, i have get artifact like this



    Running on webplayer unity 5, Intel HD 4600
     
  28. Tom163

    Tom163

    Joined:
    Nov 30, 2007
    Posts:
    1,290
    This is getting really good. Finally a water that's good not just for tropical you-can-see-the-bottom scenarios!
     
  29. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Flow map support would make this thing the bomb, but hey i got it anyways, mainly in the hope that flowmaps come along
     
    DesertRaven likes this.
  30. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    intel HD have problems with depth buffer. In the next version I'll include a shader without the buffer depth. But then it will not be available foam / translucent depth.
     
  31. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    733
    Beautiful water but i found the same issues with Chrome and with the GUI sliders and colors that have no effect into the scene (except DayTime and Wave scale)
    PC:
    - Windows 8.1
    - Geforce GTX 770
     
  32. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    :p
     
  33. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    The demo still works for me (Windows 8.1, Firefox), but one thing to note is that the sliders all affect views from above the water. When you look under the surface of the water nothing changes.
     
  34. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    This function is not available. In the future, maybe I will implement this functionality. But I think it is not difficult to get the current mesh and get the position of the vertex.
     
  35. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Yes. It's pretty easy. :p
     
  36. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    The problem is related with "ZWrite". He does not work correctly on the intel.
    Open shader "WaterPC" and replace ZWrite On to ZWrite Off.
    I have already sent the hotfix on assetstore previews.
     
  37. mwituni

    mwituni

    Joined:
    Jan 15, 2015
    Posts:
    345
    PC Demo link not working.
     
  38. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    I've updated the water and link a couple of days should work.
     
  39. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Hello, this asset looks VERY interesting! Alas I just tried the PC webplayer demo and it looks like this:



    I'm on Windows 8.1 and Firefox. The sliders have no effect at all and the water color is invisible... o_O

    Edit: I also tried running it on Chrome but Chrome simply insists on installing the Unity Web Player plugin. Which I did about half a dozen times and nothing comes up...
     
    Last edited: Apr 19, 2015
  40. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    I really like this but I have concerns that with so many issues with the demo that it won't show in the actual game either.
     
  41. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    The new demo link is https://www.googledrive.com/host/0B...WRNNFQ1QWJIejJBOEFGOFBZNFU1TEllb2c/Water.html
    Try it?
    Bug with water setting is likely due to the incorrect code the GUI.
    Transparency of the water I fixed. This is a bug with depth buffer and ZWrite.
    Check out new link?
     
  42. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Thank you! It looks fabulous now. I am assuming that the time of day changes are the reflection of the ambient/skybox color? So if my skybox/ambient light changes, the water will also reflect that water, right?

    Sorry for all the questions but I have a lot of water shaders and don't want more I can't use. :) Yours looks great though.
     
  43. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Ok, I tried the new one and it works now, thanks! :)

    Do you know if this asset would work with uSky? And I assume you can set a layerMask to choose what gets reflected, correct?
     
  44. Xoduz

    Xoduz

    Joined:
    Apr 6, 2013
    Posts:
    135
    How easy is it to have several planes of your water in the same scene, using different settings for each plane? (Still ponds, rivers, murky swamp, all in same scene)
     
  45. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    I want to remind that these changes will be available in the update 1.0.0.1.
    Aseetstore must upgrade pack soon.
    Yes, you understood correctly. Reflections are made using the secondary camera (as the standard water4). If you have a standard water works correctly, then my will work too.
    You must create a copy of the material (eg ctrl + d) and use the new settings of water.
    For example three different water planes in scene.
    11.png
     
    Xoduz likes this.
  46. zelmund

    zelmund

    Joined:
    Mar 2, 2012
    Posts:
    437
    +2
     
  47. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
  48. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
  49. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    Oh sure, I forgot :D
     
  50. mwituni

    mwituni

    Joined:
    Jan 15, 2015
    Posts:
    345
    Looking good.

    1. Is this meant to cover larger areas too? Like around islands.
    Or only small ponds?

    If so, is there a concept of LOD on the meshes for efficiency?

    2. And does water tile across joined meshes?