Search Unity

[RELEASED] Lux Water

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

  1. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    I switched to non tess shader and still get the crash but different error this time (no trying to access pass 3)

    https://pastebin.com/98ts2Nq0
     
    Last edited: Mar 16, 2020
  2. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    201
    Hi, is it possible to achieve a metallic tinted look to the material? I know its not realistic but I'm looking for something that is almost opaque and is more like a deep red mercury:

    upload_2020-3-17_0-52-42.png

    I'm struggling getting a strong surface definition when the depth of the water is light, its always going to virtually transparent. I cant seem to get that oily sheen with the deep red.
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    errors are still the same: unity can't create the buffer. please have a look at the size the camera renders. seems to be 128 x 2 px.
     
  4. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    the specular color is exposed.
     
    f0ff886f likes this.
  5. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    where can I see this size? at the bottom I see some render buffers that disappear if I remove post processing could it be caused by that and not water ? The weird thing is that sometimes I get a full crash and other times the game continues playing and I hear the music, so maybe the camera is crashing for some reason. I also cant find a texture in my project that has that size 128x2.
     
  6. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    it looks as if some script (maybe lux water) asks unity to create such a render texture. lux water would do so if your 2nd camera was set to output such a small view.
     
  7. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    Can you say which file and line creates that texture for lux water
     
  8. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    the lux underwater rendering script.
     
  9. blackant

    blackant

    Joined:
    Jun 18, 2009
    Posts:
    529
    i have some rpoblems with lux water,

    like you seen with the prefab, i have also this error now...


    ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.Collections.Generic.List`1[T].RemoveAt (System.Int32 index) (at <437ba245d8404784b9fbab9b439ac908>:0)
    LuxWater.LuxWater_UnderWaterRendering.DeRegisterWaterVolume (LuxWater.LuxWater_WaterVolume item, System.Int32 ID) (at Assets/LuxWater/Scripts/LuxWater_UnderWaterRendering.cs:378)
    LuxWater.LuxWater_WaterVolume.OnDisable () (at Assets/LuxWater/Scripts/LuxWater_WaterVolume.cs:52)

    and strangelly when i check/uncheck the use volume case, i can see that the mesh is animated when it is unchecked, but not when checked. and this is not always happening...

    Screenshot at 2020-03-18 11 24 50.png Screenshot at 2020-03-18 11 24 56.png
    also the color reflection is different in both cases
     
  10. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    that sounds as if something went totally wrong... you seem to have messed up with the volumes registered/unregistered.

    that is how unnity handles _Time which drives the animation in the shader. no reason to worry.
     
  11. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    201
    (this is in reference to getting a metallic look on water)

    So specular helps but I realized my problem: I can't get the water to look almost opaque with the specular colour (or the fluid colour) if its incredibly shallow (so just my water mesh is right above the ground, it looks as shallow as water should). Is there a way to get Lux to just always render as if it was a deep dark ocean through the surface, regardless of actual distance to an underlying surface?

    I'm trying to replace the old Unity StandardAssets Water and its look and feel has found a home in our game, but the performance has not :D
     
  12. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    you can tweak the light attenuation driven by depth below surface.
     
  13. Nils-Desle

    Nils-Desle

    Joined:
    Jan 4, 2015
    Posts:
    9
    Hi there, I love Lux Water, great asset and glad I bought it. I'm integrating it in my game as we speak, but I'm wondering if anyone has a good texture or entire prefab for making a bow wave on a boat they are willing to share? Would save me some time as I'm not the best artist in the world...
     
  14. Nils-Desle

    Nils-Desle

    Joined:
    Jan 4, 2015
    Posts:
    9
    I meant a normal projector by the way. D'oh.
     
  15. Nils-Desle

    Nils-Desle

    Joined:
    Jan 4, 2015
    Posts:
    9
    Another question: is it possible to not render specular sun reflections on the parts of the water that are in the shadow? I'm using a lot of water in chasm like river situations, and get false specular sun reflections in shadowed areas. Thanks!
     
  16. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    unfortunately:no. unity legacy does not support shadows on transparents.
     
  17. Nils-Desle

    Nils-Desle

    Joined:
    Jan 4, 2015
    Posts:
    9
    Ah too bad. I'll just have to position my sun smartly then so it's not too obvious. Thanks for the reply!
     
  18. blackant

    blackant

    Joined:
    Jun 18, 2009
    Posts:
    529
    Hello,
    i 'm facing this kind of problem actually,
    i am using a shader on my fish, that make them animated easylly, but, because it's a vertex animation, the shader is not rendered correctly...
    i tryed to change order to something like transparent, but if it looks good for the fish, now, it doesn't receive underwater occlusion over it...

    i'm a bit stuck and don't know wich decision to take about this....
    is there any possility for the fish shader to be improved in any way or any other trick ?
    Screenshot at 2020-03-23 11 26 56.png
    Screenshot at 2020-03-23 11 10 52.png
     
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    you have to make sure that the your vertex animated shader writes properly to depth (which it does not do right now i would say). if it was a surface shader adding pragma "addshadow" should do the trick (as shadow and depth pass are the same when it comes to forward).
    https://docs.unity3d.com/Manual/SL-SurfaceShaders.html
     
    blackant likes this.
  20. bear56

    bear56

    Joined:
    Jan 23, 2018
    Posts:
    8
    If I setup two cameras into the underwater volume the fog is disappear. And screen shows :
    Active water volume : none
    Registered volume : 0

    Can multiple camera at the same underwater volume with fogs ?
     

    Attached Files:

  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    please refer to the splitscreen demo.
    other multiple camera setups are not supported. and i do not know why they should.
     
  22. Nils-Desle

    Nils-Desle

    Joined:
    Jan 4, 2015
    Posts:
    9
    Hi, I have a small problem: when the water is seen through a transparent object with Unity (2018) default shader FX/Glass/StainedBumpDistort, it works fine in the editor, but in play mode, the water is not drawn behind the transparent object. I've played with the renderqueues a bit, but that does not seem to help. Any idea what could be going wrong?

    upload_2020-3-25_16-43-42.png
    upload_2020-3-25_16-43-56.png

    Thanks
    Nils Desle
     
  23. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    might be a sorting or static/dynamic batching problem.
    use the frame debugger to see the exact order in which the transparents get drawn then tweak the queues accordingly.
    you will have to decide what shall refract and see what. most likely glass shall see water. then glass has to be drawn after water and use a custom grab texture.
     
  24. Nils-Desle

    Nils-Desle

    Joined:
    Jan 4, 2015
    Posts:
    9
    Using the frame debugger, I could see that the grabpass that was done in the glass shader was optimised out somehow because it used the same default name as the water shader ("_GrabTexture"). Once I renamed it in the glass shader, the pass was actually performed and then the water showed up fine (and refracted) through the glass. Problem solved, thanks!
     
  25. egable

    egable

    Joined:
    May 21, 2014
    Posts:
    23
    Lars,

    I'm having an issue with render ordering in the Unity Scene View. In the Game view, the water renders over top of the terrain (because it has a higher Y position value than that part of the terrain). However, when looking at the scene view, the water renders first, then the terrain over top of it, even though the terrain has a lower Y value than the water. Do you have any idea how I can fix this? It's really messing up my attempts to see what's going on with things. I assume it's an ordering problem or depth buffer test issue or something. I'm just not sure where to look for the issue.
     
  26. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    water is transparent. terrain should use the geometry queue. so the terrain should always render first. do you use a weird transparent terrain shader?
     
  27. Nils-Desle

    Nils-Desle

    Joined:
    Jan 4, 2015
    Posts:
    9
    Hi, I have another question: I'm using a second camera + render to texture to provide a mirror effect. When the second camera renders, the water does not show up (just the red box underneath the water). I've checked in the frame debugger that the water object itself is rendered, but it just does not show up. Any ideas on what to try? I've attached a screenshot of the frame debugger to help you see what's going on, and can supply more info if needed...

    upload_2020-3-27_15-14-38.png

    Regards
    Nils
     
  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    what shall mirror what? most likely you want the water to reflect the environment.
    in this case the planar reflection script would be waht you need. and it does not have to render the water itself of course.
    or do you want to mirror the water on a different mesh? well, then...
    actually i see water in the gameview. but only in front of the skybox. so i assume that your near and far clip plane of the reflection camera does not match the settings you use on the main camera. this may lead to edge blending based on the depth buffer making the water vanish. so try to change the edge blending value while the frame debugger is active.
    in the end you may have to use 2 different water materials - or make the near and far clipping planes of both camera match.
     
  29. Nils-Desle

    Nils-Desle

    Joined:
    Jan 4, 2015
    Posts:
    9
    Hi Lars, for now, I want the mirror to reflect the water (I've turned off planar reflections on the water for now, will fix mirroring recursion later, once I get the mirror to work). Good call on seeing that the water IS actually drawn, but the red box is obscuring it! If I remove the red box, the water is visible, but other scene geomtry is not properly depth sorted with the water I think, so there must be some depth issues happening? I tried setting the mirror camera's near and far plane to be the same as the main camera, but that did not fix it. I tried playing with the edge blending value while in play mode, but that did not fix the water in any way in the mirror camera. Any other ideas? Once I get it working, I was already considering having two different water materials as you suggest, but for now I would just like to get it showing in the mirror.

    Thanks for the support!
    Nils
     
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    unfotunately: no.
    you may try to rotate the red cube and see if the water shows up somewhere. or simply move it downwards.
    i still think it is edge blending...
     
  31. Meceka

    Meceka

    Joined:
    Dec 23, 2013
    Posts:
    423
    Hello. Is this asset going to support URP in the future?
     
    knxrb and AnvilNight like this.
  32. egable

    egable

    Joined:
    May 21, 2014
    Posts:
    23
    I'm using Microsplat terrain shader.
     
  33. Nils-Desle

    Nils-Desle

    Joined:
    Jan 4, 2015
    Posts:
    9
    I figured it out: the script to calculate the mirrored camera calculates an oblique projection matrix that messes up the near/far plane quit substantially, and gives some kind of non-standard depth range that does not play nice with the water shader, as you suspected. Since this range can change every frame, I could not tweak the shader to always look good, so I went with a separate traditional Unity water shader for the reflection in the mirror. Works well enough for me.

    Regards
    Nils
     
  34. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    that makes sense. glad you found the cause.
     
  35. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    then everything should work fine.
    did you ever post a screen shot showing how terrain/water looks like?
     
  36. Skeketor23

    Skeketor23

    Joined:
    Apr 6, 2019
    Posts:
    49
    Hi there,

    I just purchased the asset and want to use it on mobile. But when I switch to iOS, all materials don't work anymore.
    Am I missing something?
    upload_2020-4-7_13-21-32.png

    UPDATE: forget it, I had to add the Lux Water_camera Depth Mode Script to the camera.
     
    Last edited: Apr 7, 2020
  37. terpardev

    terpardev

    Joined:
    Dec 4, 2019
    Posts:
    10
    Hi @larsbertram1,

    Is it possible to sync the physics of the boat with the waves in realtime?

    I managed to change the intensity of the gerstner waves in realtime. But the physics stayed the same from the previous intensity of the wave. I'm also using Dynamic Water Physics 2.
     
  38. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    i haven't checked Dynamic Water Physics 2 but i guess you have to make it update as well?
    if it relies on the provoded getheight script from lux water you should enable update each frame.
     
  39. bonickhausen

    bonickhausen

    Joined:
    Jan 20, 2014
    Posts:
    115
    Hi there!

    I'm trying to modify the "_GGlobalFrequency" property of the shader via C#. However, the material does not get updated with the new value until I click on the material's panel in the inspector.

    What am I doing wrong?
     
  40. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    the material inspector does some final calculations and stores the results in hidden properties. i guess _GGlobalFrequency bwlonga to these. please refer to the documentation to find out more.
     
    bonickhausen likes this.
  41. rachel0929

    rachel0929

    Joined:
    Jun 26, 2016
    Posts:
    4
    Hi @larsbertram1,
    I am trying to use Lux Water to create a water surface for a cooking game. For some reason there is no depth effect here (the food color does not fade as they get below water surface). Just wondering what variables should I tweak to get the depth effect? I am using deferred rendering.

    Thank you!
    WeChat Image_20200414002941.png Annotation 2020-04-14 003259.png Annotation 2020-04-14 003321.png
     
  42. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    use Underwater Fog --> - Depth x = 0, y = 0.5 or --> - View Depth and raise its value.
    you can also use light absorption.
    but actually lux water was not written for this scale. so you may run into issues where the sliders in the material editor does not let you set the values needed. try to go to debug mode (so you do not get the aterial editor, but a list of floats)) to tweak the values.
     
  43. EdLooping

    EdLooping

    Joined:
    Jun 4, 2017
    Posts:
    3
    Hi !
    Do you know how I can rotate waves ?
    The Global Factor of the shader doesn’t work by script...
    Thx :)
     
  44. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    the material editor takes the inputs and tweaks the params which are used by the shader.
     
  45. webjeff

    webjeff

    Joined:
    Mar 11, 2015
    Posts:
    39
    I was wondering if this asset supports a volume visual look. I'm trying to make it look like this....


    Is that possible with your asset? So far, I can only get it to work on a plane, but not underneath like that. Is that possible?
     
  46. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    it should be using a water volume. you will have to expand the box collider which triggers the water volume rendering so that it is active even outside the volume of the water.

    watervolume.PNG
     
    webjeff likes this.
  47. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    163
    I have a problem with the ocean. It looks nice in the editor, even in the game view, but when I press play, the foam is gone and ocean color changes.
    upload_2020-4-23_18-35-3.png

    upload_2020-4-23_18-35-32.png

    Unity 2019.2.5f1, deferred , linear
    Any suggestions?
     
    Last edited: Apr 23, 2020
  48. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    the shaders goes into the "render ocean from the backsides = underwater mode" in play mode.
    so you have most likely messed u the underwater rendering script and base water height param.
     
  49. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    163
    Thanks Lars, it was the Water Surface Offset in the Planar_reflections script
     
  50. gueei

    gueei

    Joined:
    Dec 2, 2013
    Posts:
    3
    I am currently working on an underwater simulator, and the transition between under and above water is great. However I found an issue about the "reflection" of the water surface from underwater:

    reflection.png
    The water surface is rendering from the skybox, instead of reflecting the object/floor underneath. Is there any settings to enable it?