Search Unity

Graphics Hydroform Ocean Renderer [RELEASED]

Discussion in 'Tools In Progress' started by Xix-Interactive, Feb 11, 2016.

  1. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    244
    ISSUE ONE: refraction on iOS
    I'm getting good performance for my scene on iPhone X, but refraction has two problems:
    - water appears to have much higher clarity (almost transparent)
    - static appears over the ocean surface - rectangular artifacts, look like rendering tiles of uniform width and varying height?

    - build crashes with network overrun, so I don't have a screenshot yet

    ISSUE TWO: edge fade!!!
    - I can get something like edge fade with refraction, but specular is not faded, so I get hard lines at the shoreline
    - can we get a simple fadeout at the edge for specular as well?

    GREAT shader. I'm doing an infinite procedural river world and it's running great on iPhone X.
    If I can't get refraction running, a simple transparency instead would be preferred - want to see undersea terrain fading into the depths...
     
  2. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    135
    EDIT UPDATE: Ok I have at least figured out how to more or less replicate the problem. It appears to involve meshes that overlap or at least at different height levels. So here are two shots of 3 little islands. You can see the problem here. This is caused because I have a forth island way below these islands, that one is somehow interfering. Turning off the below island "fixes" the issue. However I still think you will get issues with any overlapping geometry even close to the same level.

    upload_2018-7-26_7-56-43.png

    Showing island below:

    upload_2018-7-26_7-57-27.png

    Another shot of a rock above a sunk island. This will keep the shore line from showing around the rock. remove the sunk island the shore line shows up. So even if the rock was "sitting" on the ground below ie not floating, sticking out of the water it would still not show if the "ground" was to deep (and even then its not the rock but the underwater island that causes the shore interaction which is wrong).

    upload_2018-7-26_8-5-7.png


    Having some difficulties with the shore. Basically it seems to be randomly changing the level off point around my island no more matter what I do. See attached. The shore foam shows up or does not and appears to have nothing to do with the depth of the island. I have marked the island pieces on their own layer and have set the height camera to cull on that layer. this is on the same mesh piece and roughly the same depth.

    Also as I am moving around a bit with the camera (maybe does not matter) the piece I am looking at will pop from normal ocean to shore (with the correct FX) and back again at random. Takes a little time between each.

    Also what causes the shore fx to trigger? For instance a rock or cube placed in the water set to the same layer as the island does not. Makes little sense since a mesh is a mesh. So not sure how it picks. Does the mesh have to spread out a little bit under water and then slope up out of the water in order to work. ie a straight cliff going directly down into the water wont show shore line unless it has a lip under the water?


    upload_2018-7-25_14-34-0.png

    Another shot of the issue.

    upload_2018-7-25_14-49-14.png
     
    Last edited: Jul 26, 2018
  3. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    135
    One other related question on edges like around rocks, boats etc. I read your other post but not sure why a depth test could not accomplish it similar to how the stylized water shader does it or from this article https://lindseyreidblog.wordpress.com/2017/12/15/simple-water-shader-in-unity/

    I am guessing there is a good reason but I am not sure since this seems to be the way this is handled in most systems. I was going to start playing with it myself but did not want to go down that rabbit hole if there is some reason you have already discarded that approach.

    Here is the same shot from my previous post that had the intersection problem with the rock and islands using the staggart shader that uses depth intersection to determine the rim working correctly.

    upload_2018-7-26_8-15-43.png
     
    Last edited: Jul 26, 2018
  4. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    It's not ideal, but you could create geometry to blot out the ocean everywhere but the bathtub. That is currently the only way.
     
  5. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Hey guys, sorry I haven't responded in a while, I've been traveling and forgot to check this thread!
     
  6. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I haven't seen that issue yet, is that happening with the demos? Have you tried an earlier version of Unity?
     
  7. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    It's not really intended to run on mobile, but that's cool that it's working for you. I'm not sure what's going on, post a screenshot when you can, hopefully I can figure something out.
     
  8. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Hey, so sorry for the super late reply. The shorefx are pretty simple, the height cam renders a depth map and then the foam will show up at the shallower "heights" in the cam. So if you have the culling mask set up in the height cam, you should be able to put various objects in that layer and they should affect wave height and foam.

    It sounds and looks like there is either a bug or some kind of asset interference going on with your setup. Could you set up a new scene with nothing but that island and Hydroform in it and see if that works properly?


    You asked a good question about why it's not done with a screenspace depth check. The answer is that if you do that then the foam ends up being view-dependent, so the amount of foam will change depending on where you are looking. You also won't see foam around-the-corner - look at the screen below, foam should be visible within the red circles, but it's not because depth difference from the cliff to the water is too great from that camera angle. If you move the camera around that island you'd see foam on that side. The depth-test method is quick and easy, but it doesn't work well if you want anything but a thin layer of foam close to shore.



    upload_2018-7-30_0-53-12.png
     
    Harinezumi likes this.
  9. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    135
    Thanks for the reply. So I did a clean install and loaded up the island scene. Everything looks great. Simply then add a regular old cube scale to 20, 20, 20 and place it directly under a part of the island where the shore is and you will see the issue. this is a shot with the cube well under the island 230, -36, 126.

    upload_2018-7-30_15-29-17.png

     
  10. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    135
    Oh and thanks for the explanation on the depth check. Went back and looked at my other implementations and now notice what you are saying. However would say it works well enough in most situations so would something like that be possible to add in as an option/addition. Its better to have something show up around all objects vs nothing showing up on edges or only in certain situations. However perhaps the issue with your current method has some bug in it. I do know you mentioned things like boats or floating objects would not be supported so in those cases the depth test would be useful as a fall back.
     
  11. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    OK, I am able to reproduce, thanks for checking that out, definitely a bug!

    Yeah, excellent point on having the depth-check foam for non-statics object like boats!
     
  12. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    135
    :) Glad to be of help. Thanks for looking at it and yeah I think people would really like that additional coverage for the depth-check.
     
    Harinezumi likes this.
  13. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hi, just bought the asset and testing its performance.
    I found the water very bright at night time (using Enviro as skybox) in linear color space, any settings to make it behave normally?
     
  14. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Unfortunately Hydroform doesn't currently have built-in day-night lighting, but there are a few things you can do right now. One is to calculate the light color yourself via dot product and the sunlight direction and then apply it directly to the water color via script. The other option is more complicated, but it gets you full realtime sky reflections:

    Basil3 figured it out and posted their method, look halfway down the page:
    https://forum.unity.com/threads/hydroform-ocean-renderer-released.385545/page-13

    I will integrate this at some point, but it's not in right now.
     
    Harinezumi likes this.
  15. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    So I'm a big dumbass - I forgot to add a depth buffer to the height texture! That was the cause of the weirdness holdingjason was seeing above. If you want a quick fix before the next update:

    in HydroformComponent.cs, change:
    Code (CSharp):
    1. mHeightTex = new RenderTexture( HeightFieldSize, HeightFieldSize, 0, RenderTextureFormat.RFloat );
    2.  
    to:
    Code (CSharp):
    1.  mHeightTex = new RenderTexture( HeightFieldSize, HeightFieldSize, 16, RenderTextureFormat.RFloat );
    2.  
     
    Harinezumi and franky_li like this.
  16. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    135
    Thanks that seems to have fixed it in the demo scene. Will check it out for some of the more complex stuff I listed above but probably good to go.


     
  17. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    244
    How often does the height cam render? I've got an infinite world that keeps adding terrain ahead of the boat. I ask for two reasons:
    - The area where I'm interested in foam is quite a bit smaller than total terrain size
    - I keep adding terrain, so it has to recapture at some point

    If it was every frame, that would be great because they we could possibly use the foam render for wakes by dragging stuff behind the boat just under the water. But if it's not every frame, I don't think I'm providing enough data to the shader for an optimal solution given the dynamism of my world.

    Thoughts?
     
  18. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    163
    I used a simple solution to get day/night working with UniStorm. I take the intensity of the sun light and used it to adjust the (HSV) value of the ocean color, this works quiet nice:
    oceanDawn.png
     
  19. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    It's about every 10 seconds. Easily changed though, check out UpdateHeightCam in HyfroformComponent.cs. Make sure you change the cullingMask on the height cam before increasing the frequency, you probably don't want it to render your entire scene every frame.
     
    Harinezumi likes this.
  20. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Rad, love it!
     
  21. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Great!I'll check this solution!
     
  22. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hi, I'm trying to sync the color of ocean to my skybox, but didn;t know which color to change.
    Can you specify the color you changed for unistorm's skybox and what does the HSV mean?
     
  23. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    And,I've encountered another problem with rendering my character along with the ocena:
    upload_2018-8-12_17-12-44.png
    The underwater part of the character got cut off to an offset, how to fix it?
    I'm using UMA2 characters
     
  24. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    163
    HSV:https://en.wikipedia.org/wiki/HSL_and_HSV

    Code (CSharp):
    1. hydroFormComponent = GameObject.FindObjectOfType<HydroformComponent>();
    2. Color.RGBToHSV(hydroFormComponent.surfaceFX.waterColor, out h, out s, out v);
    3. Color.RGBToHSV(hydroFormComponent.subsurfaceFX.subsurfaceColor, out h1, out s1, out v1);
    4. Color.RGBToHSV(hydroFormComponent.shoreFX.foamColor, out h2, out s2, out v2);
    I don't change the colors, I just make them darker or restore them using the v part of HSV
     
    Harekelas likes this.
  25. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    So many people asking for a day and night cycle. Wouldn't it just be easier to include a script that has some public variables and methods that hook into the colors of hydrofoam and animate them from one color to another (day and night)?

    Users can just call the method for a quick transition in by calling the method and entering a duration in seconds as to how long to fade the colors etc. Just an idea.
     
    eaque, Harinezumi and Xix-Interactive like this.
  26. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Wow that is a severe cutoff, take a look at getRefractColor() in WaterFunc.cs. Try changing the "distortion" variable.
     
  27. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442

    I'm not sure yet, I have to try various things out. I would like at least a basic color transition.

    I've been too slammed on my current contract to work on Hydroform. I'll hopefully have more time at the end of the month.
     
  28. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    k,will try that.
    Is it possible that this is related to my character's shader?
     
  29. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Possible, but unlikely. Easy to check, throw a different shader on the character.
     
  30. magicbananna

    magicbananna

    Joined:
    May 9, 2013
    Posts:
    22
  31. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    I also found it not compatible with Enviro:
    upload_2018-8-16_22-24-44.png
    The moon got the ocean cut off.
    And the back face of water surface looks very strange from underwater:
    upload_2018-8-16_22-26-55.png
    Everything in a distance is just plain color, but the enviro skybox got rendered without effects:
    upload_2018-8-16_22-28-58.png

    Any suggestions?
     
  32. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    @Xix-Interactive can Hydroform be rendered with Ray Tracing? Unity now has ray tracing in the latest versions and I'd also like to use your asset with Octane Render is this possible? thanks.
     
  33. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I have no idea. If it needs special code to support it then no.
     
  34. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    Is mesh generated with your asset? if yes it should work. I hate to ask this but there is a free version of Octane render on the asset store I'll buy your asset right away if you can confirm it works. I'm also using Helios to capture 360 video have you tested any thing like this before? thanks for your help.
     
  35. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    244
    @Xix-Interactive do you have an estimate on when you'll implement lighting for hydroform?
     
  36. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    There is a mesh generated by Hydroform yes, but if Octane renders based on the mesh generated in CPU memory it won't work. If it's post - shader transform on the mesh then maybe it should?? I don't know. I don't have time to check it out. If you want to purchase and it doesn't work, then I'm happy to refund you.
     
  37. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I'm hoping to implement day/night soon if I can get some time after finishing my current contract. Point lighting is very low priority so a long time from now, maybe never? Maybe they will come for free if I upgrade to the new shader pipeline. In any case, I have zero time for a few weeks at least.
     
  38. unfungmz

    unfungmz

    Joined:
    Jul 29, 2017
    Posts:
    162
    I have an issue with Hydroform. The longer my scene goes the lower the quality of the water gets. It starts off looking good, then after about 10 seconds the texture appears to become low res...very blocks...then about 10 seconds after that it gets very blurry. Not sure what's going on
     
  39. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Hmm, that's an odd one, could you post a video? Does this happen in the demo scenes? Have you tried disabling other assets?
     
  40. basil3

    basil3

    Joined:
    Dec 3, 2015
    Posts:
    29
    Hi Xix-Interative,

    Another quick question - I have been playing around with a caustics projector that I have used previously and can't get it to work with the Hydroform Ocean when viewed from 'above water'.

    When my camera is above water it does not render the caustics underwater (or it might be but I can't see them) (I imagine something to do with the mesh blocking this (shader or render order or something along those lines) Any quick pointers on where to play around to try and get this working or is simply not possible currently? (my shader knowledge is very very limited)

    Above water (looking straight down)
    Above.png

    Below Water Surface (projection of Caustics is fine)
    Below.png

    Ste.
     
  41. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Hydroform is actually an opaque mesh, it looks translucent because it does a frame grab and blends that into shallow areas with a shader. To get the caustics to show up you'd have to render that before Hydroform does the frame grab (GrabPass). Essentially, you'd have to have the caustics render before Hydroform renders.

    If the caustics are done via postprocess, you're probably out of luck. If it's a projector, you can try and render it before Hydroform via the SubShader tag "Queue". Hydroform renders in the "AlphaTest" queue. If the caustics is also in that queue, you can make Hydroform render after it by changing it to "AlphaTest+1". You would want to do this in Water.shader and Brim.shader. See this link for more info:

    https://docs.unity3d.com/Manual/SL-SubShaderTags.html
     
  42. basil3

    basil3

    Joined:
    Dec 3, 2015
    Posts:
    29
    Morning!

    Thanks for the pointers - I changed the render queue to +100 in the brim and ocean shader as well as played around with my caustics projectors shader render queue.

    Works a treat :)

    Thanks for the link to shader rendering as well, very useful reading!

    Ste

    Caustics.png
     
    Xix-Interactive likes this.
  43. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Awesome, glad it worked out, looks great!
     
    basil3 likes this.
  44. HardEdge

    HardEdge

    Joined:
    Jan 5, 2018
    Posts:
    1
    Hi, thank you for the awesome asset!
    I know you mentioned you are not working on using it with HDRP for now, but is there a way to show Hydroform in HDRP pipeline at this point?
     
  45. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I honestly don't know. From what little I've read about it, it sounds like it's only for certain platforms, and while it offers a lot more flexibility, getting assets like Hydroform running will require more work from the end user to integrate with their setup. This is disappointing as using it would allow me to add some features that I just can't do (at least with top performance) with the existing pipeline.
     
  46. tianmowuming

    tianmowuming

    Joined:
    Aug 3, 2015
    Posts:
    9
    Hello, can the latest version of "Hydroform Ocean System" support HTC VIVE?And can the underwater effect be used in VR?
     
  47. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I've finally been able to do some VR testing and YES it will work with the Vive, just make sure you set the HydroMultiCamComp component on the Camera(eye) and NOT the Camera(head). I've updated the docs which will go out in the next update in a couple weeks.

    The underwater effect works partially in VR, the screenspace part of it does not work, but you can disable that and some people have been able to figure out their own fog solution.

    I haven't put it up in the official store page yet, but I guarantee the product - if it doesn't suit your needs and/or you're not happy with it, just let me know within 30 days and I'll issue a refund.
     
  48. Aubrey-Falconer

    Aubrey-Falconer

    Joined:
    Feb 13, 2008
    Posts:
    438
    Hi @Xix-Interactive and @Maximilious,

    There was a discussion on page 12 of this thread about the Enviro atmospheric rendering system preventing Hydroform from rendering all the way to the horizon. Although I was using both Hydroform and Enviro at that time, this wasn't happening in my project and I missed the discussion. (Maxim, please @mention me next time).

    This has begun happening in my project over the past month or two, and I can only assume it is related to upgrading to a newer version of Enviro. I just created a new Unity Unity 2018.2.5f1 project and imported the latest asset store versions of Hydroform and Enviro. The issue is readily apparent:

    Unity 2018.2.5f1 Hydroform and Enviro - DX11_ 2018-10-13 21.15.08.jpg

    I'll continue my own investigation, just checking if either of you have already found the solution.

    (update: I just posted to the Enviro thread as well - https://forum.unity.com/threads/rel...nd-weather-system.317986/page-64#post-3782233 )
     
    Last edited: Oct 14, 2018
  49. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442

    I can't think of anything that might have changed with Hydroform or Unity 2018 that would cause this. Hopefully the Enviro guys will have some ideas.
     
    Aubrey-Falconer likes this.
  50. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I uploaded a new version that should go live as soon as approved, usually in a day or so. It's mostly fixes for things reported here or that I've come across, plus some changes to the manual regarding setup for VR.

    Here's the rundown:
    • Fixed input colors to be consistent across Gamma and Linear lighting
    • Fixed issue with height texture - enabled zbuffer on it
      • This was the cause of mysterious shapes appearing in foam
    • Added anisotropic filtering to wave texture
      • This fixes it looking noisy especially on 2018
    • Fixed fov warning on VR devices
      • Finally got some testing in on VR, added better instructions for setup in VR - pretty simple, but if you put the script component on the wrong object, the water won't show up
    • Added possible fix for noise artifacts on horizon for certain hardware
      • This looks promising, hopefully sorts this issue out on hardware that had issues with it
     
    Aubrey-Falconer and SCMcArthur like this.