Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[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:
    272
    Hey,
    sorry for the delay, but I made some tests and the workaround does work with bloom and realtime emissive, here's a screenshot
     
    Bhanshee00 likes this.
  2. DoubleBit

    DoubleBit

    Joined:
    Mar 16, 2016
    Posts:
    6
    That looks just awesome Sir, thanks for testing and showing. Since i'm relying on certain terrain shaders, i'll just cutout some meshes from the terrain and overlay them on terrain where i need it, and apply some self illuminent to those for same result, but it will look just great.

    Maybe a good idea for an update to implement your fix as a feature. -CalmWater, now with glow 8)

    - Have a pleasent day.
     
    Last edited: Mar 19, 2016
  3. DoubleBit

    DoubleBit

    Joined:
    Mar 16, 2016
    Posts:
    6
    btw: waterplane maker script was a nice addition, i work with a bunch of terrains stitched together for each scene, so i have a lot of different sized levels and that just made it a whole lot easier for me to make them. 8)

    sorry about the editing in this post, having issues i'm trying to pinpoint...
     
    Last edited: Mar 19, 2016
  4. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    1,502
    We're currently improving our integration with water assets in Landscape Builder, does CalmWater come with prefabs and does it support scaling of the mesh plane? (I see others have asked about scaling too). As LB works over multiple terrains, one method we use is scaling, and another is mesh duplication (which is less desirable). We let users create landscape wide "oceans" and then let uses easily size and drop in lakes, ponds etc.
     
  5. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    I would say yes and no. It works overall but you will have 2 issues.

    First, the tiling of the normal map and the foam is in UV space so you will need to adjust the tiling of those depending on the scale of the mesh. It makes me wonder if I should put these in world space instead....

    Second issue will occur only if you use Displacement feature ( Gerstner wave or Sine Wave ). To get correct fresnel reflection I have to recalculate the vertex normals in the shader and I did not figure out how to include the scale of the mesh into calculation yet. So in the worst case the fresnel would appear as if the mesh was completely flat.

    I do include a script to create custom meshes with the size you want on the fly though if it helps?
     
  6. Matt-J

    Matt-J

    Joined:
    Sep 13, 2012
    Posts:
    12
    Hi Mr Verde. Is there a chance that the features on this will be added to CalmWater at any stage? By that I mean the raising up of the water in realtime? Thanks.
     
  7. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    Hi,
    no it's a completely different system. It would probably be a different package as well.
     
  8. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    If you only want to raise the water, can't you just move your water plane in Y direction ?
     
  9. nikunjk21

    nikunjk21

    Joined:
    Jan 12, 2014
    Posts:
    22
    Hi,

    We are looking for a water shader for our mobile game. It needs to have blending at edges, ability to change color to dark swamp color, depth and it should look like the water is flowing.

    Please let me know if this shader will work with our game on mobiles with optimal FPS.

    Target platforms are iOS, Android and Windows.

    Thanks,
    Nikunj.
     
  10. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    Hi,
    is this swampy enough?



    As for optimal FPS, it's not the cheapest shader, especially since it uses depth which will double the draw calls in forward rendering, but the demo scene runs fine on Iphone 5s and up, also on Nexus 5 first Gen.

    In an upcoming release I will include a cheaper version of the shader but probably won't include depth or distortion.

    Thanks!
     
  11. nikunjk21

    nikunjk21

    Joined:
    Jan 12, 2014
    Posts:
    22
    Hi, It's looking great.

    But how will it work with backed lights. Shall it require real time lighting ?
    I am working on animation story of crocodile, As we are targeting mobile devices, I can't use directional lights.

    Regards,
    Nikunj.
     
  12. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    Hi,
    As is, if you have absolutely 0 realtime light then specular reflection would not display, but everything else will work.
    You could set one Directional light's culling mask to affect only the water layer to have specular effect. Since it's calculated in the base pass of the shader anyway it would not change the performance.

    Regards
     
  13. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    WIP
    Upcoming feature, Depth Fog.
    When enabled you will have a slider to determine the translucency of the deep water.

     
  14. nikunjk21

    nikunjk21

    Joined:
    Jan 12, 2014
    Posts:
    22
    Hi,

    Thanks for reply. Finally we impressed with this asset. and we purchased it, today.

    Now, as I mentioned, We are working on animation story of crocodile and monkey. I seen your read me file and followed the instructions but sadly I am unable to achieve that quality that you shown in previous shot of swamp.

    So, I need guidance from you to achieve that quality. See, reference screenshot below:
    https://drive.google.com/file/d/0B34u11VFCKb2b0RIMHpWeERhT3M/view?usp=sharing

    better if you provide screenshot of the shader parameters. And also need step by step instructions to integrate this asset into my scene.

    some of doubts that I have:

    1) Is it necessary to use terrain or other ground model below the water plane ? Right now, I put a simple plane object of unity, as a water. you can see in reference screenshot.
    2) Shall this asset runs on windows phones ?
    3) In island scene, I can't see water. Shader is 'calm water (double sided)' on water plane.

    I will contact you through mail, with invoice details.

    Regards,
    Nikunj.
     
  15. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    Hi,
    I will help you the best I can.

    As for general setup:
    • Since you are targeting mobile I assume that you are using forward rendering. Therefore you will have to add the Camera Depth Mode script to your main camera.
    • Be sure to have your normal map's texture type as a normal map in the import settings
    • Don't use unity's plane for the water. The water needs a scale of (1,1,1) for better displacement effect. I supplied a tool to create a custom plane the size you want in case you don't have a 3d modeling software.

    The parameters I used are pretty much the same as in the pond demo scene with some color changed and I deactivated the foam.

    1- Yes you need some model under the water plane otherwise it will not have the depth effect I showed you before.

    2- As I mentioned before I never tested this on windows phone and have no way of testing it.

    3-
    - But it's working in the pond scene?
    - Are you sure it doesn't have the DX11 material? (DX11 version won't render on mobile it doesn't support it)
    - Is it giving you any errors?
    - Unity version?
    - Shader Version?

    Regards,
    Yan
     
  16. nikunjk21

    nikunjk21

    Joined:
    Jan 12, 2014
    Posts:
    22
    3-
    - not working on pond scene. Water object is pink.
    - I am checking on Unity editor, not on the phone. Shader name is 'Calm Water [Double Sided]'. This is happened in two shaders i) Calm Water [Single Sided] ii) Calm Water [Double Sided]
    Other two shaders having no issues.
    - no errors
    - Unity version 5.2.1
    - Shader version - latest (I downloaded today) 1.5.6

    You have my email info, as I sent you mail.
    Please help me with this. Can you share screen shot of parameters of that shader?

    Which shader is appropriate for mobile, out of your 4 shaders?

    Regards,
    Nikunj.
     
  17. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    Hey,
    If the plane is pink it means that there is an error or there is something missing. Check of you see errors in the inspector when you select the shader files. If so try to do a reimport on the shader folder.

    It's weird that you get DX11 version to show but not the other ones, it should be the opposite.

    I will send you a screen shot when I can.

    Thanks
     
  18. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    here's the screenshot, on unity 5.2 Android mode.

     
  19. nikunjk21

    nikunjk21

    Joined:
    Jan 12, 2014
    Posts:
    22
    Hi,

    Pls look at the shot, I set the same parameters as you did. but, not able to achieved the result.

    Thanks.
     

    Attached Files:

  20. nikunjk21

    nikunjk21

    Joined:
    Jan 12, 2014
    Posts:
    22
    After importing the asset, I got following warnings:

    Lightmap snapshot 'LightingData' is inconsistent - 6 files out of 24 are missing. Realtime GI will be disabled. Please rebuild lighting for this scene.
     
  21. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    Hey,
    You are using the DX11 version, this is not supported by mobile. Please use the non DX11 version. Also remove the mirror reflection script, you don't need it when using cubemap reflection.

    The lightmaps warning that you are getting is caused because I built the lightmaps with a different version of unity, but won't affect the water shader.

    Thanks
     
  22. ToamoaStudio

    ToamoaStudio

    Joined:
    Jul 1, 2015
    Posts:
    13
    (Sorry for bad english)

    Hi,

    We just bought this plug this morning and it’s really great !

    We just have a problem after building the game :
    Shader error in 'CalmWater/Calm Water [Double Sided]': undeclared identifier 'UnityDecodeCubeShadowDepth' at UnityShadowLibrary.cginc(97) (on d3d9)

    Can you help us please ? :)
     
  23. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    Hi,
    Sure I will help you, what is your unity version and targeted platform please?

    Thanks
     
  24. ToamoaStudio

    ToamoaStudio

    Joined:
    Jul 1, 2015
    Posts:
    13
    Thanks for the quick answer !

    We use Unity 5.3.3p3 Personal and it’s for PC Windows.
     
  25. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    I cannot verify at the moment ( on the bus), but I think I fixed this issue in the next version.

    As a workaround for now try to go in the shader file you are using and set the lines #include "UnityCG.cginc" to be at the top of all #include lines for each pass.

    If you contact me by email I could also send you the 1.5.7 package.

    Regards,
    Yan
     
  26. ToamoaStudio

    ToamoaStudio

    Joined:
    Jul 1, 2015
    Posts:
    13
    Awesome ! It worked !

    Thank you very much :)
     
  27. nikunjk21

    nikunjk21

    Joined:
    Jan 12, 2014
    Posts:
    22
    Hi,

    Finally I fixed the issue. It was a version problem. I was using Unity 5.2.1 and I upgraded it to Unity 5.3.4

    Water is working fine.

     
  28. nikunjk21

    nikunjk21

    Joined:
    Jan 12, 2014
    Posts:
    22
  29. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    Cool! as you can see in the previous post it's possible that you get an error when building. I sent an update for approval, but I can send you the package by email if you need it now.
     
  30. nikunjk21

    nikunjk21

    Joined:
    Jan 12, 2014
    Posts:
    22
    Hi,

    It was shot from the editor but when I tried to build for Android, water is disappeared!

    Unity version - 5.3.4f1
    I am getting 3 errors from shaders, look at below screenshots.

    Android_Xiomi_Redmi_Screenshot_2016-04-20-10-59-36.png

    errors while building for android.png
     
  31. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    Hi,
    Looks like there is a bug in CalmWater 1.5.6. Good news is 1.5.7 has just been approved and should fix this issue!
    I just tested it on unity 5.3.4p3 and been able to build on android no problem.

    Regards
     
  32. philc_uk

    philc_uk

    Joined:
    Jun 17, 2015
    Posts:
    85
    Unity Ver 5.3.4f1
    When Compiling shader for DX9...

    Shader error in 'CalmWater/Calm Water [Double Sided]': Invalid register number: 10. Max allowed for v# register is 9. at Assets/Calm Water/Shaders/CalmWater.cginc(159) (on d3d9)

    Compiling Fragment program with DIRECTIONAL SHADOWS_SCREEN LIGHTMAP_OFF DIRLIGHTMAP_OFF DYNAMICLIGHTMAP_OFF FOG_EXP2 _DISPLACEMENTMODE_GERSTNER _DISTORTIONQUALITY_HIGH _FOAM_ON _REFLECTIONTYPE_REALTIME
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING



    Shader error in 'CalmWater/Calm Water [Double Sided]': Too many output registers declared (12). When no output register has been declared with the semantic 'psize0', 11 o# registers are available. When an o# register has been declared with the semantic 'psize0' (same as 'psize'), 12 registers are available. at UnityCG.cginc(632) (on d3d9)

    Compiling Vertex program with DIRECTIONAL SHADOWS_SCREEN LIGHTMAP_OFF DIRLIGHTMAP_OFF DYNAMICLIGHTMAP_OFF FOG_EXP2 _DISPLACEMENTMODE_GERSTNER _DISTORTIONQUALITY_HIGH _FOAM_ON _REFLECTIONTYPE_REALTIME
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING

    Any clues?
    Shaders are unmodified and updated to latest. Target platform is Windows/Linux x86
     
  33. nikunjk21

    nikunjk21

    Joined:
    Jan 12, 2014
    Posts:
    22
    Should I upgrade the new version of calm water? I am using Unity 5.3.4f1
     
  34. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272

    Yes, it should fix the problem.
     
  35. philc_uk

    philc_uk

    Joined:
    Jun 17, 2015
    Posts:
    85
     

    Attached Files:

  36. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    Humm, I opened unity in DX9 mode to try it. I never tried it before as it was in the DX11 category. But still, I got the error as well when I built. Also the water doesn't show up in deferred rendering ( I think this is a bug on unity's side, my depth texture is all white ... )

    Regarding the error you can do this, replace the line v2f o = (v2f)0; with this code: v2f o; in CalmWater.cginc

    I still have some errors at build time, but was still working in the build on d3d9 in forward mode.
    The errors I still have is due to shader limitation in d3d9, to fix it you need to turn off either the foam or the fog for now. I will maybe try to create the foam using the world coordinate instead of the mesh's uv. this will same me one input and you should be able to use it on d3d9.

    I will also investigate more for the deferred part.

    Regards
     
    Last edited: Apr 20, 2016
  37. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272

    FYI, I made a quickfix for this. It's now d3d9 compatible and will be available in the next release. Contact me by email if you need the fix now.

    Regards
     
  38. philc_uk

    philc_uk

    Joined:
    Jun 17, 2015
    Posts:
    85
    Hi thanks for working on this. I am trying the DX11 mode.
    I have noticed sometimes.. that the amplitude(and frequency) of Gerstner displacements needs to be really small.. like 0.005 and other time, I build/run it, and it seems the water is not moving at all.. I increase the Amplitude to like 10 and it starts working again.. (Dx11 double sided, latest Patch release).
    I think its basically, an edit/play mode thing.. in edit more.. the values must be really small.. but in playmode they must be large..
     
  39. philc_uk

    philc_uk

    Joined:
    Jun 17, 2015
    Posts:
    85
    See images, Water1 is in playmode, water2 in editmode.
    Same size mesh, and scale.. just playing and not playing.
    If i change the water to the large size, and stop, then unity hangs alot, and the mesh its drawing is huge, goes off the screen. So i have to hide the water gameobject, and set the shader down to a tiny size, then it looks normal again, hit play, and the water is flat.. ! (Increasing it up to 30 fixes it and we go round and round)
     

    Attached Files:

  40. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    Hey,
    Humm that is weird, I tried to build latest release in unity 5.2 and 5.3.4 myself and don't see any noticeable difference between the editor and the build neither from the play / edit mode.

    Can you try this in an empty project with the demo scenes to see if you get the same result?

    Thanks.
     
  41. philc_uk

    philc_uk

    Joined:
    Jun 17, 2015
    Posts:
    85
    Ok will do
     
  42. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    119
    @YanVerde - Does this shader work in Unity 5.4 b16? Thanks.
     
  43. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    Hi,
    Quick answer, it should be. I tested only up to b12 as you can see:



    One user did report some weird issue like it was working in one scene but not in an other one, but I wasn't able to reproduce it even after trying on multiple computers.

    Anyways, I will try the latest beta later on to confirm.
     
  44. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    119
    Thanks for the quick reply.
     
  45. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    119
    Hi @YanVerde - One more question. Is CalmWater compatible with opaque image effects such as rendering fog and clouds over the water? Thanks.
     
  46. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    813
    Yan,

    I have two questions. I want to update the asset but when I try it doesn't work. What is the best way to update the assets so it works?

    Do you have any idea about why the mirrow reflection script could stop working on the console, although it was working before?

    Regards,
    Carlos
     
  47. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    813
    Updating with the new version of Calm water gives me this error from the get go:

    unrecognized identifier "SurfaceOutput"

    I am working on a Xbox One built

    Any help very much appreciated!
     
  48. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    813
    Does anyone has the problem I am having with the real time reflection in the water, that suddenly doesn't work? Any work around? Some times it reflects and some times it just doesn't. Please if you have any advise about this, I am in a deadline

    Regards,
    Carlos
     
  49. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    SurfaceOutput? Looks you are on a pretty old version of calm water. You will need at least unity 5.2 to update to the latest version from the asset store.

    If you already are on calm water 1.5.8 maybe you still have old files that conflicts with the new one and should delete the calm water folder and reimport from the asset store.
     
  50. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    272
    To avoid errors you should also exclude the water plane from reflecting itself. On the mirror reflection script exclude the layer which your plane is in from the reflected layers.
     
unityunity