Search Unity

[RELEASED] Lux Water

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

  1. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    231
    I'm not sure if this is a Unity 2019.1 bug (official non-beta release) or a bug in Lux, but as of upgrading to 2019.1.0f2 I am unable to set x/y/z/w parameters for e.g. Detail Normals, Gerstner Waves, etc. - only x is visible, no matter how much I resize the Inspector:



    Edit: Just filed a bug report.
     
    Last edited: May 7, 2019
  2. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    201
    Hi, I was wondering if you ever had a chance to look into the NGSS v2 compatibility? We've been using v1 and Lux Water for a bit, but I'd like to update to v2 and I'm having the same shader errors in my build log with loop unrolling etc.
     
  3. tntfoz

    tntfoz

    Joined:
    Sep 29, 2016
    Posts:
    129
    Hi, just enquiring if anyone can confirm that Lux water works happily in VR with SPSR?

    If so are there any pitfalls regarding a forward rendering setup? I'm hoping to have water that supports reflections.

    I'm currently on Unity 2018.2.21f1.

    Thanks.
     
  4. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    231
    Unity responded about the missing x/y/z/w parameters problem with 2019.1:
    This issue is caused by custom editor script in the Lux Water asset. We informed the asset creators about the problem.

    For now, you can go to the affected shader's code and remove all [LuxWaterVectorFourDrawer] instances. This fixes the problem.
     
  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    sorry guys, i did not get any notifications for quite some days...

    i managed to reproduce this in unity 2019.1.1 and will upload a fix asap.
    meanwhile you can fix it manually:
    - find the scripts in the "scripts -> editor" folder like "LuxWater_GFDrawer".
    - insert:
    EditorGUIUtility.labelWidth = 0;
    right as the first line of the: override public void OnGUI()
     
  6. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    lux water only works with the legacy render pipeline.
     
  7. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    44
    It's the best water asset on the market, imho. Visually similar to UWS (which was nice but totally buggy and was not ready for production). And it is much better and 50% faster (170fps vs 113fps!) than another hi-quality water asset I used before buying Lux Water.

    Question is: should I use "Deep water rendering" (LuxWater_DeferredShading) feature for my project (Unity 5.6.4, deferred lighting, ATG, ToD, no GI)? Will it improve visuals or performance if I don't use underwater camera view?
    Thank you.
     
  8. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    it might improve the visuals – but usually you can achieve the same effect just using the light attenuation params from the water shader if your camera does not go underwater.
     
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    if i include the "LuxWater_DeferredLibrary non-optimized.cginc" instead of the original "LuxWater_DeferredLibrary.cginc" in the "LuxWater_DeferredShading" shader i get no errors on os x and metal.
     
  10. tikilittle

    tikilittle

    Joined:
    Feb 22, 2013
    Posts:
    5
    Hey! I'm getting some odd results. I'm running this on an iOS device using 2018.3, but it looks great in the editor. When I move the camera, it does a darker clipping overlay (see screenshot #1).
    IMG_0092.jpg



    Earlier I tried uncommenting the #define Metal, but then I didn't see anything. Here's my current material properties (see screenshot #2)
    Capture.PNG
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    how shall the water look like?
    like the dark parts in the foreground?
    or the the bright and almost transparent parts in the background of the pool?
     
  12. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    201
    Does that mean I should change this line:
    Code (csharp):
    1.  
    2. //  LuxWater: Here we include the hacked lighting function
    3. #include "LuxWater_DeferredLibrary.cginc"
    4.  
    To point to the non-optimized version?
     
  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    yes
     
  14. tikilittle

    tikilittle

    Joined:
    Feb 22, 2013
    Posts:
    5
    It should look like: the bright and almost transparent parts in the background of the pool.

    A quick side note - is that it looks like it clips between a near/far plane of the camera and it's screen-space effect rather than world space. When I rotate the iPhone in AR mode, it follows the cameras rotation.
     
    Last edited: May 8, 2019
  15. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    oh, AR – i have not checked this... as i do not have any idea about it.
    i think that the darkening in the foreground is caused by light absorption. you only use light absorption according to "view depth" ("depth" is set to 0.0), but this still needs a proper depth buffer behind/below the water.
    if the depth buffer is empty the water will assume a pretty high depth --> full darkening.

    so set light absorption -> strength to 0.0 to check if we are looking into the right thing.
    if this cancels the dark artifacts in the foreground we would have to find out why the depth buffer is corrupted – at least in the foreground.
     
  16. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    44
    Is it possible to edit the WaterSurface shader to make it work with camera fog script?
    If I set AlphaTest (2450) in the shader render queue, the fog does appear before the water, but in game mode, when the camera rotates, the water surface flickers - it looks ok on some frames, but in few seconds it becomes dark as it is not lit by the light, and loses scattering, smoothness, specular, etc.
    If I set the render queue to "from shader", the water doesn't flicker, but it is drawn before the fog, which is not aceptable.
    Thank you.
     
  17. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    what kind of "camera fog script"?
    what is "before"? do you mean "on top of"?
    water usually is drawn as transparent material which means that it does not write to the depth buffer. this makes water invisible to all screen space fog solutions so you have to mimic the fog (which gets applied as image effect to all opaque surfaces) in the shader itself – like lux water does for azure or enviro.
     
  18. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    44
    I use Tenkoku fog script. Yes, with the default render queue (from shader) the water is displayed on top of the fog.
    However I would prefer to use the default render queue do avoid flickering.
    Could you please point on how I should modify the WaterSurface shader to mimic the fog?
    Thank you.
     
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    tenkoku should ship with a fog function for transparent shaders like particles, glas or billboards.
    if so you would have to call that function at the end of the water shader (core file) - just where it calls the other fog functions right now.
     
  20. theonerm2_unity

    theonerm2_unity

    Joined:
    Sep 7, 2018
    Posts:
    131
    I can't figure out how to get the underwater blur to work. My player uses a character controller not a rigid body. What exactly do I need to get it to work?
     
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
  22. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    just bought it ;)

    but i cant figure out how to use point lights, the water dissapears
     
  23. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    ups, which version of unity? which graphics api?
     
  24. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    2019.1 "standard" graphics setup not lwrp or hdrp
    linear color space
     
    Last edited: May 12, 2019
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    dx11 i guess. then everything just should fine.
    deferred or forward?

    edit: i just checked the deep water demo (which contans several point and spot lights) in Unity 2019.1.2. and it works like charm?!
     
    Last edited: May 12, 2019
    Mister-D likes this.
  26. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    yes
    found out it only happens in forward rendering
     
  27. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    not for me. check if the camera renders a depth texture. if not assign the camera depth mode script.

    lux forward.PNG
     
  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    dear customers,
    again something unrelated to water rendering – but as i rate it as something essential i do not hesitate it to post it here anyway: i have added a customers' showcase to the Lux Plus description featuring "This land is my land". So in case you are aiming AAA it might be worth having a look at this.

    you will find Lux Plus here [>].

    s01.jpg

    01_showcase.jpg
     
    Rowlan, ftejada and Vincent454 like this.
  29. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    Hi, I'm looking for a water that can render reflection in screen-space. All of the water solution out there when reflection is turned on, things starts to crawl as it has to render the whole scene twice. I know it's not as easy as it sounds but what I'm looking for is not the accurate solution but approximate solution. Please let me know if your water can support it. Thanks.
     
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    lux water uses forward rendering. so no ssr, sorry.
     
  31. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    Yeah, it will be easier if it used deferred rendering.
    I was thinking something along the line of image filtering, kind of like god's ray where it just shows smudged images at the water edges. The water will be animating and it won't be necessary to show the accurate reflections.
    If we can tell where the water edge is, it might be possible.
    Anyway, this is something to think about.
    Cheers!
     
  32. Pandur1982

    Pandur1982

    Joined:
    Jun 16, 2015
    Posts:
    275
    Hello i Have a Problem with the Underwater, here a Picture :



    Unity : 2019.1.1f1
    DemoScene with Underwater works for me , i have take the camera and the WaterPlane
    i have a Island , the Waterplane size is x: 100000 y: 1 z: 100000 ,i have change the Shader in Graphics like the documentation.
     
  33. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    as you can see in the debug view: no water volume is rendered to the water mask. it is either missing or displaced.
    but most likely your water plane simply is too big (100.000!) this will make the volumebe as big, drawn but fully clipped according to the far camera plane.
    so please have a look at the ocean and infinite ocean demo: you will have to make your "ocean" out of several tiles and use a "sliding" water volume.
     
    theonerm2_unity and Pandur1982 like this.
  34. Pandur1982

    Pandur1982

    Joined:
    Jun 16, 2015
    Posts:
    275
    Thx for your answer i will test it out when iam back at Home tomorrow.
     
  35. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    you are welcome.
     
  36. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    44
    Is it possible to somehow fade the reflections out, based on the distance from the camera (preferably), or camera-water angle?
    As you can see on the attached image, reflections don't work nice with camera fog script.
    LuxWatrer_Tenkoku_reflectio.jpg
    Thank you.
     
  37. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    unfortunately common methods to recreate the distance of the reflected surfaces fail – due to the oblique projection matrix of the camera which renders the reflection. this is also the reason why the reflection itself does not contain any fog: unity's fog function simply does not work. i am still looking into this but haven't found a solution yet.

    just fading the reflections will not work either: all we have is the distance between the water surface and the camera.
    let's take the tree in the center of your screenshot:
    it is quite far away from the camera so pretty much fully fogged.
    if you look at the distance between water surface and camera at the position of the reflection you get totally different values: close and far :(
    looking at the trees on the left the distance between camera and the water surface does not help either because the reflected objects may be close or far...

    water_fog1.jpg

    btw.: pretty nice atmosphere! i would love to see more.
     
  38. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    44
    Thank you.
    For now the only solution I have for fogged reflections is a grey cylinder screen, not visible by main camera but included in reflected layers. This screen is tied to the camera, and cuts distant objects from reflection. The main disadvantage of this method is that the objects appear suddenly when you move towards them.
     
  39. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Pandur1982 likes this.
  40. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    262
    @larsbertram1 - Thanks for the great water so far. A few questions:

    I'm using Enviro and want to reflect the Enviro sky in the Lux water. I've been able to get this working with prior dual camera water reflection setups by adding the Enviro Sky component to the reflection camera, but with Lux it doesn't work correctly.

    Here it is NOT attempting to reflect Enviro's sky:

    upload_2019-5-17_14-25-33.png

    and here it is attempting to:

    upload_2019-5-17_14-26-8.png

    To easily test, I've made the reflection camera not set its hide flags and have then maniulated parameters on the camera and the reflection component, including forcing deferred render instead of forward. Since you did an Enviro integration already for Lux, maybe you have some ideas?

    Thanks
     
  41. blogsabout

    blogsabout

    Joined:
    Aug 20, 2014
    Posts:
    50
    LOVE this asset.
    I'm trying to get a more stylized look and two things that seems to trouble me:
    1 - the reflection is mirror sharp. Is there a way to lower how clear it is? I only want a tiny bit.
    2 - Is it possible to use shadows on the water? My reflections use the colors of the objects, but I would love to just have the same color for the shadows/reflections.
    3 - My ocean plane blends very badly with my skybox - is there a way to smooth it a bit and have it less "sharp"?


    Thanks for this great assets!
     
  42. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    Hello! @larsbertram1 In my splitscreen setup with infinite ocean, I have made it larger and it works , kind of .. but the water volume keeps following the player 1. and not player 2 .. So if player 2 is underwater.. and player 1 is somewhere else.. player 2 have no underwater volume.. ? hmm


    EDIT:

    The ocean planes moves with player 1.. at first they are at center of map.. but in play mode they move where player 1 is. ...

    EDIT 2:

    Okay seems like I didnt understand the infinite ocean right.. I dont want that, I just want a big lake in the middle of my map with underwater feels, is there someway to achieve that?
     
    Last edited: May 21, 2019
  43. Pascal-

    Pascal-

    Joined:
    Mar 23, 2013
    Posts:
    32
    Dear All,

    I'm trying to build the deep water demo for HTC using 2018.3.12. No problems when playing in the editor, The fog is well display in the headset but with the build I cannot get it work.

    Here is the editor (same in headset)

    working.jpg

    In the build

    underwater.jpg

    set.jpg

    Am I missing something? Could you please help?
    Thanks a lot in advance,
    Pascal
     
  44. blogsabout

    blogsabout

    Joined:
    Aug 20, 2014
    Posts:
    50
    I would like to have the reflection looking more of a shadow(without reflecting the colors), is that possible?
    To give it a more stylized look.
     
  45. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    44
    Hello,

    I'm trying to add an effect of swamp duckweed surface using the built-in Foam.
    Is it possible to somehow alter the shader so that the foam ignores underwater objects rendering? On the attached images, there are areas that should be covered by duckweed (1), and others that should be not (2).
    Also is it possible to edit the shader so that the foam does not respond to the distance from the camera? Now, the foam is not displayed on far distances, and appears when the camera gets close to it.

    Of course it would be possible to add a separate 'swamp' surface object with its own material, but I would like to smoothly alter water shader parameters when the camera moves to 'swamp zones' (increase the foam coverage, reduce waves, change the water fog color, etc.).
    Ideally it would be great for the foam to ignore waves speed too.

    Thank you.


    foam3.jpg foam4.jpg
     
    ftejada likes this.
  46. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    44
    Ok, that was probably a bad idea. Duckweed object is quite different from the foam, it shoud have its own material for better control, no water influence, no underwater calculations, no speed/waves/projectors etc.
    I need to create a custom shader for it.
    Please disregard my post. Thank you.
     
    Vincent454 likes this.
  47. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    have you used the frame debugger to check what the reflection camera actually renders – or tries to render?
    are there any enviro related passes?
     
  48. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    1 - currently no. you would to blur the reflection texture.
    2 - currently no. but i am not sure if i get you right. reflected objects should contain shadows.
    3 - not out of he box. but as the water shader is transparent you could raise its transparency towards the camera's far clip plane.
     
  49. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    right out of my head you could add a "custom layer" to the shader that calculates duckweed coverage in any way (or samples it from an additional texture). add its coverage to the coverage of the foam but overwrite the color and normal output.
     
  50. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    yes, but you would have to tweak the shader...