Search Unity

[RELEASED] Lux Water

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

  1. KingCeryn

    KingCeryn

    Joined:
    Feb 8, 2018
    Posts:
    158

    This is what im getting with the generic planar material

    EDIT: ah, i didnt realize i needed to comment out the define for the EXP2 fog as well as the others!
     

    Attached Files:

    Last edited: Sep 22, 2020
    camta005 likes this.
  2. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    223


    This isn't my screenshot but it's the same thing I am trying to achieve. The underwater ripples on the surfaces. they seem to only work sometimes. I enable caustics and it only works if i disable "Normals from GBuffer". but sometimes it won't work. is there something else in the component window that affects the underwater caustics?

     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    no. it should just work.
     
  4. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    223
    It seems to work whenever it wants. I know that doesn’t make sense lol. I will try to recreate my object and see if the issue persist.

     
  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    underwater caustics are rendered using the image effect. it needs the volume to be active. so if you enable debug mode you should be able to control how the volume behave.
     
  6. KingCeryn

    KingCeryn

    Joined:
    Feb 8, 2018
    Posts:
    158
    Another question, sorry if theres a demo somewhere- is there a specific setup for something like a rigidbody platform that follows "points", but also stays on the surface of the lux ocean?

    I've basically got it all fine with objects that sit on the surface, like a docked boat the player can walk on, etc- but im having some trouble with different kinds of moving objects,

    Just wondering if i missed something somewhere, i understand its never as simple as it sounds lol. But i feel like im close, ive been looking at the "animate circle" bool to see if i can reverse engineer the logic for staying on the surface while moving.
     
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    lux water does not come with any advanced physics if this is what you are looking for...
    you may have a look into "Dynamic Water Physics 2" from the asset store.
     
  8. Juneav

    Juneav

    Joined:
    Feb 18, 2017
    Posts:
    28
    Hello! Having a weird issue using luxwater with trees in a terrain: at certain distance, objects, in this case trees appear and dissapear from view or are rendered behind the water, see the screnshots :(

    Setup:
    Unity 2019 built in render pipeline
    Enviro 2.3.1 (using demo scene)
    LuxWater 1.1
     

    Attached Files:

  9. KingCeryn

    KingCeryn

    Joined:
    Feb 8, 2018
    Posts:
    158
    Oh well I wasn't actually expecting it to, its all displacement-shader based yes? But the projector examples have a component for moving objects along the water's surface, is that just offsetting the objects original position by the displacement of the water shader?
     
  10. KingCeryn

    KingCeryn

    Joined:
    Feb 8, 2018
    Posts:
    158

    To clarify, im not really looking for "realistic" physics, I'm just trying to sort of make the boat follow the path of points, on the same Y position, but also move with the displacement of the shader. It works when I "pause" the boat midway on its path, itll align to the water, but then get disconnected when moving. It could be on my end, the method i use to move it, but i was wondering if theres a way to just sort of have it align to the shader height along with its movement path
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    yes.
     
  12. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    problems sorting transparent materials. here: water and billboards. you have to use a billboardshader which uses alpha testing instead of alpha blending.
     
  13. Juneav

    Juneav

    Joined:
    Feb 18, 2017
    Posts:
    28
    Thank you very much for the orientation!
    I edited the actual LuxWater shader that I was using from this:

    Tags {"Queue"="Transparent-1" "RenderType"="Transparent" "ForceNoShadowCasting"="True"}
    to this:

    Tags {"Queue"="Transparent-200" "RenderType"="Transparent" "ForceNoShadowCasting"="True"}

    And problem solved, as trees have a queue of 100 and original LuxWater a queue of 1, so it was forcing itself to be drawn before anything.

    Now its working as intended!

    I also found a solution to this problem even when this one is using LuxWater instead of Water4:

    https://answers.unity.com/questions...34.2087013926.1600921164-701718134.1597603671
     
  14. Juneav

    Juneav

    Joined:
    Feb 18, 2017
    Posts:
    28
    Actually just found out an easier solution to this: open the water tile shader in the inspector and down to the bottom there is a rendering Queue option, set this option to AlphaTest and you're done!
     
    camta005 likes this.
  15. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    223
    yea , there's definitely something wrong with the caustics displaying under water. I just deleted my pool water. Added a new one and got it up and running just fine. Under water caustics were looking beautiful under water (along with the underwater blur). And it was working just great. I saved it. did NO OTHER changes, simply save it. tested it, jumped in the water one more time before closing unity and it was still good. Then opened unity again and the caustics are gone and the underwater scattering was turned all the way up. So I lost my caustics again and under view looks VERY dithered. Also I ad the water ripples working around the character and they disappeared too.

    Is this a bug? Can you look into this?

     
  16. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672

    I just gave up on having caustics working, they work in the samples, but once we move the water volume or change values they disappear again.
    Not sure what's going on, but as you said, they just disappear without changing values.
     
  17. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    caustics just work fine on my side...
     
  18. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    223
    Lol two ppl are sharing the same issue where caustics disappear. They are working fine on my side too as long as I stick to the demos. Any ideas why his could be happening ?

     
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    this sounds like you were not setting them up properly in your custom scene.

    my first guess:
    - you open one of the demos which contains underwater rendering being set up.
    - then you create or edit a custom scene.
    - switching from the demo to your custom scene the setup for underwater caustic from the demo is kept as it is stored in global shader variables.
    - however: if you close unity and then open it jumping directly to your custom scene underwater rendering might not be set up as closing unity will wipe out the globally set shader variables.

    usually all needed vars should be setup automatically by the "LuxWater_UnderwaterRendering" script which also renders the image effect.
    in void RenderUnderWater() you will find a huge block of code setting up all the variables. and although it is wrapped within an "if" it should execute each frame.
    so you may just try to add a Debug.Log("SetupUnderwater"); to find out if this part of code is ever executed.

    you should also look for any errors which may prevent the script from being executed properly.
     
    jchambers likes this.
  20. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    223
    I will take a look at this tonight.

    Are you saying is better to just build my own water with your asset from scratch as opposed to copying over a prefab?



     
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    no. i think starting with the given stuff and tweaking it to your liking should be the fastest way.
     
  22. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    223
    I will see if any of the global variables transferred over to the script. If not maybe I can copy and paste them and see if that works.

    If I have to recreate the water from scratch using your asset, I would. It’s not a big deal as it’s pretty easy to do (just adding components). I have a lot of underwater levels and the caustic just look too amazing to not use. It’s one of the biggest reasons I bought your assets (along with the blur and reflections).

    Could this be the reason the ripples/displacement disappeared after closing and reopening the file? Due to global variables?

    Lastly, why when I change the foam texture, the whole ocean turns all white? And tweaking the component doesn’t do any changes. It’s like I cannot use my own texture for foam. I’m gonna play with this some more.I’m trying to get more “blocky” or squared looking foam to match my game style.

     
  23. Woolf

    Woolf

    Joined:
    Dec 4, 2012
    Posts:
    35
    hi. I purchased Lux Water for my project, to replace my old water, and I have a few technical questions.

    1) can you tell me how I can change the Shader to add a bottom color to the water, just like in my old water one ?



    2) can I increase the aggressiveness of sun glare without increasing distortion?

     
  24. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    Concerning this excerpt in the documentation:
    "When using Gerstner waves and a slightly oversized collider OnTriggerEnter does not guarantee that your camera (or the trigger) actually is underwater. You will have to check the Gerstner height at the given position to make sure the camera is underwater or not."

    Is there an example of how I would get the realtime Gerstner height at the position of the player and determine if they are truly underwater? Im trying to add some sound effects to walking around a beach area and also then subsequently adding underwater sound when the player is truly underwater.

    Any help on a performant solution would be greatly appreciated. Thank you!
     
    Woolf likes this.
  25. Ali-Nagori

    Ali-Nagori

    Joined:
    Apr 9, 2010
    Posts:
    151
    Regarding Integration with Enviro Sky
    I followed every Steps from the Documentations , i uncommented the Defines and Include but the Fog does not work at all
    please help
     

    Attached Files:

    • 01.jpg
      01.jpg
      File size:
      414.7 KB
      Views:
      358
    • 02.jpg
      02.jpg
      File size:
      311.6 KB
      Views:
      337
  26. Woolf

    Woolf

    Joined:
    Dec 4, 2012
    Posts:
    35
    I found LuxWater_SetToGerstnerHeight maybe this is what you need
     
  27. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    223
    Ive been taking a crack at this for two days and no luck with the caustics and displacement keeps disappearing when taking it out of the demo. Why is this a thing? Will u be updating to include prefabs for water materials so we can just drag and drop? That will make this so much easier to use...
     
  28. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    223
    How do I go about getting a refund? You are extremely elusive and honestly this asset is a pain to use.

    I had high hopes and was excited at first but As you Can see from previous threads, mine and others, Sometimes things work and sometimes they don’t. I should of jus gone with stylized water shader which I will do. But I feel I need a refund due to this asset causing more trouble than it’s worth and basically not working.

    caustics won’t work as intended.

    Underwater blur disappears when it feels like it.

    Foam changes on its own

    displacement rarely every works

    seems everything only works on demos only.

    and your customer support is rarely there. We have to chase you down.

    I’ll be submitting for a refund.
     
  29. larock01

    larock01

    Joined:
    Oct 5, 2015
    Posts:
    3
    Using Enviro and the 5x5 ocean material and Skirt. The anchor override did not do anything, What am I doing wrong? Makes no sense
     

    Attached Files:

    Last edited: Nov 6, 2020
  30. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I've got a creek entering a larger river, and the river has different meshes (for normal and spring-flood level), and when the creek mesh goes underneath the river mesh (different materials, both using Lux water), then there are some issues....is there anything I can do to make this work? I guess I can have different creek meshes that better align with the river mesh edge, but would be great if that wasn't necessary....(and it's still very hard to get a nice junction). (And I know I need to tweak the materials to get them more similar...).

    creek junction3.JPG

    thanks!
    Dave
     
    Last edited: Nov 8, 2020
  31. BlackManatee

    BlackManatee

    Joined:
    Jun 13, 2013
    Posts:
    82
    First off, thanks for an absolutely WONDERFUL package, and a steal for the price!!! The manual is excellent, and the product itself is miles ahead of the competition.

    Here's my problem, though: for the current scene (an island fly-by plus eventual surface action), I have no need for direct underwater rendering (camera beneath the surface). I'm also very unclear on the actual rendering costs of the various (MANY!) systems and methods available in Lux Water.

    So my "urgent" question is this:
    • Which scripts/effects (or water prefab) are required for an "Infinite Ocean" that only needs to be viewed from the surface?
    • Less urgent questions are:
      • Which scripts/effects are especially costly (or cheap) in terms of CPU/GPU? I understand that this is a complex question that depends both on the user's hardware (I have an RTX 2070), rendering pipeline (I'm using Unity's standard pipeline, in 2019.3.10). Still, I'd really appreciate some sort of pointers on what is essential vs merely desirable. ;-)
      • Might you consider adding a quick "use-case scenario" section to your excellent manual? For instance, my current scene requires (1) infinite surface ocean (2) translucency and possibly refraction, though those might be dispensed for some quality levels (3) shoreline effects (foam, at least, with an adjustable distance-from-shore), and (4) simple foam effects on *static* objects like piers and pilings. I realize that translucency and refraction involve a type of sub-surface rendering, but I don't need the camera to actually drop beneath the surface.
    Many thanks again; I'm off to post my 5-star review! :-D
     
    Last edited: Nov 14, 2020
  32. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    ah, this case i not covered well as you need the infinite ocean script on the water as well as the underwater rendering script on the camera... you do not nee underwater blur and water volume trigger.
    the underwater blur. but actually it is all pretty cheap :)

    and i do not get the last question...
     
  33. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hey gecko,
    simply going to the "01 LuxWater Simple Demo" scene and duplicating, rotating and repositioning the "RiverMesh" i do not get these strange artifacts. water does not blend as both meshes write to depth... but i can not reproduce your artifacts.
    can you investigate using the frame debugger and post some screen shots?
    like: which surface is drawn first? and then how does the draw of the second surface look like?

    lw.PNG
     
  34. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @gecko assuming that the lake is drawn first and then the river gets rendered on top:
    - the lake material darkens the refraction more as it uses different light atten values. so you get a dark lake. but it does not write to depth?
    - then the river is drawn with different attenuation values. as the lake does not writ to depth it is not seen by the river. so the river draws on top. with less atten given to its material.

    fix: make both materials write to depth. make both materials use the same atten values.
     
  35. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Yes, the lake is drawn first. Both water materials had ZWrite set to Off. Changing that to On for the lake material fixed the problems (except for the difference in water color, but that's my problem to work on...) -- but reading the docs, now I need to do those things listed in the Metal section to make the water render on Mac Metal, right?

    Also...I don't see an Attenuation value on the material, where is it?
     
  36. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    great!
    unfortunately: yes.

    oh, there are a few.
    underwater fog and light absorption are the relevant categories here. not marked but alo relevant: Absorption cancellation.
    best would be to start with 2 identical materials regarding these params. then maybe tweaking one to get the desired look but not breaking their intersection.

    absorption.PNG
     
  37. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I kinda guessed that's what attenuation was, but thanks for the screenshot. Yup, I'll get to work tweaking to match. thanks!
     
  38. Quique-Martinez

    Quique-Martinez

    Joined:
    Oct 1, 2013
    Posts:
    141
    Hi, is there a way to add blur to the planar reflection (red?), if true is it possible to make it dependent on the distance(blue)?. There is a way to apply masks on the ripples(green)?
    upload_2020-11-20_21-32-3.png

    For the first question I'm exploring
    Code (CSharp):
    1.         public void WaterTileBeingRendered(Transform tr, Camera currentCam)
    2.         {
    3.             RenderHelpCameras(currentCam);
    4.             if (m_ReflectionCamera && m_SharedMaterial)
    5.             {
    6.                RenderTexture blurred = new Blur(m_ReflectionCamera.targetTexture);
    7.                m_SharedMaterial.SetTexture(reflectionSampler, blurred);
    8.             }
    9.         }
    With different blur methods from the forums, but I don't see any effect. Will I have to modify the shader?
    Thanks in advance.
     
  39. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    you do not have to modify the shader to get a blurrd reflection. you just have to provide one.
    in case you need 3 different kinds of blur you may either just provide these or hack the shader.
     
  40. Quique-Martinez

    Quique-Martinez

    Joined:
    Oct 1, 2013
    Posts:
    141
    Thanks, I'll try
     
  41. montyjack

    montyjack

    Joined:
    Jan 10, 2014
    Posts:
    43
    Hey - LOVE the water system, but have a question - I've got an underwater hangar in my game, and I'm finding that the inside of it is still getting caustics, even though it's shaded from the sun - is there any way to turn off caustics for a given object?
     
  42. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    unfortunately no as cuastics are rendered inside the the water and underwater effects shader.
    you would have to render an additional mask map and sample it in the underwater effects shader...
     
  43. jchambers

    jchambers

    Joined:
    Feb 4, 2013
    Posts:
    7
    Hi.

    I seem to be missing something in getting the underwater to render.


    Above water and working as expected.


    Triggered when I go underwater.
    Note the log, underwater setup is false


    Box collider
    The top of the collider is level with the water line.
    Grid Size: what should this be set to? I have it set to my chunk size.


    Debug Logging



    Read the manual / "Creating large water surfaces and Oceans"

    I have looked at all the demo scenes, mainly the deep water scene.
    Duplicated the deep water material for my scene.

    Any help would be great.
     
  44. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    the volume is registered (top) and is set to active (top), if you enter it.
    but did you add the underwater rendering script to your camera? :)
    this should kick in case a volume is active and make sure a mask is rendered and finally the image effects are applied.
     
  45. Da-Luk

    Da-Luk

    Joined:
    Apr 25, 2017
    Posts:
    53
    Hey, i dont know why, but the waves are not displaced. In the scene view i can see in wireframe mode that the tesselation is working but the ocean preview scene is totally flat without any waves. What im doing wrong? There are no errors using Unity 2019.4.15f1 LTS.
    Thanks
     
  46. jchambers

    jchambers

    Joined:
    Feb 4, 2013
    Posts:
    7
    Thank you for the reply.

    I do have the underwater script added.
    Though I did uncheck others after reading a post that they are not necessary.?




    "the volume is registered (top) and is set to active (top), if you enter it."

    So I am clear -- the box collider (top) needs to be aligned with the water plane (Y value) , correct?


    "this should kick in case a volume is active and make sure a mask is rendered and finally the image effects are applied."

    I do not understand this statement.
    Do I have to write a script for this?
    .. or are you saying it should work at this point?
     
  47. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    yeah, or a little bit above.
    it should just work at this point. have you tried to debug the underwater mask texture? if you are inside a volume this must be rendered.
     
  48. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    i do not really know... does your target platform support tesselllation? have you checked the dispalcement params in the shader?
     
  49. jchambers

    jchambers

    Joined:
    Feb 4, 2013
    Posts:
    7
    I must have something inherently wrong..

    Debugging showed it should be working.

    LuxWater_UnderWaterRendering

    Code (CSharp):
    1.  
    2. public void RenderWaterMask(Camera currentCamera, bool SecondaryCameraRendering)
    3. {
    4.  
    5. ...
    6. ...
    7. ...
    8.  
    9.    //  Draw water surface only if volume is active or AdvancedDeferredFog is enabled
    10.     if (i == activeWaterVolume && activeWaterVolumeCameras.Contains(currentCamera) || EnableAdvancedDeferredFog)
    11.     {
    12.         if (useTessellation)
    13.         {
    14.             if (i == activeWaterVolume)
    15.             {
    16.                 mat.SetPass(3);
    17.             }
    18.             else
    19.             {
    20.                 mat.SetPass(4);
    21.             }
    22.         }
    23.         else
    24.         {
    25.             if (i == activeWaterVolume)
    26.             {
    27.                 mat.SetPass(1);
    28.             }
    29.             else
    30.             {
    31.                 mat.SetPass(2);
    32.             }
    33.         }
    34.  
    35.        [B] Debug.Log("............ DrawMeshNow");[/B]
    36.         Graphics.DrawMeshNow(WaterMeshes[i], WatervolumeMatrix, 1); // submesh 1 = Water surface
    37.     }
    38.  
    39.     UnityEngine.Profiling.Profiler.EndSample();
    40. }
    41.  
    42. GL.PopMatrix();
    43.  
    44. }
    Makes it all the way to DrawMeshNow()
    Not sure what else to try.

    Would it be possible to hire you for a screen-share.
    I imagine you would be able to see what is happening.
    pm me the details.

    I have tried many, many variations over the last few days.
     
  50. Da-Luk

    Da-Luk

    Joined:
    Apr 25, 2017
    Posts:
    53
    If someone want to know what was going on with my no displacement waves problem.
    I got to many global shader keywords, i reduced them but after a unity restart, the waves didn't work. I checked the target Plattform which was set to "windows". The same, no waves. But after i unchecked / checked the gerstener waves in the shader the displacement suddenly worked ! Looks very nice. Great Asset !