Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

[RELEASED] Lux Water

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

  1. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,381
    And anyone tested this setting the android as Vulkan instead of Opengl3? Performance goes way down, when it should in theory be faster.
     
  2. DavidCraig

    DavidCraig

    Joined:
    Sep 10, 2019
    Posts:
    14
    Just wondering how to go about modifying the gerstner waves global rotation from script? I have changed the gerstner wave line to look as follows:

    #pragma multi_compile __ _GERSTNERDISPLACEMENT

    and I have enabled every possible keyword I can find but still nothing until I physically click the material in the hierarchy. Am I missing something, surely theres a way to modify the global rotation of the waves at runtime.

    Cheers
     
    Last edited: Apr 7, 2021
  3. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,381
    is this asset dead? no updates for a year already... and no replies to the bugs.
     
    LaireonGames likes this.
  4. maverick34jjv

    maverick34jjv

    Joined:
    Mar 12, 2013
    Posts:
    1
    I'm having an issue with water projectors. I have two heights for water surfaces. In the image below, the Ripples Effect is on the lower body of water, but it is still being shown on the top level. Any ideas on how I could get this effect working properly via shader edits? The camera (deferred) can move around freely, so no camera tricks to toggle the effect on and off if it's in a certain zone.

    upload_2021-4-15_20-51-31.png

    Is there a way for the ZTest attribute in the projector shader to also influence the final effect? or have another shader used for blocking the effect?

    Any pointers would be appreciated. I'm still new to shader code and the command buffer, I'm aware of some of the properties and workflows, but not all of them.

    Thank you!
     
  5. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,381
    It seems this asset is dead, or at least no replies for a year. It´s a shame because the water looks awesome compared to almost any other water in the store.

    Anyway, anyone managed to get it working on VR with single-pass instanced?
    I´ve been playing around with the shaders and I was able to get it to render but the right eye doesn´t like and it and renders a grey square.
     
  6. julienrobert

    julienrobert

    Joined:
    Sep 15, 2014
    Posts:
    64
    I'm having the problem that the shader won't show up in runtime. It works fine in editor though. Any idea why?

    Unity 2019.4 using standard renderer.
     
  7. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,172
    I have some very long (7km) rivers, created with R.A.M.), and so I have split them into shorter segments. But at the junctions, the Lux Water material looks very different. Is there anything I can do to make this a smoother transition? I can sorta understand why the reflection could be different, but I don't understand why the texturing is so different. These have the same Lux Water material assigned, and the poly density and UV should be the same, since they are the same river created by R.A.M, just split into separate subsections.

    thx
    Dave
     

    Attached Files:

  8. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    this option turn shadows on/off when it comes to render the reflection – not the water.
    yes: it is quite expensive.
     
    LaireonGames likes this.
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    it should. have you checked the demos?
     
  10. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    it is not a bug. it is a feature! read the docs :)
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    it does not, sorry.
     
  12. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    no shadows on transparents, sorry.
     
  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    i have never heard about this. any furtehr information? deferred, forward, gamma, linear, build target?
     
  14. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    hmm, it looks as if the uvs are not the same/matching here. i have no other explanation for this.
     
  15. Juneav

    Juneav

    Joined:
    Feb 18, 2017
    Posts:
    20
    Hello! Were you able to resolve this? I have the same problem :(
     
  16. MGreenberg

    MGreenberg

    Joined:
    Oct 21, 2019
    Posts:
    3
    I have an issue; when I duplicate the main camera to make additional cameras in the demo scenes (Demo 10).. the act of duplicating the camera destroys the underwater shader? So then both cameras have no under water shader. Any help appreciated :)
     
  17. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    if you look at the camera in demo 10 it holds all the underwater rendering specific scripts. so simply duplicating it will make the script multiple times?
    i can ust duplcate the camera and all its scripts but have to disable either the original or the copy. which is just obviou as you do not want to render 2 camera on top of each other.
     
  18. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,381
    any luck to get this working on VR single instance? I tried to modify the shaders but no luck.
     
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    you may ask @Monil about his/her approach.
     
  20. PeterB

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    366
    No. After more than 10 years, I ditched the entire Unity platform and am now living a much more comfortable, error-free and productive life with Unreal.
     
    creat327 likes this.
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    efficient bug fixing :)
     
  22. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,381
    I wish I could easily migrate my project to Unreal. Unity is a nightmare due to these kind of things.
     
  23. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,381
    I asked him with no luck. He doesn't reply. But I thought I bought the package from you, is he in the support team?
    This is horrible that it can't run on VR single instance, and since you wrote it I think you should be able to fix it pretty fast because you know the inside/out. I was able to get it to render but the water shows up grey in one eye and good on theh other.
     
  24. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    he is not. but lux water never officially supported vr.
     
  25. Monil

    Monil

    Joined:
    Apr 24, 2012
    Posts:
    97
    I use MultiPass, in the next days (I hope) I will send my solution for caustics and reflections to larsbertram1, for now I have to urgently solve other things.
     
  26. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,381
    Ok, I got it to work almost perfectly for single pass VR. Im stuck solving one thing and maybe you can help me.
    Here is a screenshot

    forforum.jpg

    The left side is what the water should look like (I don't use foam). It looks fine in the editor as you can see. The right side is what the VR sees. It's almost perfect but the shoreline depth is gone. The is no transparency in there.

    Any ideas how to fix that? It's the only thing remaining.
     
    Last edited: May 4, 2021
  27. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    all samples should use the "new" UNITY_SAMPLE_SCREENSPACE_TEXTURE macro.
    https://docs.unity3d.com/Manual/SinglePassInstancing.html
    all this already works in my dev branch. the tricky part are projectors and underwater rendering.
     
  28. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,381
    Thank you!

    It worked, simply replacing
    // sampler2D _GrabTexture;
    UNITY_DECLARE_SCREENSPACE_TEXTURE(_GrabTexture);

    and

    half3 Refraction = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_GrabTexture, float4(snappedDistortedGrabUVs,0,0) ).rgb;

    seems to have done the trick for the shore line. So far looking fantastic on VR and single pass rendering!
     
    Last edited: May 4, 2021
  29. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    you are welcome!

    meanwhile i have been looking into adding vr support - although this is something i never really wanted...
    multi pass and single pass instanced seem to be working already. underwater and projectors do as well.
    tested on unity 2019.4. LTS, dx11, forward rendering, mockHDM and oculus rift - that is all i will support.

     
    sjm-tech and Monil like this.
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    lux water 1.2. is now available!
     
    creat327, Faizalski and sjm-tech like this.
  31. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,381
    Something about the depth test is wrong. But you can only see it if you switch to android. Performance is great but it looks as the ztest or depth calculation is off.
    forum2.jpg


    The left side is the editor, which shows up correctly. The right side is the VR. The shore line keeps moving up and down depending on the angle I move. In that picture all that area should be covered by water.

    You can also see the bridge shape on the water (see the right of the bridge), as if it was rendered on the other eye and it´s actually flipped upside down.

    here in more detail, see the bridge and the water is cut short (it actually goes all the way to the mountain). If i look down, then the water covers the area. Maybe the distance calculation is wrong. I don´t know.
    forum3.jpg
     
    Last edited: May 5, 2021
  32. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    gles3 and vulakn the same?
     
  33. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,381
    I didn´t check vulkan. Performance sucks for the Quest 2 and it´s not recommended.
     
  34. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,381
    Maybe this helps to think what's doing wrong. If you compile and run it on Quest 2 without single pass. Meaning, stereo rendering. You will see the water perfect and it renders fast. But...

    My game is an airplane simulator. If I go high in the sky, the higher I go, the water begins to go down into the terrain. Like if the Y axis moves down and down and down.
    Then if i come back down, the water begins to move up and up... until it reaches its proper position (when im flying sea level).

    Something in there is messing it up. I hope we can figure it out because it really does look fantastic in the Quest 2 and fast rendering. Nothing in the asset store even comes close.
     
  35. julienrobert

    julienrobert

    Joined:
    Sep 15, 2014
    Posts:
    64
    I had to add the script Lux Water Camera Depth Mode and modify it to take the right camera instead of generating one.
     
  36. julienrobert

    julienrobert

    Joined:
    Sep 15, 2014
    Posts:
    64
    New question, is it possible to get reflection of objets that are not in the culling mask of the camera? The reflection works fine when the layer in included in the culling mask of the camera though.

    I checked Planar Reflection in the shader, added the script Lux Water Planar Reflection, added the material to the script, and did not change any other parameters. My camera is in Forward mode.
     
  37. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    you mean the culling mask of the "main" camera, not the reflection camera, right?
    actually this should already be the case...
    if you look into the PlanarReflection script the var reflectionMask is initialized with -1 so all its bits are set to 1.
    only the layer Water gets excluded a bit later in code.
     
  38. julienrobert

    julienrobert

    Joined:
    Sep 15, 2014
    Posts:
    64
    Strangely, it works as expected in the demo scene but not in my project. I wonder why.
    The reflectionMask is set to everything.
     
  39. asdferasv

    asdferasv

    Joined:
    Dec 24, 2020
    Posts:
    8
    upload_2021-5-10_21-37-34.png
    LuxWater\Scripts\LuxWater_ProjectorRenderer.cs(229,40): error CS1503: Argument 1: cannot convert from 'Plane[]' to 'UnityEngine.Plane[]'
    how to fix this bug?
     
  40. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    which version of unity do you use?
    try to define frustumPlanes like this:
    UnityEngine.Plane[] frustumPlanes;
     
  41. asdferasv

    asdferasv

    Joined:
    Dec 24, 2020
    Posts:
    8
    I use 2019.4.7f1 unity,1.101lux water
    when I use UnityEngine.Plane[] frustumPlanes to define frustumPlanes,a new bug has arisen:
    upload_2021-5-10_21-58-4.png
    cannot convert from 'UnityEngine.Plane[]' to 'Plane[]'
     
  42. asdferasv

    asdferasv

    Joined:
    Dec 24, 2020
    Posts:
    8
    I've fixed it,thanks
     
  43. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    how?
     
  44. blackant

    blackant

    Joined:
    Jun 18, 2009
    Posts:
    487
    Hello,

    Because of a bug i have to add component Lux Water_Under Water Rendering on my camera when the game starts.
    it works and i can define parameters like i want them to be (find sun, set default water surface Position etc...

    but when i activate Debug, i can see that the active water volume is set to none and registered volumes to 1.

    i tried multiple time to activate/deactivate gameObjects and script to check if it can update there status, but it seems not changing anything and the underwater effect is never active.
    so i'm not sure if i miss something but it was working at the beginning of using lux water.
     

    Attached Files:

  45. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    "registered volumes to 1" is fine.
    "active water volume is set to none" is not.
    it looks as if your camera starts right within the water?
    the collision between water volume collider and camera is detected before the underwater rendering script is enabled.
    so the collision does not "activate" the water volume.
    however if you look into the WaterVolume script you will find OnTriggerStay() which also triggers EnterWaterVolume().
    so in order to get a better picture of what is going on you should debug OnTriggerStay() and see if EnterWaterVolume() is called.
     
  46. blackant

    blackant

    Joined:
    Jun 18, 2009
    Posts:
    487
    Thanks,

    i checked and fund the problems, mainly caused by my timeline, some event went called before the setup of water trigger and volume render were finnished.
    now it works again perfectly !
     
  47. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    great!
     
  48. Ali-Nagori

    Ali-Nagori

    Joined:
    Apr 9, 2010
    Posts:
    147
    Hi lars
    I know that LUX Water is not compatible to URP , but i would like to place my request to make version for URP , you have amazing contributions for URP with ATG and LUX essentials, lux essential has a water shader but it no where near beautiful and rich as LUX Water , LUX Water has normal and foam projectors which are the best feature giving greate interactive look with best possible performance.
    Im sure im not the only one wishing for URP version of LUX Water.
     
  49. graphicsayy97

    graphicsayy97

    Joined:
    Dec 24, 2020
    Posts:
    43
    i bought it anyway thanks for response
     
  50. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,353
    good choice :)
     
unityunity