Search Unity

[RELEASED] Lux Water

Discussion in 'Assets and Asset Store' started by larsbertram1, Jun 18, 2018.

  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    you have to edit the setup.cginc and uncomment enviro support and comment built in fog.
    but even if you do so: fog on the reflected environment will never fit :( simly because there is no fog from enviro when the reflection camera is rendering.
     
    PeterB likes this.
  2. PeterB

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    342
    I've already edited Assets/LuxWater/Shaders/Includes/LuxWater_Setup.cginc according to the instructions, and I'm using Enviro 2.1, which means the path is valid. Is there a workaround? I'm trying out Lux Water as a replacement for Suimono, which does this correctly (but doesn't get shoreline foam right under Metal). Towards the bottom of page 6 of this thread is a similar situation where Baldinoboy has a similar problem, but your reply indicates that Lux seems to display the fog correctly under Enviro and Azure.

    It is a problem, especially in heavy fog or rain. The reflection is clear, the source of the reflection is almost invisible:

    Screenshot 2019-03-19 at 23.03.55.png
     
    Last edited: Mar 19, 2019
  3. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    12,066
    Hey there @larsbertram1,

    I've just grabbed Lux Water v1.081 and am taking it for a spin. I've got three questions:

    1. I'm not using a water volume, as I have no need to go underwater. When I have the water in my scene (using your "Ocean_5x5 and Skirt" prefab), most of its effects don't show up even in play mode until I've ticked and un-ticked "Uses Water Volume" in the Material. Is there something I've likely missed in setup to cause this?

    2. Both types of foam projector work as advertised, but I can't get normal projectors to work. In the Game window when playing it just displays the particles with normal maps, exactly as in the Editor view (where the instructions say that's what you should see).
    upload_2019-3-22_16-51-24.png
    I have attached the LuxWater_ProjectorRenderer component to my main Camera, and generally followed the instructions you provided on page 35 of the manual.

    3. I've got planar reflections disabled by design. The screen space reflections are good enough for my purposes, except that they also reflect things that are between the water and the camera. Is there something I can tweak to avoid that?

    Thanks very much!

    P.S: I'm loving how nicely this integrates with Azure Sky!
     
  4. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    what is most of its effects?
    checking "uses water volume" should only effect the calculated depth below water surface – which then is taken from the input in "Water Surface Position (Y)" instead of being calculated in the shader. it only effects fog --> depth and light absorption --> depth, nothing else.
    all i can think of is that the particle system misses the projector script. actually it should never render in play mode - at least not in the camera.
    screen space reflections need deferred rendering. but water is rendered in forward. so they do not work by design.
     
  5. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    12,066
    When I enter play mode my water looks like this:
    upload_2019-3-22_22-12-10.png
    When I tick and then un-tick "Uses Water Volume" it then looks like this:
    upload_2019-3-22_22-12-33.png

    When I un-tick "Enable Planar Reflections" I definitely have reflections of some kind visible on the water surface:
    upload_2019-3-22_22-19-51.png

    Looks like that was it. Note that I made it by dragging the prefab into the scene, which I just double checked.

    Thanks for the quick response! I'll check out some more tomorrow.
     
  6. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    ah, that is forced backside rendering mode. i wonder why if you do not use any water volumes...
    the shader samples a water mask (which does not exist) and decides that everything should be under water --> go to backside rendering. it should not do so at all.
    but if checking "uses water volume" fixes it: just check it.
    i will have to look into this later.
    if you uncheck planar reflection the shader takes reflections from whatever cubemap unity feeds in: either reflections from your skybox or a reflection probe.
    strange.
     
  7. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,162
    Enjoy ....


    and there is more and more ... soon further details
     
  8. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    i do :)
     
    antoripa likes this.
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    i looked into the shader code: for some reason your water material must be set to "use water volumes" and "gerstner waves" and activating "use water volumes" in the material inspector fixes this!?
    so it looks like a very strange unity bug...
    please have a look at the frame debugger and find the draw call which renders the corrupted water material: it tells you all active keywords. USINGWATERVOLUME should be listed there which would be a bug...
    actually the prefab misses the script. i will fix it in the next update, sorry.
     
    angrypenguin likes this.
  10. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    630
    I own both right now, Cascade and Lux Water. Will this be an update to the current Cascade asset?
     
    antoripa likes this.
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    that question goes to @antoripa
     
  12. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    630
    Thanks, I should have indicated that in my post.
     
    antoripa likes this.
  13. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,162
    It's a separate asset because the different approach in Lux Water for gestners waves and the water volume for underwater effect.

    But I am checking how give Cascade's users a discount.
     
    Milanis and StevenPicard like this.
  14. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    12,066
    Update: See my next post.

    Before pressing play, "Uses Water Volume" is disabled. When I press play (and immediately after adding the water to the scene) it stays that way, but the water looks incorrect. I then tick "Uses Water Volume" and on its own that doesn't do anything, but when I untick it the water then looks correct.

    Yes, this is initially listed. When I tick and then untick "Uses Water Volume" this is no longer listed.

    Thanks very much!
     
    Last edited: Mar 24, 2019
  15. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    12,066
    Aha, turns out that one of the water tiles in the "Ocean_5x5 and Skirt" prefab does have a water volume on it, which I missed. Removing that has fixed this.

    In other words, it probably isn't a bug at all. User error on my end!
     
    mmaclaurin likes this.
  16. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    :)
     
  17. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    268
    What's the status of fog over water reflections? I'm not sure I understand if it's at all possible, from the comments above. I'm using Azure and Aura 2 along with Lux Water and my scene is looking great aside from Lux Water sticking out whenever I need a lot of fog (rainy weather, etc).
     
  18. wechat_os_Qy07CUX09C0H3p-D_MKb618uI

    wechat_os_Qy07CUX09C0H3p-D_MKb618uI

    Joined:
    Mar 25, 2019
    Posts:
    1
    you see, there is "Metal is fully supported since version 1.05" in asset store page,but in document there is "Metal is supported (Desktop)",anyone tell me why?
     
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    i am still looking into this.
     
    transat likes this.
  20. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,024
    thanks so much for noting this! It was driving me crazy too.
     
    angrypenguin likes this.
  21. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,024
    Lux water meshes are being drawn in front of tree creator trees (Forward rendering, no water volumes) -- is there something I can do to fix that?
     
  22. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    203
    Hi folks, just want to share that I've been using Lux for an infinite ocean using a very simple technique that works great if you're not using gerstner waves (which are lovely but I don't need.)

    I have a simple rectangle for the ocean surface with my camera at one corner looking towards the center. I then have a (very) simple script that moves this rectangle to follow the camera (rotation and translation) without changing height.

    Since Lux works in global space, moving this rectangle around doesn't move the waves around and voila, instant ocean.
     
    StayUpLate likes this.
  23. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,024
    I'm getting thousands of these errors in my game with Lux Water on several rivers, deferred, no water volume. This is new, not sure what changed in our project that might be a factor....any suggestions? (If I disable the Lux Projector Renderer on the camera, then these errors go away.)

    ArgumentNullException: Value cannot be null.
    Parameter name: material
    UnityEngine.Rendering.CommandBuffer.DrawRenderer (UnityEngine.Renderer renderer, UnityEngine.Material material, System.Int32 submeshIndex, System.Int32 shaderPass) (at C:/buildslave/unity/build/Runtime/Export/RenderingCommandBuffer.cs:229)
    UnityEngine.Rendering.CommandBuffer.DrawRenderer (UnityEngine.Renderer renderer, UnityEngine.Material material, System.Int32 submeshIndex) (at C:/buildslave/unity/build/Runtime/Export/RenderingCommandBuffer.cs:235)
    UnityEngine.Rendering.CommandBuffer.DrawRenderer (UnityEngine.Renderer renderer, UnityEngine.Material material) (at C:/buildslave/unity/build/Runtime/Export/RenderingCommandBuffer.cs:240)
    LuxWater.LuxWater_ProjectorRenderer.OnPreCull () (at Assets/06 Models 3.0/Environmental/LuxWater/Scripts/LuxWater_ProjectorRenderer.cs:186)


    Matrix stack full depth reached
    UnityEngine.GL:pushMatrix()
    LuxWater.LuxWater_ProjectorRenderer:OnPreCull() (at Assets/06 Models 3.0/Environmental/LuxWater/Scripts/LuxWater_ProjectorRenderer.cs:170)
     
  24. yankow

    yankow

    Joined:
    Apr 10, 2018
    Posts:
    7
    Hi and thanks for this beautiful asset. I have managed to make a very nice scene with it, but have been struggling with the fact that the water is going through every single object present under its surface. I did try following the indications you gave to a few people already, here: http://wiki.unity3d.com/index.php/DepthMask but with no luck so far. Have you tried making it work? Again thanks!
     
  25. ffertigo

    ffertigo

    Joined:
    May 31, 2015
    Posts:
    9
    all the projected caustic shaders i found ignore the fog of your shader so you can see the caustics far. some work with unity fog but not with your fog and not sure how to edit the shader to respect the fog.
     

    Attached Files:

  26. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    hmm, when do the projected caustics draw?
    they have to draw before the underwater rendering happens. use the frame debugger to see the breakdown od your frame. then you might try to change the render queue of the projector shader. something like transparent-50 may help.
     
  27. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    305
    I cant get the underwater effects to work, I have Lux underwater rendering script attached to my main camera and lux water volume trigger, any ideas what Im missing?
     
  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    a collider? a rigidbody, the water volume?
    it actually nees a lot of components.
     
  29. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    305
    My player has character controller not rigid body or collider
     
    Last edited: Apr 3, 2019
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    if you check "debug" the script should output the current active volume – if you enter any.
    so does it recognize the collision -> volume?
     
  31. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    305
    I fixed it by assigning the volume trigger on the player instead of the camera (was its first child). I am using forward rendering and the docs say that I need to attach a script to the camera called CameraDepthMode, but even if its not attached it works fine, so why do I need it?

    I also build my game for Mac and Linux, does this water work for these two builds?

    Also when I look down underwater I see this and it changes shape depending on the angle


     
    Last edited: Apr 3, 2019
  32. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    to make sure the camera outputs a depth texture.
    mac is fine. i have not tested linux tho.
    your water volume is too big / your camera's far clipping plane is too close.
     
  33. prayash

    prayash

    Joined:
    Jan 30, 2017
    Posts:
    2
    Hi, the water is not rendering on iOS (iPhone X).
    Are there settings I need to change to get it work on mobile? Reading the documentation and it seems likely that these shaders are not meant to work on mobile, which is quite unfortunate because they look really good.
     
    Last edited: Apr 7, 2019
  34. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    305
    I have a problem, when I look down all I can see is foam but when I change the angle and look up I can see the water



    Looking up



    Its like the water becomes transparent when I look down and only foam is visible
     
    Last edited: Apr 6, 2019
  35. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    i have not tested it on mobile. but most likely you will have to add the LuxWater_CameraDepthModescript to your camera in order to make the camera output a depth tetxture which is needed for the water rendering.
     
  36. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    that is a common problem with screen space rendered edge foam: it is heavily view dependent.
    all you can do about this is playing around with the "edge blend factor" and reduce foam on the edges.
     
  37. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    305
    Okay I managed to reduce it, but when I look from above the water looks transparent and when I look from an angle I can see it, is that how its suppose to be or it can be fixed somehow?



     
  38. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    you have fog and absorption – both along view (= view dependent) and along depth below surface.
    so try to find a nice balance between view and depth.

    another thing that misses when viewing from above are reflections. these kick in at grazing angles (fresnel).
    while the default behaviour should be physically accurate you may increase the reflection strength when viewing from above by raising the specular color.
     
  39. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    920
    Looking for a water shader package compatible with Oculus Go. Does LUX work okay?
     
    Last edited: Apr 14, 2019
  40. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    lux water still does not support single pass stereo rendering...
     
  41. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    398
    I tested a lot of water assets recently for use in VR, I decided to go with Lux - even though only working partially in single pass. The water itself works. Underwater effects and ripples don't work. I use a custom script to detect being underwater (based on the included SetToGersnterHeight script) and then just enable (fade in) single pass compatible third party effects, like blur. It's not a pixel perfect underwater transition, but for now it's the best solution for my case.
     
    KarelA and larsbertram1 like this.
  42. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    920
    @iddqd Thanks for that info. I went ahead and bought Lux water before I saw @larsbertram1 and your reply. For my current project I only need above water so I hope it works. At any rate for $10 I figured it was worth a try. :)
     
  43. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    920
    @iddqd When I tried single pass with the Ocean Demo there was a shader compilation error in the build (Unity 2018.3.11df1) - Multi-pass at default settings is very slow.. If you have any recommended adjustments to share it would be appreciated

    Code (CSharp):
    1. Shader error in 'Hidden/Lux Water/WaterMask': invalid subscript 'instanceID' 'UnitySetupInstanceID': no matching 1 parameter function at Assets/LuxWater/Shaders/Includes/LuxWater_Tess.cginc(30) (on gles3)
    2.  
    3. Compiling Vertex program with STEREO_INSTANCING_ON GERSTNERENABLED
    4. Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 SHADER_API_MOBILE UNITY_HARDWARE_TIER2 UNITY_COLORSPACE_GAMMA UNITY_LIGHTMAP_DLDR_ENCODING
    5.  
    6.  
    Edit: I am not seeing water in the editor unless i use deferred rendering
     
    Last edited: Apr 14, 2019
  44. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,104
    you have to add the "LuxWater_CameraDepthMode" script to your camera.
     
    ibyte likes this.
  45. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    398
    @ibyte

    Did LuxWater_CameraDepthMode fix your issue? I noticed that I don't have that Script on my Camera.

    Here are my partial settings. If I remember correctly, I had to disable Planar Reflections and Water Volume for it to look correct.

    upload_2019-4-15_11-16-40.png

    I have forward rendering + single pass.
     
  46. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    920
    Thank you for the settings.

    I was able to get forward rendering working after my first post.

    I am seeing a number of issues not sure if they are resovlable

    1) was hoping to get moon light reflections on the water (editor view)

    upload_2019-4-15_10-44-51.png

    2) I see white specs (very light snow) appearing/disappearing when I move my head

    3) I have tried planner reflection both on and off - I see some but they don't look right. Could just be settings adjustments. The highligts of the moon reflection look black near the edge to the platform. I the editor they are white. They start to look better farther out when the moon is lower in the horizon and casting a longer reflection.

    4) Still not able to get single pass to compile. Both lux and enviro have shader errors.

    It would be nice if the view in the editor was much closer to what the actual device is capable of. :(
     
    Last edited: Apr 15, 2019
  47. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    398
    I can get only Skybox reflections, so I guess it depends if the Moon is part of the Skybox or not.
    I checked yesterday and couldn't see any white specs on my Vive.

    Strange regarding the compile errors, I don't have any (latest Lux and Unity 2018.3.8f1)
     
  48. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    920
    @iddqd, yeah this is on the Oculus Go (Android) so some differences when it comes to compiling for graphics. I will try a build for the Rift but my target at the end is OGo.
     
  49. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,024
    I'm setting up the SetToGerstnerHeight script to make some boats buoyant in the ocean -- very nice! But I can't get it to work quite right. It works great for the submarine in the demo scene, but with my small fishing boat, the boat moves up and down too much, so it goes half underwater, then mostly out of the water, with each cycle. Reducing Damping Y to very small values, and even zero, does not help. Any tips?
     
  50. MightyAnubis

    MightyAnubis

    Joined:
    Jan 29, 2018
    Posts:
    19
    Hey all together, i think this is a really great Asset.

    But i have one Question, maybe i miss it in Dokumentation ? I try a lot of testing around with the Ocean (including Water Volume) but i not able to bring it to bigger or smaller Waves.

    so my Question is: is there a Way to affekt the Wave Hight, if you using "Azure Sky Box" and change the Weather to different Settings ? ( For example: Bigger Waves @ Rain or Storm) ?

    i try a lot of settings in the Gestener, but i never see a really good Effect on the Waves Hight.
    i cant imagine that is not includet. How to fix that ? Any Ideas ?

    PS: Countine the Work, Lux water, is for me the best Water Addon i see in Asset Store. There some others, but only Addon what i think is also cool, only supports LWRP and is not useful to me.

    oh, one Question is left: The "Deep" of the See, go to fast dark. I try a lot Settings, but i can not made to bring it to "mor light" in the Deep, so for example: If you try a Submarin, it will be at a deep of ~ 15 up to 20 Meters Diving Depth absolutly "night", no light left.

    Any Ideas to bring the Light deeper ? Like ~ up to 100 Meters ? So that not all is pure NIght ? ( Model Scale can not be smaler, or Waves will overlap your Model... )