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

[RELEASED] Lux Water

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

  1. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    Hello, @larsbertram1. First off, I just bought Lux, and I'm really enjoying it. I'm glad you have a number of demos to easily pick apart for investigation as well as thorough documentation.

    Would you happen to have a solution for rendering two cameras to two render textures? I have seen the split screen demo, but that simply outputs to a portion of the camera viewport. I'm looking to support the cameras being underwater, above water, or a combination of the two. I don't need the transitioning effect between above or underwater, and I think I'd be okay with disabling the Gerstner waves, if that helps.

    If there's a way that I can render the output to the RenderTextures in two separate passes, I'd accept that too, if that's a potential solution.

    Thanks for all your hard work and any help that you can suggest!
     
  2. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    hmm, i am not sure what the problem here is... can't you just make the camera render into render textures?which issues do you run into?
     
  3. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    Well, your reply gives me confidence that it's just me doing something wrong. I'll get back to you once I either solve it or run into an issue that I'm probably not understanding.
     
  4. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    Apparently, I was doing something wrong, probably with my RenderTexture setup, because the screen was mainly black and smearing only a few lit pixels. Anyway, I just recreated my entire test scene, and was able to successfully get Lux to render 2 cameras to 2 separate RenderTextures, in any combination of above or under water.

    One thing I noticed though is that transitioning between above and under and vice versa while rendering to texture causes a delay and some artifacting while I guess the shaders are having problems calculating or something. I don't need transitions for my project, but it was definitely something to note.
     
  5. ImproxGames

    ImproxGames

    Joined:
    Apr 3, 2017
    Posts:
    20
    Hi, Have you made any progress with this? We're also struggling to get Lux Water to work on the Switch. As you noted above, turning ZWrite Off makes the surface not-invisible, but introduces other render order problems.
     
  6. Image3d

    Image3d

    Joined:
    Jun 20, 2008
    Posts:
    155
    Hi, it seems that the the Static Foam Projector is not working on version 1.2 (Current) - released on May 05, 2021 on Mac OS Catalina with Metal in both forward and deferred mode. Plataform is set to iOS.
    upload_2021-7-24_9-34-3.png

    Any ideia what is the problem ?
     
    Last edited: Jul 24, 2021
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    have you checked the metal specific parts in the documentation?
     
  8. Image3d

    Image3d

    Joined:
    Jun 20, 2008
    Posts:
    155
    Yes, but in my case it does not make difference...using #define LUXWATERMETALDEFERRED or with // #define LUXWATERMETALDEFERRED in shader does make any difference.

    04 LuxWater Water Projectors Demo Project works... it uses the Lux Water/WaterSurface shader.
    upload_2021-7-27_13-25-22.png

    06 LuxWater Water Projectors Tess Demo does not works..it uses the Lux Water/WaterSurface Tesselation Shader.
    upload_2021-7-27_13-26-26.png

    Some additional setup is missing...
     
    Last edited: Jul 27, 2021
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    i will have to look into this...
     
  10. Image3d

    Image3d

    Joined:
    Jun 20, 2008
    Posts:
    155
    Thanks...it looks very strange...
     
  11. montyjack

    montyjack

    Joined:
    Jan 10, 2014
    Posts:
    43
    Hi, I'm also using Unistorm- I had the same issue with the underwater fog not looking correct, and I tried setting the Lux Water sun to be the Unistorm Sun object. Unfortunately, I'm still getting that weird half-fog you get when you don't set the sun object in Lux Water (where things are shaded the fog color, but you can see all the way to the skybox underwater). Any idea what I can do about this? I've tried setting the lux water sun to be the unistorm sun, and both of its children, but with no luck.

    upload_2021-7-30_23-46-51.png
     
  12. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    i have nothing to says regarding unistorm.
    but on your screen shot i can spot 2 things:
    - the bright bar which might be caused by the camera far clipping plane being too close (and the water volume being too big)
    - the dark bottom in the foreground. it that ground geometry?
     
  13. montyjack

    montyjack

    Joined:
    Jan 10, 2014
    Posts:
    43
    Yes, the fog essentially disappeared- not the color, but the attenuation. Normally this can happen if you don't assign a directional light for the sun, but in this instance it happened from adding Unistorm to the scene. The same scene looks fine without unistorm.
     
  14. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    weird. attenuation is passed in as param to the shader. then it relies on a proper depth texture and camera frustum planes send as well. you may check in th eframe debugger if anything changes here when you add unistorm.
     
  15. montyjack

    montyjack

    Joined:
    Jan 10, 2014
    Posts:
    43
    It seems to be due at least in part to Unistorm's cloud layer. If I disable that object, the fog attenuation returns, although some aspects of the terrain geometry still bleed through.
     
  16. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    ok, then i am definitely out. i do not know unistorm.
     
  17. montyjack

    montyjack

    Joined:
    Jan 10, 2014
    Posts:
    43
    Switched assets to Enviro, which you support. Seems to have solved the problem. However, I'm having an issue that I can see the corners of the ocean when at high altitude. Is there any way to make it consistently stretch to the horizon? I had just had it blend into the skybox, but since I'm using a weather system now, that won't work.
     
    Last edited: Aug 3, 2021
  18. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    lux water does not offer such function, sorry.
     
  19. montyjack

    montyjack

    Joined:
    Jan 10, 2014
    Posts:
    43
    Actually, you can do it by increasing the horizontal scale of the ocean prefab to 1000 (or whatever you need). I tried it and it didn't seem to impact frame rate. Just in case anyone else asks.
     
  20. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    well, if the camer far clip plane is set to a really high value this might work.
    but if you keep your depth buffer in a more resonable range like 0.05 - 5000 then anything beyond 5000 will just be clipped by the gpu...
    depending on your skybox you could blend out the water towards the far clipping plane.
     
  21. Slider_j

    Slider_j

    Joined:
    May 20, 2014
    Posts:
    28
    boatcap.PNG
    Hi, Lux water is amazing, but i was wondering if it is possible to make a boat that sits on an infinite ocean have some way of NOT rendering the water (or water volume) within the boat. Something like a script that is attached to the game object and uses the bounds of the collider to not draw the water within it.
    Above is a screen cap of the problem i'm facing, i tried altering the mesh of the boat to have a much higher floor that sits above the water level but that just looks "odd" and doesn't work when the seas become rough, although this approach may work for a smaller "row boat" that freely moves with waves once the size of the ship increases, and you can go below desks it doesn't work.
     
  22. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    you can create some geometry filling your boat and apply a "depth only" shader to it. this will suppress water rendering within the boat. well, it will suppress all transparent material to render within the boat.
    https://forum.unity.com/threads/depth-only-shader.590620/
     
  23. Slider_j

    Slider_j

    Joined:
    May 20, 2014
    Posts:
    28
    oh wow, so simple! i made the geometry just as you said, (in the pic below the geometry is raised out of the boat object for readers to view)

    boat image.jpg

    then just followed this link where i made a simple shader to act as a mask and a short script to apply to each object that is to be masked and boom!
    boat2.PNG

    and no more leaky boat! Thanks, you are a total legend!
     
  24. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    i am glad, you managed to work it out!
     
  25. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,476
    Hey there, will this work for forward rendering, or only deferred?
     
  26. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    should work for both.
     
    khos likes this.
  27. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,476
    Thanks, that news floats my boat :)
     
  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    :)
     
  29. montyjack

    montyjack

    Joined:
    Jan 10, 2014
    Posts:
    43
    Hey - I'm having an odd issue in that billboarded trees are drawing behind the water surface. I've tried moving lux water before and after the terrain asset, but no luck. Any idea what's causing this? 3D trees are fine so I assume it's a fogging issue. FYI, I'm also using Enviro fog.

    upload_2021-8-12_9-20-54.png
     
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    if billboards use transparent they do not write to depth. so the water just renders on top.
    you have to use alpha tested billboards to make it work properly in all different situations.
     
  31. montyjack

    montyjack

    Joined:
    Jan 10, 2014
    Posts:
    43
    Don't all billboards use transparent?
     
  32. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    the built in ones do. but you can just hijack the shader and make it cutout.
    you hav to edit the billboard shader anyway to make enviro's fog work.
     
  33. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    just a very personal opinion here and i hope you will get it right. so personally i think you spend your render budget in a quite special way: volumetric clouds as far as i can say but no shadows.
    so the overall lighting looks a bit flat. almost unlit.
    is this what you are heading for?
     
  34. montyjack

    montyjack

    Joined:
    Jan 10, 2014
    Posts:
    43
    No, I haven't really tweaked enviro much yet- I'm still in the middle of overhauling my atmosphere and terrain and have been dealing with a load of problems. I can say that the scene IS overlit which seems to be an issue with Enviro's base settings.
     
  35. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    if you have a closer look: billboards right now do not receive enviro fog.
     
  36. montyjack

    montyjack

    Joined:
    Jan 10, 2014
    Posts:
    43
    I noticed. I switched to speed trees which solved the issue. Wasn't married to those prefabs anyway. Also, think the scene looks a little flat in that pic because it's noon. Looks better in the morning and afternoon.
     
  37. julienrobert

    julienrobert

    Joined:
    Sep 15, 2014
    Posts:
    65
    I'm using the reflections using Lux_Water volume and Lux Water camera Depth mode. In the editor it works fine, but once built, it doesn't work anymore. Any lead on this?

    Tried to use deferred instead of forward rendering (and edited graphic settings), tried different things ardoun according to the manual without success.

    Unity 2019.4.19f
     
    Last edited: Aug 14, 2021
  38. potatosallad3

    potatosallad3

    Joined:
    Sep 10, 2019
    Posts:
    31
    Bug report: At the time of writing LuxWater with AzureSky is no longer functional in 2020.3.12f1. See screenshot:



    Different water objects using the exact same material and shader display different specular properties, some receive updated light probes, others do not. Seems to be based on distance from the origin.

    LuxWater and AzureSky are both correctly configured and all the required include statements are correct, set up is identical to setups in previous versions of Unity. In this example, LuxWater and AzureSky are the only assets in the test project.
     
  39. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    what is the issue in build? how does it look like?
     
  40. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    which reflection probe is used by the water depends on the water's and reflection probe's pivot. so the huge water plane may sample the sky reflection while the smaller one may sample a local one.
     
  41. julienrobert

    julienrobert

    Joined:
    Sep 15, 2014
    Posts:
    65
    The issue is the reflections of the lights showing when using the editor but not showing in a build.
    editor:
    Capture-editor2.PNG
    Build: Capture-build2.PNG
     
  42. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    hmm, shouldn't there be light on the characters at least? i can't see any in build.
    so maybe unity just strips all additional lights due to the quality settings?
     
  43. julienrobert

    julienrobert

    Joined:
    Sep 15, 2014
    Posts:
    65
    Default quality was set to low! You're a life saver!
    Thanks a lot, can I buy you a beer or something?
     
  44. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    i am glad, you solved it!
     
  45. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,200
    Lux Water & Castle Valley is a top combination. I just created a quick demo scene with both assets combined from scratch:



    Of course it needs the underwater setting and projector for ripples which Lux Water supports, I'll show that in another video with a Crocodile once I get my hands on it :)
     
  46. GorkaChampion

    GorkaChampion

    Joined:
    Feb 6, 2018
    Posts:
    103
    Hello, I cant manage to turn on the underwater effects apart from the underwater blur. I have it the same as in the Ocean demo. Can someone help?
     
  47. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    what is missing?
     
  48. masa045

    masa045

    Joined:
    Nov 22, 2016
    Posts:
    35
    Hi I'm using lux water and making underwater scene for now.
    I'm notice some strange shader issue while underwater.
    I realize when turn off caustics to no shader issue and opaque model not occur shader issue.
    I'm not sure how to exclude caustics on transparent model or how to fix some strange shader issue while underwater.
    thanks in advance.:)
     
  49. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    so the plants use a transparent material? then it won't work...
    the underwater caustics are projected using the depth buffer. and as transparents do not write to the depth buffer (at least not the copy unity provides) they are simply not "seen" by the caustics.
    so try to use alpha testing instead.
     
  50. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    tested in 2019.4.19f1, oculus quest + link cable, seems that one eye has different underwater fog?
    (is that known issue or some special setting needed)