Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

[RELEASED] Lux Water

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

  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    oh, sorry. actually the needed copydepth shader for metal is missing in the current project.

    you will find it attached.
     

    Attached Files:

  2. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,084
    Thanks. I've put that in the Shaders folder in the project....but do I need to do something more with it? The water doesn't look any better yet. (I'm not using Gerstner waves so have only switched Zwrite to Off.)

    thx
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    nope. it just fixes the c# error. and should give you proper depth rendering when using metal and deferred.

    but how does your water look?
     
  4. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,084
    Lars fixed the problem for me via Skype, and now I too have the gorgeous water that everyone else is raving about. Thanks!

    No need now, the water just wasn't rendering properly for me. Thanks, though!
     
    sjm-tech likes this.
  5. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,084
    Does anyone have any suggestions for character interactions with the water, specifically swimming/floating? I have assumed that we need a collider-trigger on the water mesh (which is tricky given a very long river and Unity's restrictions on convex colliders) to activate swimming animations, but I noticed the extra script for gerstner wave height.... We're not using gerstner waves, but is there something similar we could do with Lux without a mesh collider-trigger? (Ideally, tell the character to use swimming animations, and set the buoyancy height. If so, how would that compare, performance-wise, to the trigger method?)

    thanks!
     
  6. Niels40

    Niels40

    Joined:
    Nov 6, 2017
    Posts:
    20
    Hey @larsbertram1 ,

    What would you suggest in terms of water where i need a giant ocean but dont really need underwater effects (Just basic dark fog)? I tried some of the water objects used in the demo scenes but they dont seem like they are intended for large water planes.
     
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    depends on if you want to use gerstner displacement. if so you will need a nicely subdivided mesh to make it look good.
    in case you need a huge water plane this would need an incredible mesh regarding subdivision.
    so you could use some kind of manually LOD mesh and move it according to your camera position.

    from an old answer:
    it is not a dedicated ocean shader and does not support techniques like e.g. a projected grid.
    but you could create e.g. a plane divided into 9 sections where only the middle one has a high subdivision.
    mask gerstner waves by adding vertex color red (see docs: water volumes).
    then you would have to move the plane according to the camera position and the grid size you have chosen on the inner section (so vertices fall on top of vertices when you move the mesh).
     
  8. buffy1

    buffy1

    Joined:
    Dec 1, 2018
    Posts:
    1
    I have two different cameras in my scene where one is a main camera and one camera is rendering to a UI component. I can get one camera to an render underwater volume just fine, however when I try to get both to render water volume, neither work. How can I get two camera's to render underwater at the same time?
     
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    i will have to look into this...
     
  10. salsanoe

    salsanoe

    Joined:
    Nov 25, 2018
    Posts:
    5
    I would like to generate a simple bow wave. I experimened with a local normal projection which generates rings ahead of the boat. Scaling (streching) the projection and adapting the normalmap looks nice but the streched rings are rotating when the boat changes course (camera is fixed on the boat) . Is there a simple solution to stop rotation of normal projection rings or rotate them always in direction of the camera? (hope I could explain it, I'm new to Unity and my english is limited) Thx!
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    i am not sure if i understand your problem correctely. but theoretically it is all controlled by the particle stystem...
     
  12. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    Finally tessellation is in.

     
  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    Version 1.06 now is available!
     
    mmaclaurin likes this.
  14. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    235
    Lux continues to be a great choice for me, thank you!

    Wondering if there is support for LWRP? I've got a solid 30fps but there are more features to add :)

    Would be happy to pay more for an LW version if that helps.
     
  15. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    you are welcome.
    LWRP and HDRP are currently not on my list as they change just everything. but that might change if both are out of beta.
     
    Last edited: Dec 24, 2018
  16. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    why do both cameras have to render the water volume?
    and does your ui write into the depth buffer?
     
  17. TD_Junkie

    TD_Junkie

    Joined:
    Mar 8, 2016
    Posts:
    6
    Hi,
    Thanks for your reply to the review

    Thanks for explaining why the shader doesn't work well with perspective. Would you consider adding into the asset details something mentioning that the shader is best with perspective (useful info for numpty indie programmers like myself)

    Will look into the FarNormal/Render-Queue settings soon, today hopefully
    Will edit review after I've had a chance to do this

    New vid looks good, displacement is a rather nice feature, can imagine it will look great in games with structures such as oil rigs, boats etc

    Regarding a whole new shader for orthgraphic, I can't imagine there would be much demand for it as it's a bit niche, but if you're bored... :p

    Thanks,
     
    Last edited: Dec 24, 2018
  18. TD_Junkie

    TD_Junkie

    Joined:
    Mar 8, 2016
    Posts:
    6
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    hi there,
    i am not really bored – even if it might look so as it is christmas evening. but the kids are in bed...
    and i already had a look into orthographic rendering (not anything i am usually into): it turned out that with just a couple of changes the shader actually works pretty well. dual depth based attenuation does not work yet – so underwater fog as well as light and color absorption are both fully driven by attenuation along the view ray.
    the same goes with screen spaced caustics which do not work.
    so basic support for orthographic cameras will come with the next update which already is submitted and should land within the next – 10 days?

    both – scene and game view – in orthographic projection:

    lux_ortho.PNG

    same with the projector demo: here you can see that you will loose some of the dual depth based absorption...

    lux_ortho1.PNG
     
  20. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    oh, that changes a lot – you are just using some wrong values :)

    below you will see the fjord demo with just a single water plane. in scene view the camera is pretty far away (the red "circle" marks the position of the submarines) – so here you mostly see the far normals. of course they tile but at a really low frequency.
    game view shows the scene from the perspective of the game's camera which is quite close and only shows the highly detailed detail normals.

    regarding the settings: tiling for far normals should be very, very small. the smaller the value the larger they will get. fade should be in a range of 0-1 as it defines the distance in clipspace (0-1) where the far normals kick in.
    so your settings were unfortunately totally off.

    far_normals.PNG

    this screen shoot shows the blending between detail and far normals. maybe i will have to a normal scale for far normals as well.

    far_normals_02.PNG
     
    Last edited: Dec 24, 2018
    Lars-Steenhoff likes this.
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    done.
     
  22. TD_Junkie

    TD_Junkie

    Joined:
    Mar 8, 2016
    Posts:
    6
    I feel like santa shouldn't be working on shaders right now :D
    Looks good though, looking forward to the update ^^
     
  23. TD_Junkie

    TD_Junkie

    Joined:
    Mar 8, 2016
    Posts:
    6
    Regarding orthographic views, the water is dark in middle, and lighter around edges. move the camera around, the dark/light areas move with the camera as it reflects the skybox, anything that can be done about that? Just goes very dark if turning skybox reflection off
    - Have made a quick video example of what I mean (only a few MB)
    http://s000.tinyupload.com/index.php?file_id=04314557401375847295

    Managed to fix the spotlight effect I mentioned previously by simply rotating the sun a bit so the spotlight effect is offscreen

    I also remembered orthographic = forward rendering so had to add that script etc as per manuals instructions

    If you could add an orthographic demo screne in your next update with some nice presets that would be kinda awesome :)

    Review updated :)

    I feel like $9 is a bit low for this level of support :D
     
    Last edited: Dec 25, 2018
  24. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    this is caused by the fresnel factor which kicks in when the reflections are claculated and the "worldviewDir", which unity does not seem to calculate in an "orthographic way". so unity's gi reflection code results in weaker reflections around the center - just like you described.
    a dirty fix for this would be to make the water more "metallic". do so by brightening the "Specular" color and lowering the reflection "strength".

    regular reflections:
    common_spec.PNG

    tweaked reflections:
    adjusted_spec.PNG
     
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    i am looking into adding a msaa depth fix. not perfect yet but already better than doing nothing.

    orthographic forward camera using 4xmsaa:

    depthfix_off.PNG

    orthographic forward camera using 4xmsaa and current depth fix:

    depthfix_on.PNG
     
    Last edited: Dec 26, 2018
  26. TD_Junkie

    TD_Junkie

    Joined:
    Mar 8, 2016
    Posts:
    6
    Looking good :)
     
  27. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    235
    A little christmas card to Lux (+enviro) upload_2018-12-26_0-14-9.png
    Also excited about Lighweight render path support in the new year! 2018.3 is final now :D
     
    muzboz and hopeful like this.
  28. muzboz

    muzboz

    Joined:
    Aug 8, 2012
    Posts:
    68
    Love your flying boat. :)
     
  29. muzboz

    muzboz

    Joined:
    Aug 8, 2012
    Posts:
    68
    Hi @larsbertram1

    I saw there was a LUX update. What was in the update?

    Cheers.
     
  30. Joshua_strawchildgames

    Joshua_strawchildgames

    Joined:
    May 27, 2017
    Posts:
    60
    Would be great to get HDRP support. I've not been able to find any water assets that supports HDRP.
     
  31. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    Version 1.06
    # LuxWater WaterSurface shader switched to CG.
    # LuxWater WaterSurface Tessellation shader added.
    # Normal Projectors: Format of normal texture changed to support tessellation and extrusion.
     
  32. Diego_Graphics

    Diego_Graphics

    Joined:
    Nov 3, 2014
    Posts:
    90
    Is it possible to make a submarine walkable and look through a large porthole into the water? or even the change between surface and underwater?
     
  33. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
     
  34. Diego_Graphics

    Diego_Graphics

    Joined:
    Nov 3, 2014
    Posts:
    90
    Yeah. I know the scene. The question is whether it is possible to show this but behind glass. I want to make a submarine accessible from the inside and make it possible to look outside through the bull's eyes. It would be cool if that would work even with this half under water effect but just behind the bull's eyes. Outside my submarine. Similar to subnautica where you can look out from the inside of the station.
     
  35. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    if the camera is below the water surface it is inside the water volume. and everything within this volume is considered to be under water as well.
    in order to create a "dry" space (like the inside of the submarine) you would have to mask the underwater mask. you could e.g. render first the inside of the submarine into the water mask so that is occupies the depth buffer and then draw the watervolume. see: "LuxWater_UnderWaterRendering".cs --> void OnPreCull () --> " // Render UnderWaterMask"
    this would let you keep the inside dry - but might not let you render the bull's glass properly (i am just not sure about this).
    glass might be blurred (maybe the blur is masked as well...) and in this case you would have to draw the glass after the blur effect - most likely using another cammand buffer.
     
  36. Diego_Graphics

    Diego_Graphics

    Joined:
    Nov 3, 2014
    Posts:
    90
    I tried to do that once, but unfortunately I'm not good enough at programming it. but it would be nice if you could add such a function in lux water. so collider that cut the water. that's already important for boats that shouldn't be full of water and for submarines it would also be cool. but I also don't know if it's impossible with lux water. but it would be very useful.
     
  37. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    well, i guess this is a very special request.
    and i had a look at subnautica: their underwater rendering seems to be quite different: just a water adjusted fog and maybe some depth of field?
    but apart from that: if your game is centered around an underwater world i guess you will have to get into scripting as there will be so many demanding issues you will have to solve like particles and alpha blended materials, pixel lght counts – just to name a few.
    nevertheless i may look into i may look into masking water volumes in further releases.
     
    pixelsteam, Mark_01 and hopeful like this.
  38. Chocololi

    Chocololi

    Joined:
    Nov 30, 2016
    Posts:
    4
    Hello! First of all, i want to say that i find this water system amazing!
    However, i seem to have a problem with it
    As soon as i come close enough to the water for the water volume to appear, the waves seem to render in front of solid objects.
    luxwaterbug01.jpg luxwaterbug02.jpg
    Hope you can help!
     
    Rowlan likes this.
  39. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    hmm, i am not sure what i actually see on your screen shoots... the bech on the lower one looks a bit strange in the foreground. is that what you mean?

    have you already enabled debug?
    my first guess: the water volume does not really fit the water plane as far as size and/or position is concerned.
     
  40. Chocololi

    Chocololi

    Joined:
    Nov 30, 2016
    Posts:
    4
    luxwaterbug03.png
    thanks you for the fast anwser!

    The water volume is at the right position as i have no problem looking underwater, its just that once the Active water volume is on, parts of the waves start rendering through walls
     
    Rowlan likes this.
  41. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    oh, that is barely visible :)

    but open the LuxWater_WaterMask.shader and look for any "Offset -1, -1" or "Offset -3, -3".
    if you find any simply comment the line.
    that should fix the issue.
     
  42. Chocololi

    Chocololi

    Joined:
    Nov 30, 2016
    Posts:
    4
    that did the trick thanks you!
    the water is working perfectly now!
    luxwater.jpg
     
  43. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    great.
    and your screen shoots look incredible!
     
  44. Chocololi

    Chocololi

    Joined:
    Nov 30, 2016
    Posts:
    4
    Thanks you!
     
  45. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
  46. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    instead of working on improving the support for orthograhic rendering i took a little sidestep and had a look into deep water rendering including full directional lighting suppression and support for local underwater point and spot lights as well as faked volumetric light beams and transparent materials.
    this is a first and pretty early version and it fully relies on deferred rendering.
    Attention: Heavy bending due to video compression!

     
  47. TD_Junkie

    TD_Junkie

    Joined:
    Mar 8, 2016
    Posts:
    6
    Looks good, I forgive you. :D
     
  48. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    708
    Amazing work ... also with ugly video compression! :)
     
    onefaceoneface likes this.
  49. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,662
    version 1.062 now is available.

    Version 1.062
    # LuxWater WaterSurface shaders: Basic support for orthographic projection added.
    # Planar reflections: Support for orthographic cameras added.
    # LuxWater WaterSurface shaders: Far normal scale added.
    # Lux Water Volumes: Fixed depth issue when using tessellation
    # Water Projectors fixed (after pause).
     
    Fenixake and TD_Junkie like this.
  50. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    122
    @larsbertram1 A couple questions:
    1. I'm not able to get the water volume working with the OceanPlane mesh. It works fine when I use pPlane1 or pPlane2. Does it work with the ocean plane? If so, any suggestions?

    2. I'm using UFPS which has 2 cameras (FPSCamera and the WeaponCamera). I want the fps arms and weapon to appear under water, so I've added the required Lux Water scripts to the weapon camera. It works, but there is a gap between the water surface and the volume effect. I think this is because the cameras have different Fields of View. When both cameras have the same FOV it matches pretty closely, but then the weapons/arms don't look right. So, is there a way to offset the water volume effect is this scenario?
     
    Last edited: Jan 7, 2019
unityunity