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

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    660
    this second thing comes from DWP2
    lux2a.gif

    and actually the first one also seems to be caused by DWP2 particle system

    it probably should be the foam caused by boat on water surface. do you know how to set these up properly?
     
    Last edited: May 6, 2023
  2. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    you should get rid of it. or make it way bigger so it covers the entire scene including the far ocean. but the reflections fropm this probe look kind of broken anyway.
     
  3. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    660
    you probably missed the picture and description (the boat wake foam particle system is the cause) for the first issue. (if you don't know, I'll ask dwp author)

    one more thing. I haven't seen in the documentation: how do you control the ocean wave height?

    thanks for helping.
     
  4. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    oh, i do not know anything about these particles.
    https://docs.google.com/document/d/...m38h-u3Az-ozaaOX0/edit#heading=h.cz7ftkn4x2dk
     
    bobadi likes this.
  5. hulk2011

    hulk2011

    Joined:
    May 10, 2015
    Posts:
    2
    Hi,
    Can anyone help with an issue i have. Please see screenshot. There is a brown fog on the surface going into the distance. Ive spent 2 days trying to get rid of it with no success. Im not even able to change the color of it. Any help would be appreciated!
     

    Attached Files:

  6. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    that looks like unity's built in fog. do you use anything like aura or enviro? if so you will have to tweak the shaders as described in the documentation.
     
  7. hulk2011

    hulk2011

    Joined:
    May 10, 2015
    Posts:
    2
    Thank you for the response. I have enviro but fog is turned off. Is there a default unity fog ive missed?
     
  8. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    there might be, yes.
     
  9. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    660
    Last edited: May 31, 2023
  10. Monil

    Monil

    Joined:
    Apr 24, 2012
    Posts:
    102
    Hi,
    I use this:

    Code (CSharp):
    1. Shader "Unlit/WaterCut"
    2. {
    3.     Properties
    4.     {
    5.         _Color("Main Color", Color) = (1,1,1,1)
    6.     }
    7.     SubShader
    8.     {
    9.         Tags { "RenderType"="Opaque+100" }
    10.         LOD 100
    11.         Cull Off
    12.         ZWrite On
    13.         ZTest Always
    14.         Blend Zero One
    15.         ColorMask 0
    16.         Lighting Off
    17.         Fog { Mode Off }
    18.        
    19.         Pass {
    20.             Color[_Color]
    21.         }
    22.     }
    23. }
     
  11. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    660
    hey, thanks. this finally works.
     
  12. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
    Hi,
    When I run the game in the editor it works fine but once compiled the ocean doesn't appear, there are just left and right parts when I press shift. what is it from?
    Unity 2022.3 - built-in
    thanks


     
  13. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
    Now it doesn't work in game either. The ocean appears for 1/2 second then disappears.
     
  14. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    i never heard of something like this. it looks like a something writes into the depth buffer.
     
  15. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
    it happened suddenly. The day before it was fine.
     
  16. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
    I used Occlusion and the ocean came back in game but still not compiled.
    Unity amazes me every day, even after 10 years of use!
     
  17. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    might be missing depth. from the docs:

    Forward Rendering
    When using forward rendering you have to make sure that your camera renders a depth texture. Do so by adding the LuxWater_CameraDepthMode script to your camera. In case you do not use Metal and deferred rendering leave “Grab Depth Texture” unchecked.

    and please check the included demos if they have the same issue.
     
  18. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
    it does not work. The ocean appears for only 1 second. Here are my settings.

     
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    there is a lot of stuff on your camera.
    could you please check the included demo scenes and see if the water renders properly there?
    if so, go back to your scene and disable all additional component from your camera except the ones needed by lux water. then enable one ofter the other and see if any of these break the water.
    curious about "ms under water effect" e.g.
     
  20. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
    MS Under water Effect is used to see R.A.M 2019 items underwater - River Auto Material
    I put the same parameters as in the demos.
    If I disable everything, the ocean still disappears.
     
  21. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
    when I press shift to run it pops up a bit.

     
  22. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    please check the demos. altho you thin you are using the same params you might have missed something.
    again: i have never heard of anything like this before. so most likely you just have forgotten something :)
     
  23. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
    it worked before. Then the next day, I had this defect.
    I put the same parameters as in the demos.
    On the other hand, if I advance towards the invisible ocean, I have the underwater effects.
     
  24. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    sounds like something is messed up. have you checked the demo scenes already?
     
  25. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
    It works but I don't know why. No doubt magic?
    I loaded an old scene where it was working, then reloaded the scene that had a problem and everything was back to normal.
    It wasn't just the ocean that had disappeared, but also a river created with RAM 2019 Auto River
    Unity remains a mystery sometimes.
     
  26. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
    but it still does not work when the project is compiled!
     
    Last edited: Jul 14, 2023
  27. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
    I'm coming back because the problem came back for no reason.
    I put the same parameters as in the demo. Here are the screens of my ocean and my camera. In game the ocean always disappears.
    When I started my project, I copied and pasted the ocean from the demo to my project. Could it be from this?



     
  28. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
  29. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
    I created my ocean like this:
    I copied and pasted the infinite ocean from the demo. Could my problems come from there?
     
  30. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
    I have this message with debug:
     
  31. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
    :):):)
    the cause of my worries did not come from Lux Water but from the character that I had installed. This is the "Modular First Person Controller" Asset :mad:.
    I removed it and put a normal controller. The bug is gone! :p
     
    Last edited: Jul 26, 2023
  32. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
    how to use Lux Water scripts to create an underwater effect for an ordinary body of water (no Lux Water) ? I tried several things but it didn't work.
     
  33. stigmamax

    stigmamax

    Joined:
    Jun 30, 2014
    Posts:
    304
    I'm sorry, I kinda wrecked your sub
     
    mgear likes this.
  34. trnenmic

    trnenmic

    Joined:
    Feb 15, 2017
    Posts:
    6
    Hello, is it possible to use planar reflections with baked occlusion? With baked occlusion reflected objects sometimes disappear from water surface. Is there any trick for proper setup?
     
  35. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    actually i do not really know. planat reflections use a very special projection matrix which might not fit with how the occlusion data is baked.
     
  36. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    660
    hi, I don't know how to align directional light (sun) with it's reflection on the ocean surface
    (using dynamic sky's lens flare as sun, the light is approximately the same position)
    I think if I might rotate the light towards the camera based of the sun position it could work for that one,
    but the second camera always looks off

    upd.: yes, rotating the sun (directional light) towards camera works (for that one camera)
    luxSUN.jpg
    if it's not possible, can the light reflection turned off? (the enable planar reflection on ocean is not that)

    upd.: switching direction light's Render Mode to Not Important removes reflection
     
    Last edited: Nov 17, 2023
  37. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    a directional lihgt is only defined by rotation (direction) the position is irrelevant. at least when it comes to the lighting equation including the direct specualr highlights.
    in case you use a skybox which also contains the sun you have to rotate the sun to make the direct specular reflection fit the indirect reflection you get form the cubemap.
     
  38. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    660
    for two cameras it won't work?

    afaik, light can't be occluded for a camera
    (theoretical work-around of using two suns and different rotation for each camera impossible)
     
  39. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    should work for 2 cameras as well.
     
  40. Gabberjaw

    Gabberjaw

    Joined:
    Mar 12, 2023
    Posts:
    2
    Hello, I'm a newb to unity so please bare with me.
    So I made quite a bunch of assets for a game for personal use and I made an island with an ocean.
    I tried a lot of settings but nothing seems to fix this... when in well lit conditions, this is barely noticable, but as soon as I switch to night or sunset or anything like this, jagged edges start appearing around my other assets when they are being rendered over the water.

    Any idea how can I fix this?

    Edit: Had to change antialiasing type from MSAA to FXAA, artifacts went away.

    Edit 2:

    IN VR: If I enter VR, my hands and other assets beside the water, all get rendered on the surface of the water in a side-by-side manner... what am I even doing?
     

    Attached Files:

    • 322.JPG
      322.JPG
      File size:
      66.1 KB
      Views:
      24
    Last edited: Dec 27, 2023
  41. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    msaa causes known issues. the docs show some ways to mitigate these but you will not really get rid of those.
    how does this look like?
     
  42. Gabberjaw

    Gabberjaw

    Joined:
    Mar 12, 2023
    Posts:
    2
     

    Attached Files:

  43. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    you should have a look into the frame debugger and see how and when the hands and characters are rendered.
     
  44. kcastagnini

    kcastagnini

    Joined:
    Dec 14, 2019
    Posts:
    61
    Hello @larsbertram1
    I am playing around with the deep water demo scene.

    When I am sitting at the bottom of the sea the fog is pitch black, which is true when light can't reach this depth. But is there a way to "override" this black with a custom color? Like for example a very dark blue?
    pitchblack.png


    Also is there a make to make a more transparent water (less turbid)? Here for example I would like to see the yellow submarine more easily, like a caribbean water style
    turbidWater.png

    Also is there are way to decide at which rate the water becomes dark? Like having dark water from 1000m of depth.

    Thank you very much!
     
    Last edited: Jan 11, 2024
  45. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    deep water rendering actually eliminates the light. so it will become black.
    if you wanted to change this you would have to have a bunch of shaders...
    this just depends on you settings in the water surface material.
    yes. please have look here:
    https://docs.google.com/document/d/...qm38h-u3Az-ozaaOX0/edit#heading=h.xv6ou9wdiuc
     
  46. Liakos89

    Liakos89

    Joined:
    Nov 27, 2016
    Posts:
    17
    Hey Lars sorry to waste your time if its already asked..
    I use Lux Water with Enviro, almost everything I handled,
    but I cant seem to make the Planar reflections, render the volumetric clouds from Enviro.
    If there is no fix or way around, are you aware of any other pluggin for volumetric clouds + light that would work with the water reflections?
     
  47. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    sorry, i do not know...
     
    Liakos89 likes this.
  48. Liakos89

    Liakos89

    Joined:
    Nov 27, 2016
    Posts:
    17
    Hello again, I came across the following problem,

    when I use the function to get the displacement of the water surface, for a given xyz, it correctly returns a new x'y'z', which has also disp in the x z axis as expected because it is gestner waves.

    Is there any way to get only the true Y axis distance from the surface, for the original xz coords?

    I dont feel smart enough to solve this, so any help would be much appreciated.
     
  49. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,898
    ah, the cpu code only returns something like an estimated position. no "real".
     
    Liakos89 likes this.
  50. Liakos89

    Liakos89

    Joined:
    Nov 27, 2016
    Posts:
    17
    Thanks for reply =), sorry my question wasnt clear. I understand that the function in general will return an approximation.

    What I meant was if there is a way to get the surface displacement only on the Y axis, disregarding the x and z displacements.

    Note that if I just get the .y component of the Vector3 that the function returns, its not correct, because it corresponds to the new x' and z' positions, and its not the correct y value, at the initial x,z coords of the input vector3.

    LuxGest.PNG