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. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    kripto,

    When do you think that I could see specular in the shader without a second mesh? In my opinion that could launch your water to the top on the store, and you can be sure I would help with that. Strange enough you have one of the best waters and it is not even close to the top when searching for ocean water in the Asset Store which in my opinion is deserved.

    Regards,
    Carlos
     
  2. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    hey, just got your asset, i can't make the mobile version work, the reflection is reversed, mirror, any subjection ?
     
  3. HakJak

    HakJak

    Joined:
    Dec 2, 2014
    Posts:
    192
    Overall awesome asset! However, I can't get any type of fog to work with this (see screenshot below), particularly Global Fog from the Standard Assets. I'm working on a Mac with NVIDIA GeForce GT 755M 1024 MB, in Deferred rendering, with Linear color. I've tried changing to Forward and Gamma, but that doesn't work either. Seems like this should be a simple fix. Any ideas?? Please help!
     

    Attached Files:

  4. HakJak

    HakJak

    Joined:
    Dec 2, 2014
    Posts:
    192
    Nevermind... I'm an idiot. Apparently I just had to ensure that the Fog was checked under the Lighting window. Apparently the Global Fog script is linked to that.
     
  5. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Where is kripto? Has anyone seen him?;)
     
  6. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    He mentioned not long ago that he's working full time now, and has little time to spare.
     
  7. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Darn! I was hoping to get the update with the specular in the shader soon.
     
  8. KyleOlsen

    KyleOlsen

    Joined:
    Apr 3, 2012
    Posts:
    237
    We are experiencing the same issues that Tethys reported on the previous pages. Here are some examples of the problems this shader has with non-planar setups:





    Also looks odd past global fog distances:
     
    Last edited: Jan 6, 2016
    Tethys likes this.
  9. Deleted User

    Deleted User

    Guest

    The 'foam' doesn't seem to be featured in any of the demo scenes. Is there a video / demo of this in action anywhere, would love to see how the foam looks in motion ?

    Nevermind, just purchased, subscribed to watch further development.
     
    Last edited by a moderator: Jan 17, 2016
  10. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    Hello,
    Sorry for long answer. I had the problem. On the forum if there are new messages, I do not get the notice in the mail.

    Realistic specular must use the vertex position, normal, bdrf lighting and other shader settings.
    Now I plan to finish the pack of explosions. After that, I probably be working on tessellation and learn how it works bdrf lighting, Fast Fourier transform in the shader and other technics. Only after learning I can make a realistic specular.

    If you urgently need to remove the second mesh, I can merge specular shaders and water shader, or you can wait next update. But the exact timing I can not give, because it does not know the complexities of working with tessellation / bdrf / fft / sssr and other technics.

    Global Fog not worked with transperent objects. (even standart water4 not worked).
    You can try change water shader like a "Queue"="Transparent-500" instead of "Queue"="Transparent"
     
    Last edited: Jan 22, 2016
  11. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    Transparent object (like a standart water4) have this problem with fog and z-sorting.
    You can try to use "ZWrite On" and "Queue"="Transparent-500" for water shader, but then you will have some problem with sorting of tranparency objects.
     
    Last edited: Jan 22, 2016
  12. ELRIIC

    ELRIIC

    Joined:
    Nov 22, 2015
    Posts:
    15
    Does Realistic Water support custom flow maps?

    I want to create a river, and the visual of this package is impressive, but I cannot see any related visual for a river.
     
  13. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    Hello,
    Flow map not supported in the current version.
    Also, how you want to create flow map? In the unity editor?
     
  14. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    may be could be nice to be able to draw flow map with a brush in editor.
     
  15. ELRIIC

    ELRIIC

    Joined:
    Nov 22, 2015
    Posts:
    15
    I'm planning to create a flow map outside of the engine. Ofc is nice to have the option to do it inside, but as with most in Unity, we are directed to non-native solutions.

    So without flow map, no river :(

    Any suggestions for a good looking river solution? I have Flow in mind but the fact that is not updated for Unity 5 worries me.
     
  16. jimmychew85

    jimmychew85

    Joined:
    Jan 10, 2016
    Posts:
    2
    i have a problem on reflection. It is ok when i tested in unity but when i tested in iOS device, the reflection seems inverted. You can refer to the images.
     

    Attached Files:

  17. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    Hello,
    Try to open shader and chage this line

    Code (CSharp):
    1. #if UNITY_UV_STARTS_AT_TOP
    2.     fixed scale = -1.0;
    3.     #else
    4.     fixed scale = 1.0;
    5.     #endif
    on
    Code (CSharp):
    1. #if UNITY_UV_STARTS_AT_TOP
    2.     fixed scale = 1.0;
    3.     #else
    4.     fixed scale = -1.0;
    5.     #endif
     
    jimmychew85 likes this.
  18. jimmychew85

    jimmychew85

    Joined:
    Jan 10, 2016
    Posts:
    2
    Thanks for this. Is working now...
     
  19. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Flow maps can be created with assets like flowmap generator and they can be directly painted, its pretty expensive but Mari has a tool for this, flowmaps are 2D vector fields - latest version of flowmap gemerator is a bit iffy with unity 5 but they do a standalone version.

    Kripto i have been looking into adding flowmaps into your shader myself, i think its possible to use a texture read in the vertex shader to add the direction value in the flowmap (usually the r and g channels) to add to the vertex displacement - flowmap generator puts foam generation in the blue channel, this could be useful too - if we were able to put an overall displacement value in the alpha channel to add some variation in river flow this could be really useful - the flowmap could be able to provide directionality in a much more controlled and much less annoying way than figuring out gerstner values

    I dont think you really need to know fft or the wave spectrums they can process but it can be a nice alternative wave type, especially for oceans, for pools i quite like gerstner waves although the philips spectrum is nice too
     
  20. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    298
    ...on my project in unity 4.7 Pro,
    and your "Water PC" shader,
    ..the Foam problem ...on InfiniteWaterMesh object,
    it seems...to be present only for low water depths,
    less-than 4.7m, for instance... Sea object Y is zero here...

    but ... more than 4.7m - it looks - not to be there.... Sea object Y is 4.7m here...
     
  21. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    298
    ...Cripto, can you
    help me adjusting your scirpt, so we can assign ARRAY of camera's
    in the scene, for underwater effects, instead of only ONE allowed,
    right now, for underwater effects ?
    ...i have gliders, tank, boats, and planes together in my scenes,
    and each of them have their own camera...
     
    Last edited: Feb 23, 2016
  22. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    Hello,
    This screen in the play mode? In editor mode worked only deffered rendering correctly.

    Can you send your scene for me? Or some demo?
     
  23. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    298
    Its the "UnderwaterPostEffects" script...
    Currently only allows ONE camera to have underwater
    effects ("Camera.main").
    we need it adjusted, so we can assign in Inspector,
    MORE camera's from the scene we want to have underwater effect.
    (because, Cars have separate camera's, boats have them as well, etc).
     
    Last edited: Feb 20, 2016
  24. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    Code (CSharp):
    1. public class UnderwaterPostEffects : MonoBehaviour
    2. {
    3.     public Camera[] Cameras;
    4.     public Color FogColor = new Color(87f/255f, 190f/255f, 219f/255f, 1);
    5.     public float FogDensity = 0.05f;
    6.     public bool UseSunShafts = true;
    7.     public float SunShuftsIntensity = 1.5f;
    8.     public ShaftsScreenBlendMode SunShuftsScreenBlendMode = ShaftsScreenBlendMode.Screen;
    9.  
    10.  
    11.     private Vector3 SunShaftTargetPosition = new Vector3(0, 7, 10);
    12.     //private Camera cam;
    13.     private SunShafts SunShafts;
    14.  
    15.     void OnEnable()
    16.     {
    17.         //cam = Camera.main;
    18.         foreach (var cam in Cameras) {
    19.             SunShafts = cam.gameObject.AddComponent<SunShafts>();
    20.             SunShafts.sunShaftIntensity = SunShuftsIntensity;
    21.             var target = new GameObject("SunShaftTarget");
    22.             SunShafts.sunTransform = target.transform;
    23.             target.transform.parent = cam.transform;
    24.             target.transform.localPosition = SunShaftTargetPosition;
    25.             SunShafts.screenBlendMode = SunShuftsScreenBlendMode;
    26.             SunShafts.sunShaftsShader = Shader.Find("Hidden/SunShaftsComposite");
    27.             SunShafts.simpleClearShader = Shader.Find("Hidden/SimpleClear");
    28.  
    29.             var underwater = cam.gameObject.AddComponent<Underwater>();
    30.             underwater.UnderwaterLevel = transform.position.y;
    31.             underwater.FogColor = FogColor;
    32.             underwater.FogDensity = FogDensity;
    33.         }
    34.     }
    35.  
    36.  
    37.     // Update is called once per frame
    38.     private void Update()
    39.     {
    40.         if (Cameras.Length==0)
    41.             return;
    42.         foreach (var cam in Cameras) {
    43.             if (cam.transform.position.y < transform.position.y) {
    44.                 if (!SunShafts.enabled)
    45.                     SunShafts.enabled = true;
    46.             }
    47.             else if (SunShafts.enabled)
    48.                 SunShafts.enabled = false;
    49.         }
    50.  
    51.     }
    52. }
     
    OZAV likes this.
  25. gameDevi

    gameDevi

    Joined:
    Oct 14, 2015
    Posts:
    155
    Hello kripto,

    I'm having an issue with my fireball projectiles becoming invisible when the water is behind them. I'm using (Magic Arsenal)

    Any ideas how to fix this?
     
  26. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    You need open water shader and change "transparent +1" to "transparent"
     
  27. gameDevi

    gameDevi

    Joined:
    Oct 14, 2015
    Posts:
    155
    Thanks..

    Works well :)
     
  28. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    298
    Thanks, Kripto, just testing new script...
    ...it's a quick fix, for now - it worked :)
    ...did a bit testing with all camera's...
    (now, Sun Shafts function seems to still cause
    some problems...Sun Shafts are active even if
    camera isn't in the water...
     
    Last edited: Feb 23, 2016
  29. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    298
    ...it's in the play mode (i use deferred lighting, yes)
    ...the broken infinite Water Mesh foam,
    it seems to appear only under some rotation angles of camera,
    and - not with all view angles...
    (...on forward lighting - its much worse,you can see lines, as well...)
    so how do we fix this foam surface problem ?
     
    Last edited: Feb 23, 2016
  30. eamrle

    eamrle

    Joined:
    Dec 28, 2014
    Posts:
    1
    This is my project in which I included this water with scripts written by me, it took me 2 hours to edit, in my view is very real.There Caustics needed, and all is perfectly
    For My Nvidia 9400 GT In High Quality Settings, Framerate is: min ~ 25.4 Fps, max ~ 28.9 Fps.




    In scene mode no reflections
     
    Last edited: Mar 6, 2016
  31. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    Hello,
    In scene mode reflection camera not worked correctly, so i've remove editor reflections, because i can't fix it =\
    Also, water is very good :)
     
  32. beejou

    beejou

    Joined:
    Mar 7, 2016
    Posts:
    1
    Hi kripto,

    Great work on this. I am new to shaders and was wondering if there is a way to gradually change the flow of the water. I tried lerping between different values for the "Waves Direction 1 & 2" attribute on the WaterPC shader, but that doesn't seem to be the right approach.

    Thanks!
     
  33. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    Hello,
    I tried to add this function in last version, but it had problems. So, right now i can't impement this.
     
  34. kaenna1

    kaenna1

    Joined:
    Feb 21, 2014
    Posts:
    4
    Will this be updated for Unity 5? Will there be any further development?
     
  35. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    Unity 5 supported. Demo created using unity5.
    Right now i not have free time, because I'm moving to work in another city. In the future i'll work with tesselation/ssr/.. and other settings for water. But I can not give exact dates.
     
  36. kubajs

    kubajs

    Joined:
    Apr 18, 2015
    Posts:
    58
    Hi Kripto,
    First of all I'd like to thank you for the great asset. It's really impressive work!

    One slight problem I met - when I have quite a deep underwater terrain, caustic tiles are sometimes missing. I can partially fix it by setting higher far clip plane number in projector settings but this solution has a downside - no or too weak caustic effect in shallow water. For example if I set the far clip plane value to 30, the caustic effect in shallow water is too weak or not visible.
    It would be great if the strength of the caustic effect fades out with the water depth.
    Would you advise me the best solution for dealing with this? Please see my screenshots in attachment.

    I solved another issue I had with 2 waters: as I have sea water on lower level and lake water in the mountains, I couldn't use the default y position check for underwater effect as underwater fog effect would be rendered despite I'm not in fact in any water. Instead I put trigger collider on both waters' surface (Y collider size 0) and used Raycast to deal with that problem.
    I can provide more details if anybody is interested.
    Basically I use bool InWater property initially set to false.
    When InWater property is false, I raycast up from player's camera position and when hitting water surface above (directly - not using RayCastAll) - it means I'm in water, I set the InWater property to true.
    When InWater property is set to true, that time I raycast down from player's camera (to check whether player left the water) and when I hit water surface, I set the InWater property back to false.
    Something like this:
    Code (CSharp):
    1.  
    2. void Update() {
    3.   InWater = TargetInWater(InWater);
    4. }
    5.  
    6. private bool TargetInWater(bool inWater)
    7.     {
    8.         Vector3 directionCheck = InWater ? Vector3.down : Vector3.up;
    9.  
    10.         RaycastHit hit;
    11.         if (Physics.Raycast(target.position, directionCheck, out hit, 2f, waterMask))
    12.         {
    13.             inWater = !inWater;
    14.         }
    15.         return inWater;
    16.     }
    17.  
     

    Attached Files:

    Last edited: Mar 10, 2016
    Tethys likes this.
  37. Tethys

    Tethys

    Joined:
    Jul 2, 2012
    Posts:
    672
    The fix for being underwater is something that has been needed in this asset for a long time, I had mentioned this as well. A check for height in Y just will never work, as there will most likely be areas in a game environment that are as low as water that do not have water in it. This is the issue we ran into as well - setting it up for Raycasting and collision with a specific layer is the proper way to set this up, I agree (and thanks for sharing your fix for it).
     
  38. VeNoM79

    VeNoM79

    Joined:
    May 13, 2014
    Posts:
    9
    Hi Kripto,
    newbie here and maybe i'm missing something. I've placed the Pool prefab in the scene and it's ok, but after i click play the object change color as you can see in the image attached. I can only resolve this, disabling the reflection camera script of the child object "water" or disabling caustic.
    Can you please give me some advice about it?

    Edit: i forget to tell you that the picture is in top-down view and on the left there are stairs.
     

    Attached Files:

    • IMG.jpg
      IMG.jpg
      File size:
      1.9 MB
      Views:
      882
  39. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    501
    Can you write me on skype "scar289"?
     
  40. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    I have two questions:

    Does it work with worlds generated procedurally?

    Is it possible to create rivers and oceans? And the union between a river and an ocean looks good?
     
  41. VeNoM79

    VeNoM79

    Joined:
    May 13, 2014
    Posts:
    9
    Kripto,
    i'm on skype (web), drop a msg when you're on, thanks.
     
  42. VeNoM79

    VeNoM79

    Joined:
    May 13, 2014
    Posts:
    9
    Someone here knows also how to scale the pool prefab? I've read the documentation but i don't know what's wrong :\
    I'm trying to do a flooded room with this asset, so i'm using the pool prefab with dynamic ripples but as i scale up the size, ripples become very big and look horrible.
     
  43. l3mon

    l3mon

    Joined:
    Jan 25, 2016
    Posts:
    21
    Any demo of your underwater effects?
    Does the package contain a wet lens effect?
     
  44. Drommedhar

    Drommedhar

    Joined:
    Sep 24, 2013
    Posts:
    78
    Hey,

    just bought the asset but got 2 problems currently:

    1. Caustics are not visible on some water planes (2 in scene)
    2. One water plane (the one without caustics) on certain angles get's green (on the part where the depth color should be)

    This also happens if there is only the problematic plane in the scene, which is a copy of the other one (which is working fine). Do you know what the problem is here? Otherwise the asset looks great, but with these problems, it's not usable for us right now.

    Running Unity 5.3.

    EDIT:
    That's what I'm looking at right now:
     
    Last edited: Mar 31, 2016
  45. Hormic

    Hormic

    Joined:
    Aug 12, 2014
    Posts:
    251
    I optimistically buyed it now during the 24h sale and hope it will be developed and updated further,
    cause the latest version seemed a little outdated and several people have issues.
    So hopefully not another asset for the garbage-collection.
     
  46. Locky

    Locky

    Joined:
    May 14, 2015
    Posts:
    86
    I just picked up this asset and want to slow down the waves. I adjusted the "Speed" setting on the "Water Ripples" component but it does not seem to have an effect. How can I make the water calmer with less and slower ripples?
     
  47. AntonBertelsen

    AntonBertelsen

    Joined:
    Oct 13, 2014
    Posts:
    37
    Hi @kripto289.

    I just bought your package on the asset store, and I'm quite happy with it.

    I'm using the new public beta Unity 5.4b11, and I noticed that the water is always being drawn on top of sprites and particle systems:



    Even the splash effects in your demos look broken.

    I tested the package in unity 5.3.4f1 as well, and everything works like it's supposed to in this version.
     
  48. iphonedeano

    iphonedeano

    Joined:
    Oct 17, 2012
    Posts:
    9
    Hi,

    I bought this water asset and have loaded it into my scene and it looks great.
    I am using the PC sea on the Mac with no issues, I did have to play around with the underwater projector settings to get it to fully work.
    I do have a few questions that I would like to put to your self and the smart community out there.

    My sene is a series of Islands (each island called in by scene) with players on each island being able to visit there friends island, so opefully move the game into a multiplayer game.
    The main question is; if each person in the game is carrying is sea rendering plane with him/her then when two players become close to each other? I would expect to get jitter of the two planes. I have not tried to do this yet but i'm pretty sure the effect would not look good.

    I could just use a larger sea but I can not scale the sea in this asset with out loosing quality when close up.

    My other question is; does the under water fog density work? I am changing the factor but nothing appears to happen. I still looks like the clearest water on the planet.
    I could just script something in, but it would be nice to know if it does work before I alter things.

    How yes, sorry just thought of another question, how do games like GTA get around large sea planes?

    I would appreciate any advice on the accepted way for placing sea and not require a main frame computer to achieve the GTA effect.

    Thank you to you all

    Dean
     
  49. yvesgrolet

    yvesgrolet

    Joined:
    Jan 22, 2014
    Posts:
    10
    Hi,

    About WaterRipple.cs perfomances:

    I would like to know if there is any reason to have the displacementTexture SetPixels() and Apply() in the FixedUpdate() ?

    This takes 5 milisec on my machine (in Editor). If i move this code in the regular Update(), all that time is gone. This is probably due to the fact that FixedUpdate is on the Physics thread and need to wait for rendering critical section end before being able to touch to the displacementTexture.
    In the main thread, there is not this thread wait operation. So, it safe a lot of performances.

    Cordially,
    -- Yves Grolet
     
    HXCMAN likes this.
  50. Crembo

    Crembo

    Joined:
    Jun 2, 2014
    Posts:
    16
    Hello,

    When I decrease wetness strength below 1, I get these weird white outlines around the water area:
    wrong_wetness.PNG
    Unity 5.3.4, Linear, Deferred, HDR