Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Official Water System for the High Definition Render Pipeline

Discussion in 'High Definition Render Pipeline' started by auzaiffe, Nov 26, 2021.

  1. valarus

    valarus

    Joined:
    Apr 7, 2019
    Posts:
    402
    Is buoyancy system available in 2022.2.0a8 and will a8 be in UnityHub?
     
  2. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    533
    Probably too soon for a8. We don't know yet in which engine version it will land.
     
  3. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,706
    @chap-unity out of curiosity how did you guys did the waterline?
     
  4. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    533
    @auzaiffe tried to make it work but unfortunately since water surface vertices don't move only up and down, it was too complicated to make a robust system for the time being so we decided to focus on more important stuff like buoyancy for now.
     
  5. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,706
    Ah because the choppiness...
     
    chap-unity likes this.
  6. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    350
    I'm getting this error on 2022.2a7 when creating water shader graph
    upload_2022-3-11_20-17-10.png
     
  7. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,747
    Water system in the Viking Village URP looks very similar to this one:

     
    soleron likes this.
  8. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    350
    Still not working in 2022.2a9 i'm getting black screen and this error now when creating water upload_2022-4-2_4-35-20.png
     
  9. LumaPxxx

    LumaPxxx

    Joined:
    Oct 3, 2010
    Posts:
    316
    Hi,i tried this water system in 2022.2a9,it looks great!
    i have 3 questions.

    1.the foam does not receive ambient lighting, so you can see it is totally dark in the shadowed area. is this normal ?

    J%AJSCK[X%2J~_B9FID5KO0.png



    2.i didn't find any option for contact foam, is this feature not in the plan?
    i mean something like this foam:

    IMW[ZR7B~4`}`K6@9(A@O(7.png

    3.any place i can change the color of the water?
     
    Last edited: Apr 2, 2022
  10. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    423

    Hey, the foam rendering is not optimal at the moment, it will be improved soon. If you look at the very first message of this thread, you'll see the contact foam is something we would like to do indeed.

    For question 3, you can change the water color by editing the "Scattering Color" (and the "Direct Light Body Scattering" to control the intensity of the forward scattering):
    upload_2022-4-4_13-45-6.png
     
    soleron, MatthewLTG, NotaNaN and 5 others like this.
  11. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    446
    I approve of the blood-red sea demonstration there Pierre heh. ;)
     
  12. Deleted User

    Deleted User

    Guest

    Adding any water body gives me the underwater effect across the whole world and the surface of the water is nowhere to be seen..... i am using 2022.2.9 alpha.... and also the water shader seems broken
    Screenshot (188).png Screenshot (189).png
     
    Last edited by a moderator: Apr 4, 2022
  13. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    533
    It's a known issue (give the link a few hours) and it has fixed internally.
    For now, the simple workaround I believe is adding a water rendering override and enabling it. This should fix the issue
     
    hkalterkait and Deleted User like this.
  14. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    893
    It still isn't visible in scene, I just get this:
    upload_2022-4-4_20-3-36.png
    upload_2022-4-4_20-4-2.png
    (Grid lines are invisible due to the water surface)
     
  15. LumaPxxx

    LumaPxxx

    Joined:
    Oct 3, 2010
    Posts:
    316
    Thx for answer!
    about question 3,i mean the color of water diffuse color.
    unlike the scattering color only react to direct lighting i mean the color that will react to ambient lighting.
    i guess the water is made with a material with black diffuse color, scattering color and refraction color,right?
    the shadowed parts can't be only lighted by reflections in real life.
    but as you said foam have some problems for now, i guess ambient lighting is in the same situation?
    O6@FXEI3DGG1]F}$94Z9L@I.png
    beautiful-diablo-lake-mountains-washington-state-usa-131960922.jpg
     
    Lahcene and ftejada like this.
  16. Ciderhelm

    Ciderhelm

    Joined:
    Apr 25, 2017
    Posts:
    7
    This is really fantastic, haven't had a lot of time to play with it but it's great out of the box.

    It'd be neat if there was an option to enable only the underwater caustics rendering, independent of the rest of the underwater effects. The light scattering in the underwater toggle seems to conflict with standard volumetric fog, and I'd love to still get these caustics.

    For context, while underwater I'm rendering top-down (which means the surface transition elements is not important to my use case), and using normal volumetric fog combined with directional light cookies creates really neat volumetric godrays, if a bit more stylized than realistic.
     
  17. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,706
    The wave scaling settings bit confusing for me, how to get smaller wave size and preserve the detail/mesh size?
    when i mean about scalling is not the wave heights, but the xz scale.
     
  18. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    3,295
    elmarj, Zimnel, Lahcene and 5 others like this.
  19. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,263
    tested on 2022.2.0a9, and for some reason light was not affecting the sea, until i selected light in hierarchy?
    (not actually 100% sure how it happened, but seemed like touching the light gameobject helped.. or did i miss some setting somewhere?)

    check video at 31:40 where it happened youtube link
     
  20. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,706
    upload_2022-4-8_1-59-45.png
    Is there anything i missed?
    still not getting water being rendered
     
    Lahcene likes this.
  21. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,035
    The water shows up in my game camera, but not in the scene camera.
     
    Lahcene likes this.
  22. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    OSX?
     
  23. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    Has been fixed since, will take a bit to reach you in the next release
     
    ftejada and LumaPxxx like this.
  24. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    Has been fixed since, will take a bit to reach you in the next release
     
    ftejada, Lahcene and LumaPxxx like this.
  25. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,706
    windows
     
  26. hkalterkait

    hkalterkait

    Joined:
    Jul 20, 2016
    Posts:
    11
    Hello, I recently tested the Water using Unity version 2022.2.0a12 on two projects, on a fresh new project and on a project I have upgraded form Unity 2021.3.2f.

    The water looks outstanding and I honestly can not wait until its finished. It just looks so good!

    Adding the Water to a fresh new project following the steps provided by @Rowlan (thanks by the way) worked with no issues.

    On the other hand adding the water to the upgraded project had/has some issues. With everything set-up correctly, when adding the Water Surface -> Ocean to the existing scene, I got an error and the water would not render.

    The error: "Compute shader (WaterLighting): Property (_AirSingleScatteringTexture) at kernel index (1) is not set
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)?"

    The temporary fix: When I toggled the Sky and Fog Volume off and on, the water rendered and it stop showing the error.
    It could be because I am using Lighting Override mask with this project because I stumbled around other issues with it as well. Note that every time I enter/exit play mode I have to toggle the sky and fog volume off and on again in order for the water to render and stop the error mentioned above.

    @Reanimate_L Maybe you have the same issue and could try what I have done, hope it will solve your problem for the time being.

    Thanks Unity team for your hard work this is just amazing!
     
    Last edited: May 10, 2022
    sqallpl and Rowlan like this.
  27. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,706
    Hmm nope, doesn't work for my case. Not sure why though
     
  28. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    350
    Check this guys
    This 2d fluid based shoreline and foam looks so good. Can we have something similar in unity?
     
  29. unity_8p6oRXXqiWbRTQ

    unity_8p6oRXXqiWbRTQ

    Joined:
    Dec 20, 2018
    Posts:
    17
    As far as i know it is based on unreals niagara particle system, and somehow turns it into water, but dont quote me on that. This type of water system is much more complex and it is a much different route to implement it this way.

    Would be interesting to know what the cost of this is. I think also somebody posted a fog simulation based on particles, to simulate mist going down a mountain. Would be interesting to see.
     
  30. unity_8p6oRXXqiWbRTQ

    unity_8p6oRXXqiWbRTQ

    Joined:
    Dec 20, 2018
    Posts:
    17
    Start coding :D
     
  31. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,706
    The original creator of Unity water system (or the previous version i guess) create similar system long time ago if i'm not mistaken
     
  32. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    350
    You mean this? https://twitter.com/greje656/status/1152054697915797505 I've seen his tweets and they look gorgeous too
     
  33. PaulMDev

    PaulMDev

    Joined:
    Feb 19, 2019
    Posts:
    51
    This thread is for a water shader so I don't think it's meant to be simulated.

    BUT there is a particle-based fluid simulation on the VFX graph roadmap : https://portal.productboard.com/8uf...ion?utm_medium=social&utm_source=portal_share

    But for now I think that the water shader is the priority as it's missing a lot of features : splashes, GameObject interactions, current, coastlines waves, and collisions for rocks in the middle of streams would be cool too.
     
  34. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    350
    That vfx thing on roadmap is a real 3d particle based simulation which is not suited for large scale sims as in the video. This 2d approach on another hand is pretty fast and looks very cool. And I don't understand your point about "water shader", everything is shaders and this thread is about water system and everything related to it.
     
  35. PaulMDev

    PaulMDev

    Joined:
    Feb 19, 2019
    Posts:
    51
    Sorry if I misunderstood the point of the tread.
    And is the 2d simulation really shader based ? You might be right and that would be really cool to have in Unity.
    Also yes you're right about the VFX thing it probably wont work for this kind of simulation.
     
  36. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,706
  37. Oniros88

    Oniros88

    Joined:
    Nov 15, 2014
    Posts:
    128
    I get this error in alpha 13
    upload_2022-5-16_4-13-37.png

    Entire screen renders gray unless I disable the water. The water works normally in alpha 11
     
  38. Vuilbaard

    Vuilbaard

    Joined:
    Dec 23, 2020
    Posts:
    8
    Just tried it out, but I cant get it to work, entire screen either turns into a water color or there is nothing at all, I do have volumetric clouds added, and even those are not visible when the screen is of a water color.

    using version 2022.2.0a13
     
  39. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    You also need to enable it on a volume profile in your scene. If you still don't get it working after that you can check this tutorial and see what settings you might have missed.

     
    Lahcene and soleron like this.
  40. Vuilbaard

    Vuilbaard

    Joined:
    Dec 23, 2020
    Posts:
    8
    Dude, thank you very much.
    For some reason my brain couldn't compute that step although I did do that similar step for the volumetric clouds lol
     
  41. keni4

    keni4

    Joined:
    Nov 30, 2014
    Posts:
    30
    Hi! Water looks amazing! What about foam disappearing over time and not immediate like now?
     
  42. PaulMDev

    PaulMDev

    Joined:
    Feb 19, 2019
    Posts:
    51
    I think that you can use the "foam drag" slider for that. Unless I'm mistaken.
     
  43. Vuilbaard

    Vuilbaard

    Joined:
    Dec 23, 2020
    Posts:
    8
    How do we fetch the water height at a specific location? I tried to get the water surface component (script) via code, but it does not seem to be able to find anything of the like

    Am I missing a using tag?

    I also do experience a lot of lag, having a simple terrain and the ocean produces 6 fps at time at runtime (edit: found the issue on the lag, it was the CPU simulation part and esp. the full resolution check box)
     
    Last edited: May 18, 2022
  44. Vuilbaard

    Vuilbaard

    Joined:
    Dec 23, 2020
    Posts:
    8
    So I found it, for anyone that is looking for the same thing add the following using tag:
    using UnityEngine.Rendering.HighDefinition;

    Via script you can then get the WaterSurface component and fetch the FindWaterSurfaceHeight();
     
    hkalterkait and LumaPxxx like this.
  45. Vuilbaard

    Vuilbaard

    Joined:
    Dec 23, 2020
    Posts:
    8
    To anyone as noob as myself, I did some testing with fetching the water height at a certain position and I have a solution that is working (at least for me), this what I have so far, maybe someone can shed some light on this implementation cause maybe there is something that can be improved.

    float FindWaterHeightAtPoint(Vector3 floatPoint)
    {
    float waterHeight;

    WaterSearchResult wsr;
    WaterSearchParameters wsp = new WaterSearchParameters()
    {
    error = 0f,
    targetPosition = floatPoint,
    startPosition = floatPoint,
    maxIterations = 16
    };

    waterSurface = ocean.GetComponent<WaterSurface>();
    bool hightAtPoint = waterSurface.FindWaterSurfaceHeight(wsp, out wsr);
    waterHeight = wsr.height;

    return waterHeight;
    }

    floatPoint is basically the specific point in world space where the water height needs to be fetched
    waterHeight is the return value when the method is called
    waterSurface is the component (script) that is attached to the ocean gameObject
    wsr.height what comes out of the fetch

    Now that raises the following questions though:
    1. what is the error variable for and what happens if I set this to 1 or higher?
    2. target and start position has the same vector3, is there any reason to have these there own vector3?

    Anyone with knowledge could help me with this would be apreciated, thanks.
     
  46. CaseyHofland

    CaseyHofland

    Joined:
    Mar 18, 2016
    Posts:
    362
    I haven’t checked myself but is there no documentation on this?
    Small note: I would rewrite your code to be an extension method for WaterSurface like so:
    “public static bool FindWaterSurfaceHeight(Vector3 floatPoint, out WaterSearchResult waterSearchResult)”
    This is way more general, reusable and accessible.
    Alternatively, an explicit conversion from Vector3 to WaterSearchParameters would also work.
     
  47. Vuilbaard

    Vuilbaard

    Joined:
    Dec 23, 2020
    Posts:
    8

    Thanks for the info, this was just a quick test, I also notice that i am fetching the watersurface component in fixed update lol
     
  48. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    Here is a monobehavior that snaps a game object to a given water surface.


    using UnityEngine;
    using UnityEngine.Rendering.HighDefinition;

    public class FitToWaterSurface : MonoBehaviour
    {
    public WaterSurface targetSurface = null;
    public int numIterations = 8;
    public float error = 0.01f;

    // Internal search params
    WaterSearchParameters searchParameters = new WaterSearchParameters();
    WaterSearchResult searchResult = new WaterSearchResult();

    // Start is called before the first frame update
    void Start()
    {
    }

    // Update is called once per frame
    void Update()
    {
    if (targetSurface != null)
    {
    // Build the search parameters
    searchParameters.startPosition = searchResult.candidateLocation;
    searchParameters.targetPosition = gameObject.transform.position;
    searchParameters.error = error;
    searchParameters.maxIterations = numIterations;

    // Do the search
    if (targetSurface.FindWaterSurfaceHeight(searchParameters, out searchResult))
    {
    gameObject.transform.position = new Vector3(gameObject.transform.position.x, searchResult.height, gameObject.transform.position.z);
    }
    }
    }
    }

     
    ftejada, Rowlan, hkalterkait and 3 others like this.
  49. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    260
    Hello!

    I'm experimenting the Water System with 2022.2.0 alpha 13.
    Everything works fine except for reflections. The cloud layer is correctly reflected but 3D objects above the water surface aren't. Is there a way to get 3D objects reflected or is this the intended behaviour?

    upload_2022-5-21_0-23-0.png

    Thanks,
    F.
     

    Attached Files:

    Lahcene likes this.
  50. LumaPxxx

    LumaPxxx

    Joined:
    Oct 3, 2010
    Posts:
    316
    You have to:
    1.Enable Screenspace Reflection in HDRP quality settings and add it in your Volume Settings.
    2.Enable Transparent Reflection for Screenspace Reflection both in HDRP quality settings and Volume Settings.
     
    Lahcene likes this.