Search Unity

[RELEASE] Calm Water

Discussion in 'Assets and Asset Store' started by Phantom_X, Jan 22, 2016.

  1. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    Hi,
    I tried on android using a google Pixel 3 and it works fine on it, but it's the only device I was able to test on lately. While it should work fine on most devices I cannot guarantee it will since I did not test it.

    The tessellation shader will not work due to hardware limitation, only the normal version can run on mobile.
     
  2. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Hello Phantom_X,

    You are always so fast at taking care of your users! I am one for a long time by the way, I bought this awesome asset a while ago and I used it in a game. I am only using the normal version so thank you very much for the great support you offer.

    Regards,
    Carlos
     
    LaurieAnnis likes this.
  3. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    Yes I remember you from almost the beginning of this asset, glad to see you stick with it :)

    Just one thing I frequently get asked, if you see nothing where the water should be it is because you need to add the camera depth mode script on the main camera so you can have access to the depth texture in forward rendering mode.
     
  4. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Phantom_X,

    This is the best water still out there, when it comes to beauty, simplicity, and speed all in one. And with the updates you have done along the way is even better! The only time I don't see the water is if I turn the directional light off which I don't do. The application that I want to use the water for this time, is an online virtual meeting environment, so each user uses their own camera, but since each user would have their own instance of the app, I suppose there should not be any problem relate to the cameras?

    But like I said before, you are just so fast and mindful supporting your users that if I see any problems I know I will be able to get help from you

    Regards,
    Carlos
     
  5. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    Hey,
    The only problem I can foresee with multiple camera is if you have multiple camera that renders at once, maybe the realtime reflection script will have a hard time finding which one is the main camera. Other than that I think it should be fine, but yeah like you said if you have any issues let me know and I will do my best to help! :)
     
  6. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Phantom_X,

    I don't use realtime reflection neither, I use the baked reflection so that is not a problem in my case neither. Great stuff.

    Regards,
    Carlos
     
  7. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    562
    In its most basic form does Calm Water work on mobile for quest 2 in multiview rendering in standard pipeline? So reflections would be in a reflection probe no dx11 stuff etc just as good as it can look and run on android.
     
  8. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    Hi,
    it's working only with Multi Pass at the moment, refractions are having issue in single pass.
     
  9. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    Turns out I just had a look at it and I found a way to make it work with single pass too ( on Oculus Rift at least, I don't own a quest )

    I will try to submit an update soon.
     
  10. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Hello Phantom_X,

    Hey man, I have Calm Water in my application in WebGL and it works wonderfully. But the problem is that when we change the settings profile to energy saving mode(find the attached image) the water disappears. Could you tell me what in this settings profile, could be creating the problem and if there is a solution in the shader what could it be? Thank you so much for all your hard work in this terrific asset and for keeping it updated through out all the Unity's versions!

    I actually narrowed down when the water disappears, and it is when we disable shadows in the build or if I dissable the directional light in the viewport. I need to fix this please help me.

    3dmeet_qualitySettings_Low.jpg

    Regards,
    Carlos
     
    Last edited: May 7, 2021
  11. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    Hi!
    So you absolutely need a directional light in order to have the water working properly. If you worry about performance what you can do is have a directional light that affects only the water layer. That way other objects won't cost more to render and you will keep the proper water rendering.

    As for the shadows I'm not too sure why it would break when the shadows are disabled, I made a build myself using these quality settings and I don't have the issue.
    http://yvgrafix.com/cw/

    Maybe there is a bug in the specific unity version you are using?
    I tried on 2019.3.12 what are you on?
     
  12. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Hello Phantom_X,

    I don't need to remove the directional light, I just explained the two reasons for the water disappearing, but the system we are using for power saving in mobiles, remove the shadow casting though quality settings, and when it does that, the water disappears. This has always happen since I bought the assets years ago, but I have never cared because I never had to disable shadows in my past projects. The version I am currently using is Unity 2019.4.16f1. Just in case I didn't mentioned this before, we are building for WebGL.

    This also happens in the editor window when removing shadow from directional light in the actual light, or through the quality settings.

    Regards,
    Carlos
     
  13. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    Hey,
    So I'm trying to reproduce this on my side.
    I installed same Unity version as you (2019.4.16f1), targeting WebGL, no shadows, but I don't have the issue. Anything else I should change?



    Like I said before, no water at all is generally a sign that the Camera Depth Texture is not available. Are you sure you have the Camera Depth Script on the camera and there is no other script in your system that may disable it? Maybe test the asset in an empty project to get that out of the way.

    If you want to contact me in PM I can send you a package containing debug shaders so we have a better idea were it's breaking.

    Thanks!
     
    LaurieAnnis likes this.
  14. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Hello Phantom_X,

    I didn't see that message about the camera, but I have never added any "Camera Depth Texture" to my camera, so that could be the problem. In that case where is that component? so I can add it to the camera. Also if this is the case wouldn't that affect the water even when shadow is on?

    Regards.
    Carlos
     
  15. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    Hi,
    The script is in Calm Water\Scripts\CameraDepthMode.cs
    My guess was that your low quality tier is using forward rendering while higher quality tiers are using deferred. You need the script only for forward so that would explain why the water disappear only on low tier. That being said I still don't understand what is the link with the shadows, but that's worth a try.

    Thanks!
     
    LaurieAnnis likes this.
  16. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Hello Phantom_X,

    My build uses forward rendering in both settings. Somehow though, I fixed the problem in the build by making the "edge fade" setting in the shader negative number like -0.1 Don't know why but when I did this, the water became visible again in the "Low" setting. Of course I had to create a script that checks what setting is selected and change the regular water material with the one that has that "edge fade" set to negative number. Also once the "edge fade" is negative, I had to change the settings for the foam, since the foam was covering all the water plane, when the edge fade is negative.

    Regards,
    Carlos
     
    LaurieAnnis likes this.
  17. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    Glad you found a solution, however I still don't understand what is the problem since I couldn't manage to repro on my side. Anyway, if you have time to make a repro project and send it to me I will investigate how to make a fix for that!

    Cheers!
     
    LaurieAnnis likes this.
  18. betaFlux

    betaFlux

    Joined:
    Jan 7, 2013
    Posts:
    112
    Hi, is it possible to create a realistic muddy dark green lake with low transparency? I'm asking because all the pictures and the video in the asset store shows crystal clear ocean-like water only.
     
  19. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    Hi,
    You can control the depth were the water becomes foggy and you can change the color of the foggy area and the clear area sepparately.

    You can kind of see an example in this screenshot:


    Cheers!
     
    LaurieAnnis likes this.
  20. betaFlux

    betaFlux

    Joined:
    Jan 7, 2013
    Posts:
    112
    Thank you, that's good to know! Also all the other water assets I have tested have one "issue" in common. The glossiness/specular effect is too smooth, as also visible in the image you just posted. Can this be adjusted to a more natural crisp, sharp look?
     
  21. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    There is a parameter for the specular "Smoothness", but it also depends greatly on your normal maps.
    With the ones provided in the demo scene you can go to something like this



    Cheers
     
    LaurieAnnis likes this.
  22. betaFlux

    betaFlux

    Joined:
    Jan 7, 2013
    Posts:
    112
    Great, that looks quite close to what I have in mind. Thanks for your time!
     
    LaurieAnnis likes this.
  23. VigorousApathy

    VigorousApathy

    Joined:
    Dec 22, 2012
    Posts:
    12
    I've been using your shader for an infinite water plane and looks fantastic, is there a way to soften/mask the edges of the water plane in the shader itself so it blends perfectly with the skybox? I've tried messing with fog, but you can still see the edge of the quad. Let me know if this is possible.

    horizon_line.jpg
     
  24. JurassikLizard

    JurassikLizard

    Joined:
    Nov 25, 2019
    Posts:
    1
    Is there a way to have different wave heights while still having the same plane object
     
  25. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    Hi,
    in Gerstner and Wave mode you can change the global heights using the Amplitude parameter, but it is a global parameter and you cannot change it "per wave".

    If you use the texture mode instead, having waves with different shades of grey will let you have different wave heights, but they will travel together across the surface.

    Hope that answers your question!
     
  26. Regulus343

    Regulus343

    Joined:
    Jul 4, 2013
    Posts:
    11
    So I'm in the process of porting a PC VR game that uses Calm Water to the Quest, and so I've been doing some digging in this thread and many others in the Unity forums and have found that basically GrabPass seems to be broken for Android Single Pass Instanced (Multiview), built-in render pipeline. It has been a problem for years, with some reported fixes that don't seem to last through the new Unity version releases (or perhaps it has never been working all along). But anyway, I am using Calm Water, and the look of the water is not the most pressing matter for me, so I was wondering, is there an easy way to modify the shader to make an "opaque" version with no refraction of what's underneath (solid colored water surface with the specular highlights) so that I can just call it a day and have some basic water for our eventual Quest release? I did make a version where I just commented out the GrabPass lines in "CalmWater - DoubleSided.shader" and then turned on depth fog to somewhat hide the stuff underwater (that appears all white under the water without the GrabPass code), but I still have some weird visual errors, so the plan B I'm falling to is to try to just make a modified version of the shader that is opaque and doesn't do any refraction of what's underwater (but have little shader knowledge to draw from). Anyway, thanks for any suggestions you might have to get me moving in the right direction.

    It's maddening to me that there's seemingly no way to reasonably do water on the Quest still after all this time. That Unity seems to be leaving it incomplete (and I can't afford to take the performance hit in using Multi Pass, nor can any Quest developer really... we need every bit of performance we can get out of these significantly-weaker-than-PC devices).

    One more thing: this asset has been awesome for me for our PC game. I've had numerous compliments about the water throughout media releases for the game! So thanks for making it so great.
     
    LaurieAnnis likes this.
  27. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    Hi!

    Darn it, I thought I had it working on 1.9.4 VR single pass and multipass is working on my rift, but yeah I don't have a quest to test on android.... What kind of problem are you experiencing?

    As for making an opaque version, it's unfortunately not as simple as just commenting the GrabPass part.
    What you can try on 1.9.5 is remove the GrabPass parts like you did.
    Then open the file CalmWater/Shaders/Includes/CalmWater_Refraction.cginc
    Replace the whole content of the ComputeRefraction() function with this:
    Code (CSharp):
    1.     float2 offset = data.worldNormal.xz * _GrabTexture_TexelSize.xy * _Distortion;
    2.  
    3.     data.DepthUV = OffsetDepth(IN.DepthUV, offset);
    4.     data.depth = texDepth(data.DepthUV);
    5.     data.cleanDepth = data.depth;
    6.  
    7.     data.refractedBuffers = _Color;
    8.     data.cleanBuffers = _Color;
    9.     data.finalColor = _Color.rgb;
    10.  
    you can then control the color using Shallow Color parameter on the material.
    Of course most features will be broken, but you still keep the reflection, normals, specular and even caustics.

    Hope this helps,
    Cheers!
     
  28. Malikart

    Malikart

    Joined:
    Jul 9, 2022
    Posts:
    1
    This is absolutely fantastic looking water! I only whish that one could actually swim in this water, including underwater sound effects and a splashing sound when jumping in. Then it would be perfect. Any chance of getting this in a future update? I´d pay $5 extra :)
     
  29. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    Hi!
    Splashes VFX would be doable as I can do VFX, however sound effects not so much since I am no sound designer at all unfortunately.
     
  30. Regulus343

    Regulus343

    Joined:
    Jul 4, 2013
    Posts:
    11
    Hi, sorry I never replied when you asked what the problem was with GrabPass and Android. It created a number of visual artifacts where the surface met objects if I recall correctly (I don't have a screenshot to reference). I eventually moved away from this shader for mobile though because I can't afford the budget of the depth pass (instead I'm just using standard shader with transparency and animating UV). I think I did eventually get it to work using Vulkan though.

    But anyway, I am coming back with a real issue, but on the PC side of things. I am using the latest version, 1.10.0. Before I moved our game to single pass instanced rendering (from the old single pass rendering of Unity's legacy XR system), I was able to use the DX11 shaders, with tesselation, just fine. But after moving to single pass instanced after upgrading to Unity's new XR plugin management system, I can no longer see the water in the right eye. Now, this is usually a matter of putting in the proper macros, etc. to make the stereo eye index work for the shader (https://docs.unity3d.com/Manual/SinglePassInstancing.html), but somewhere in the tesselator/hull/domain steps, it's just not working (perhaps just not passing down the stereo eye index). I've also been trying to use UNITY_TRANSFER_VERTEX_OUTPUT_STEREO() as is mentioned on the Android version in the manual (https://docs.unity3d.com/Manual/Android-SinglePassStereoRendering.html) because it says "If your shaders use other shader stages, use the UNITY_TRANSFER_VERTEX_OUTPUT_STEREO() macro to transfer the eye index to the subsequent stages.". I've even tried to reproduce what they have in this README for Unity XR & shaders as it applies to the VRChat app, as they have a section specifically on tesselation and getting it work with single pass instancing: https://github.com/cnlohr/shadertrixx/blob/main/README.md. I've also been trying to incorporate the knowledge in bgolus' Unity forum reply here, as it appears to be relevant to my issue with Calm Water.

    But all to no avail so far. I will keep working at this as it just looks so much better with tesselation, and it looks perfect in the left eye, so there has got to be a way to make it display in the right eye as well. It would be a shame to have to throw away tesselation when it is fully working in the left eye. I feel like I'm close, but perhaps not. Hopefully the next couple hours get me somewhere with this. Because I just can't accept that one of the aspects of my games' graphics was far better a year ago. Anyway, I'm very grateful if you can provide any suggestions about what to look to as I am not a shader expert myself. But I am grateful regardless; Calm Water is a great asset, I even recommended it from our company Twitter a few weeks ago. Have a great day, thanks for making Calm Water!
     
  31. omergpo7

    omergpo7

    Joined:
    Sep 8, 2022
    Posts:
    1
    is there any possible through which we can convert calm water to URP?
     
  32. Erathor

    Erathor

    Joined:
    Jan 11, 2014
    Posts:
    18
    Hey there, thanks for this great Asset, I've been using it for quite a while now on one of my older projects.

    I've recently tried to use the water shader on a project in Untiy 2020.1 however I noticed that at small distances the mesh fades and does not render, irrespective of lighting or color or ground underneath, it basically doesn't render beyond a certain distance.

    Did something change with newer Unity Versions or do I need to update the asset.
    Thank you in advance :)

    Below are two pictures with planes of roughly the same scale:

     
  33. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    Hi!
    This is a bug that was introduced in an older version, it should be fixed in the latest (1.10.0).
     
  34. Erathor

    Erathor

    Joined:
    Jan 11, 2014
    Posts:
    18
    Thank you I will do a quick upgrade. Wish you a good advent and Christmas!
     
  35. Nikovsk

    Nikovsk

    Joined:
    Mar 16, 2023
    Posts:
    14
    Hi I got your Calm Water and it looks fantastic above water line. When I go underwater in project or game mode it's just empty, no underwater fog. I even thought it didn't include underwater effects but reading previous comments it seems like it does have. Please what are the settings that enable the underwater fog? Thank you!
     
    Last edited: Apr 22, 2023
  36. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    312
    being disappointed by Luxwater which works very badly on Unity 2022.3 built-in, I wonder if I should buy Calm Water. I often buy Assets which ultimately do not serve me.
    Should I take the leap?
     
  37. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    Just tested in 2022.3.4f
    Works just fine! :)
    upload_2023-7-7_20-8-35.png
     
  38. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    312
    I just purchased the asset. There is no doc except for creating the material.
    I created a surface for the sea and assigned the material. I have a pretty ugly blue map.
    if I can't find documentation to use it, I will ask for a refund.
     
    Last edited: Jul 15, 2023
  39. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    312
    how to make an infinite ocena? In the demos there are only small water surfaces.
     
  40. ashaydave

    ashaydave

    Joined:
    Nov 14, 2022
    Posts:
    1
    Need help in making this work in the Meta Quest 2/3. I render it in multi pass, have the camera depth mode on my camera, but it causes some weird light artifacts on my UI canvases when looked at in certain angles in pass through.
    I know it's a little bit hard to see, but on the race and ethnicity button, you can notice a bit of a darker shadow on the top half of the button. The calm water is just on the top right if you look closely (sorry for the smaller screenshot, can't share the details of the project too much!). That happens with other buttons as well. But when I go closer, it works fine. Feels like some sort of lighting/scaling issue because of calm water?
    CalmWaterBad.PNG


    CalmWaterGood.PNG