Search Unity

[Depreciated] Underwater Shaders v1.5

Discussion in 'Assets and Asset Store' started by Sermolux, Jun 10, 2016.

  1. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    This asset has been depreciated and is no longer for sale on the asset store.
    New in version 1.5:
    • Added alpha transparency versions of the Mobile, Desktop and Standard shaders.

    New in version 1.4:
    • Optimized shaders and modified example scenes.

    New in version 1.3:
    • Added UnderwaterManager.cs script to manage and edit multiple underwater shaders at the same time.
    • Added "Underwater/Standard" shader based on Unity's physically based shader.

    New in version 1.2:
    • Added Boost (_CausticsBoost) property.
    • Renamed “Underwater/Mobile” shader from version 1.1 to “Underwater/Mobile Fast”.
    • Added new “Underwater/Mobile” based on Unity’s “Mobile/Diffuse”.
    • Modified “Underwater/Desktop” to support multiple lights.
    • Added “Underwater/Terrain” and “Underwater/Terrain Fast”.
    • Added “Pool” and “Terrain” demo scenes.

    New in version 1.1:
    • Changed shaders from Low/High to Mobile/Desktop.
    • Added shadows and bump mapping to desktop shader.
    • Added height (World Y) based intensity to caustics.
    • Added height (World Y) based color and intensity to fog.

    Underwater Shaders is a collection of surface shaders that come in 6 variants: Standard, Desktop, Mobile, Mobile Fast, Terrain, and Terrain Fast.
    Additionally, there are alpha transparency versions of the Mobile, Desktop and Standard shaders.

    The fast shaders calculate all lighting and fog effect in the vertex program. Fog is independent of Unity's built in solution and remedies fill rate issues on mobile devices.

    The caustic lighting effect uses a single 4 channel image, saving texture space. All animation is done in the shaders with no scripts needed.
     
    Last edited: Mar 14, 2020
    Gozdek likes this.
  2. Gozdek

    Gozdek

    Joined:
    Jun 21, 2015
    Posts:
    356
    Nice work :)
     
  3. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    Thanks!
     
  4. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    Updated to version 1.1
     
  5. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    Updated to version 1.2
     
  6. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    Does this include the shader used to control the plant movement also or is it just the caustics and fog?
     
  7. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    The shader is just caustics and fog. The demo scene included with the package has plants that are animated using joints.
     
  8. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi !!

    I am interested in your asset but I have some doubts ...

    1) Can you use your asset together with any other asset of water (eg water for Kripto Realistic or PlayWayWater)?

    2) Is there a trial version for test it thoroughly with asset "Realistic water" and see the results and possible problems or bad results?


    regards
     
  9. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    I purchased your asset, but it uses the legacy defuce bumped shader as the base and so is of no use to me. I need to use more of the chanels in the standard shader for the game I'm making. Is there any way for me to get my money back? or is there some way to get the caustics to work with the standard shader instead of the legacy bumped defuce shader?
     
    ftejada likes this.
  10. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    I haven't personally used any of the water packages that you've mentioned. I did read through both of their documentations. It appears as though both of the packages use an image effect or post process for their own underwater effects. The Underwater Shaders package is a surface shader. You can use it just like the standard or legacy built-in shaders. I can't see any reason it won't work with any other packages. I'm afraid that since this package is a collection of shaders, there isn't a trial version. I am happy to help and support you getting the Underwater Shaders to work with your project any way I can.

    Thanks
     
    Last edited: Mar 5, 2017
  11. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    Hi and thank you for purchasing the shaders! The Underwater Shaders package include a version based on Unity's standard shader. You can select from a material's drop down shader selection: Underwater -> Standard. The current version of the underwater standard shader doesn't have all of the properties of the build-in one exposed. What additional properties do you need? I am happy to add them.

    Thank you.
     
  12. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Thank!!
     
  13. Soliso

    Soliso

    Joined:
    Dec 1, 2016
    Posts:
    1
    Hi Sermolux,

    I am looking for your package, to import it in a mobile game. Did you try it and have you got trouble ?

    The 5.5 is here ! So will you update the package for this version ?
     
  14. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    Hi Soliso,
    I originally wrote the first version of the shader to run on mobile. There are two versions "Mobile" and "Mobile Fast" that are optimized for phones and tablets. I am working on an update that will include a package for 5.5. Since these are just shaders, the current package on the asset store should work with 5.5 without issues.
     
  15. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    Updated to version 1.3:
    • Added UnderwaterManager.cs script to manage and edit multiple underwater shaders at the same time.
    • Added "Underwater/Standard" shader based on Unity's physically based shader.
     
  16. sowee15

    sowee15

    Joined:
    Nov 23, 2015
    Posts:
    6
    Hi,
    I just purchased the package, nice work. I am using it on mobile in Unity 5.5. Is there any way to add a tint color to the shaders? In my game I used some vertex lit shaders with a base texture and tint color.

    Thanks!
     
  17. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    setting a negative value for A or B bombs your demo.
     
  18. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    Thanks very much! What version of the shader are you using (Mobile, Mobile Fast)? I'd be happy to modify it and send you a custom shader.
     
  19. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    Thanks for the heads up. I'll check it out.
     
  20. sowee15

    sowee15

    Joined:
    Nov 23, 2015
    Posts:
    6
    Hi Sermolux,

    I am using Mobile Fast, but if you could do both in case I use Mobile some places, that would be great, but I have no idea how much work that represents.

    Thanks!
     
  21. mihakinova

    mihakinova

    Joined:
    Jan 6, 2015
    Posts:
    85
    @Sermolux The UnderwaterManager script will change the Animation value of the materials, so if using version control (such as git or Collaborate), they will show changes every time.

    I added this line to UnderwaterManager, to reset the animation property of the materials to 0 (and also disabled RunInEditMode as I don't need it), but there's probably a better solution:

    Code (CSharp):
    1. private void OnDestroy()
    2. {
    3.     foreach( Material mat in materials )
    4.     {
    5.         mat.SetFloat( "_Animation", 0f);
    6.     }
    7. }
     
  22. MSFX

    MSFX

    Joined:
    Sep 3, 2009
    Posts:
    116
    Can I check I've understood correctly that this package is a surface shader... your shader has to be applied to EVERYTHING in the scene that you want to look like it's underwater?
    Thanks
     
  23. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    Yes, you are correct. Set the shader of a material to one from this package and assign the material to an object that should appear to be underwater.
     
  24. kdeluxe

    kdeluxe

    Joined:
    Apr 30, 2015
    Posts:
    14
    I'm curious if this shader can work behind glass, as in a large aquarium?
     
  25. GS796

    GS796

    Joined:
    Dec 16, 2016
    Posts:
    24
    Can we get an option to support alpha textures?
    Thanks,
     
  26. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    Thanks for the suggestion! I'll look in to adding alpha textures to the shaders.
     
    GS796 likes this.
  27. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    I've added support for alpha transparency with version 1.5. There are special versions of the Mobile, Desktop and Standard shaders.
     
    GS796 likes this.
  28. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    Updated to version 1.5
     
  29. kotoezh

    kotoezh

    Joined:
    May 21, 2013
    Posts:
    21
    Hello,
    I have purchased the shaders and they work good for me, but there is one issue I cannot resolve:
    After some time of working the caustic shader update rate drops down - while game framerate is ok. It can be seen if you compare the beginning and the end of this video: https://photos.app.goo.gl/HLLAlh4YIkBRgppi1
    If affects VR experience greatly. The shader is "mobile fast", the smartphone is moto 1650xt (snapdragon 820).
    Please advice how to fix this behavior?
     
    Last edited: Oct 10, 2017
  30. kotoezh

    kotoezh

    Joined:
    May 21, 2013
    Posts:
    21
    Please let me know your thoughts, I don't like idea of removing the shader from the scene and interested in a workaround. If you need any additional info on the issue I will provide.
     
  31. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    I believe this is an issue on certain android hardware. Please try using the Underwater Manager script. In addition to being able to set the properties on multiple materials at the same time, the script also overrides the shaders built-in animation timer. I have found that on some android devices, calculating the animation in the Underwater Manager script results in smoother motion after a length of time compared to calculating it in the shaders. Please let me know if you need additional help.
     
  32. kotoezh

    kotoezh

    Joined:
    May 21, 2013
    Posts:
    21
    Thanks, in fact I am currently using Underwater manager prefab to manage my materials. Do I need to take special actions to switch this overriding behavior or it is the default and only behavior when using the manager?
     
  33. GS796

    GS796

    Joined:
    Dec 16, 2016
    Posts:
    24
    Thank you for the transparent versions! Is there a way to support double sided though? I have objects (fins) that only have one side. I understand the lighting will not be correct on these faces, but I think it will be ok.
    This shader works well with double sided, but does not support your caustics or fog (obviously)- if there was a way to combine the two that would be excellent even at the expense of accurate lighting. Due to it being underwater, a top down light that does not reveal the issue too much is ok.

    Code (CSharp):
    1. Shader "Mobile/Transparent/Vertex Color" {
    2. Properties {
    3.     _Color ("Main Color", Color) = (1,1,1,1)
    4.     _SpecColor ("Spec Color", Color) = (1,1,1,0)
    5.     _Emission ("Emmisive Color", Color) = (0,0,0,0)
    6.     _Shininess ("Shininess", Range (0.1, 1)) = 0.7
    7.     _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
    8. }
    9.  
    10. Category {
    11.     Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
    12.     zWrite On
    13.     Cull Off
    14.     Alphatest Greater 0
    15.     Blend SrcAlpha OneMinusSrcAlpha
    16.     SubShader {
    17.         Material {
    18.             Diffuse [_Color]
    19.             Ambient [_Color]
    20.             Shininess [_Shininess]
    21.             Specular [_SpecColor]
    22.             Emission [_Emission]
    23.         }
    24.         Pass {
    25.             ColorMaterial AmbientAndDiffuse
    26.             Fog { Mode Off }
    27.             Lighting Off
    28.             SeparateSpecular On
    29.             SetTexture [_MainTex] {
    30.             Combine texture * primary, texture * primary
    31.         }
    32.         SetTexture [_MainTex] {
    33.             constantColor [_Color]
    34.             Combine previous * constant DOUBLE, previous * constant
    35.         }
    36.         }
    37.     }
    38. }
    39. }
     
    Last edited: Oct 17, 2017
  34. kotoezh

    kotoezh

    Joined:
    May 21, 2013
    Posts:
    21
    Well, there are results of my investigation:
    It seems that this issue is related to graphics API used. Glitches disappeared after I forced my application to use OpenGLES2.0 (removed Vulkan and OpenGLES3.0 from Player settings). Hope this info will help you to identify the issue and add support for advanced graphics APIs.

    P.S. Same shader behavior was observed on two different Snapdragon x820 devices: Moto Z and LeEco LeMax2.
     
    Last edited: Oct 18, 2017
  35. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    Thank you very much, this information is helpful. I am looking into the issue now.
     
  36. kdeluxe

    kdeluxe

    Joined:
    Apr 30, 2015
    Posts:
    14
    I'm still curious if this shader can work behind aquarium glass?
     
  37. saarwii

    saarwii

    Joined:
    Mar 7, 2014
    Posts:
    24
    Does this effect work on 2d Sprites as well?
     
  38. SamRock

    SamRock

    Joined:
    Sep 5, 2017
    Posts:
    250
    How does this shader work for a 2.5D games, where the camera is usually away from the player(-Z). How do I handle player being partially submerged. Can I apply shader only to the bottom half of the screen?
     
  39. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    The start and end values for the effects are relative to the camera's position. This should work fine for a 2.5D game. These are surface shaders and not screen effects, so you would need to apply the shader to every object that needs caustic and fog effects. If you look at the WebGL demo, you can set the intensity A and B values to something like 2 and 0 respectively. These are Y positions in world space. Setting both fog and caustic intensity A values to 0 (Slider all the way to the left), and B values to 1 (Slider all the way to the right), you can simulate where the water surface is.
     
    SamRock likes this.
  40. SamRock

    SamRock

    Joined:
    Sep 5, 2017
    Posts:
    250
    Thank you! So you mean I can have a scene that looks like these?
    Where half of object is submerged in water, and I can have Fog and Caustic only applied to them.
     
  41. Sermolux

    Sermolux

    Joined:
    Jun 2, 2016
    Posts:
    28
    If you are using 3d geometry, and not flat artwork it may work. I say this because the caustics in the shaders are projected down in world Y. If you're using flat art and your scene is Y up, you would either get no caustic effects or strange artifacts. Basically you wouldn't want to use any surfaces that are completely vertical, they would need a bit of a slant.

    Additionally, my scripts don't have any water surface effects. You would need to provide your own solution for that.
     
  42. SamRock

    SamRock

    Joined:
    Sep 5, 2017
    Posts:
    250
    Sorry for late response! Was clearing some backlog.. I dont get notification from Unity when there is a response :(

    Thank you again for replying. I will be using it for 3D geomtery, not flat object.

    If you dont mind, you you please post an image or video of how the effect looks with half submerged scene?
    I think I can use the Unity water shader for the surface
     
  43. Berserker44

    Berserker44

    Joined:
    Sep 1, 2013
    Posts:
    29
    Hello, I just bought the underwater shader package and it is amazing! It has everything I needed for my underwater solution, however the shading of the actual shaders do not fit the style of my project. I am going for a stylized toon shading look in my project and I am using Toon Colors Pro 2. I wanted to see if it was possible to actually combine the stylized look of the Toony Color Pro 2 shader: https://assetstore.unity.com/packages/vfx/shaders/toony-colors-pro-2-8105, but still retain the caustic and fog effects you have in your shader. this would really really help out my project as your caustics effects and fog are amazing.
     
  44. Jack-Draak

    Jack-Draak

    Joined:
    Mar 22, 2015
    Posts:
    4
  45. SamRock

    SamRock

    Joined:
    Sep 5, 2017
    Posts:
    250
    Hey this looks cool :)
     
    Last edited: Sep 3, 2018
    Sermolux likes this.
  46. SamRock

    SamRock

    Joined:
    Sep 5, 2017
    Posts:
    250
    I played the game for a while its real fun. You got to tell me how you got those bubbles to work. whats the properties. I m having a though time getting my air bubbles to behave like yours :)
     
    Sermolux likes this.
  47. Jack-Draak

    Jack-Draak

    Joined:
    Mar 22, 2015
    Posts:
    4
    I keep my code on GitHub. The emission rate is controlled in code:

    https://github.com/JackDraak/Unity2018/blob/master/CU2_Boost2018/Assets/_Scripts/Player.cs#L232

    private void AdjustEmissionRate(float newRate)
    {
    thrustBubbles.rateOverTime = newRate;
    }



    And here are a couple screenshots showing the inspector with the player selected (showing the bubbles particle system used as the thrust effect). There are some variations in the game, such as the collision effect and the bubbles that the fish expel now and then, but I think you were asking about this one.

    https://imgur.com/a/YbVw23T
     
    Last edited: Sep 3, 2018
    Sermolux likes this.
  48. Mandelboxed

    Mandelboxed

    Joined:
    Apr 17, 2015
    Posts:
    50
    Love the asset. Have a problem with the terrain shader though. The fog distances seem to be incorrect. First screenshot is with the terrain shader, second is with the mobile shader. Notice how the plants are visible further away than the terrain in the first screenshot. Using the regular mobile shader on the terrain is obvious problematic for other reasons. Let me know if there's anything I can do to fix it. Thanks!

    upload_2018-9-4_0-7-23.png

    upload_2018-9-4_0-8-54.png
     
  49. SamRock

    SamRock

    Joined:
    Sep 5, 2017
    Posts:
    250
    Thank you Jack! Really appreciate it :)

    Will try it out tonight
     
  50. mangax

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    336
    does this support low render pipe line?