Search Unity

Graphics Hydroform Ocean Renderer [RELEASED]

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

  1. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Hey Kevin, thanks for reporting this. Can you give me some information so I can fix? What version of Unity are you using and do you have both the editor and game windows visible at the same time? If you are using Unity 2017 could you try Unity 5 (if you have it) and see if you get the same behavior? If there's anything else you can think of I'd appreciate it.
     
  2. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    OK, so I checked the latest version of Hydroform against 3 different Unity versions (5.4, 2017.1, 2017.2), with clean projects and they all ran fine out-of-the-box. If anyone is having problems like what Kevin described, please contact me here or at support@xixinteractive.com.

    @KevinCain If you would like to put together a package, I'd be happy to take a look at it and see if I can find why you are having issues with the coast and the cameras and fix them.
     
  3. ibbybn

    ibbybn

    Joined:
    Jan 6, 2017
    Posts:
    193
    Unity 2017.1.p3 here
    Since the last update ( i think it was that one ) SSAO doesn't play nice with the ocean in both deferred and forward rendering.
    Trying either the Unity provided SSAO or Amplify Occlusion gives you a black plane going through the middle of the screen. But only when moving the camera/character. Tried disabling everything else in the scene but seems to persist.
    I'm using two passes to get the shader to render both sides since the game plays under water.
    When turning 90° either way from the view in the picture the artifact is gone.

    I also noticed a tiny bug when starting a scene in editor mode and having timeline open somewhere the ocean doesn't render.
    As soon as you click on another tab ( f.e. console ) the ocean shows up. Doesn't happen in a real build though so not much of a problem.
     

    Attached Files:

  4. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Hi Markus, thanks for the info and screenshot. I think I know what that might be, I'll continue conversation in the email you sent.
     
  5. KevinCain

    KevinCain

    Joined:
    Nov 8, 2016
    Posts:
    85
    Thanks @Xix-Interactive for offering to look at my scenes. The camera fix is easy to apply, so I don't see this as an emergency, especially if other users don't step forward with the same trouble.

    To answer your questions:

    • I'm seeing the disappearing water surface in Unity 5.5.4p4
    • I'm not viewing the editor and game frame simultaneously

    For the coast images I posted, I was observing not reporting. ;-)

    That is, it seems from the demo material that 'Shore FX' are really only meant for scenes where the camera is close to the water, not the relatively distant cameras I showed. In that case, the visible bounding square for the Hydroform shore would be normal and intended, the effect of the shore motion is negligible once the camera moves beyond the shore square (at least with the settings I've seen), so there's no point in using Shore FX for distant scenes -- again, at least in the way I'm interpreting the settings.

    If there are any examples of distant shores using Hydroform, I'd love to see those examples in order to understand what I might try.

    If distant shores are not a focus for Hydroform, then that's good to know too, so I can consider other approaches. Thanks again.
     
  6. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Hey @KevinCain,

    I would definitely like to have it work on distant shorelines. If you look at the demo, the ShoreFX do hold up at far distances, depending on what you consider to be a far distance anyway. As it is, it should hold up for up to a kilometer away if your world scale is 1 meter per unit. I believe you could extend that to 2km if you simply change the HeightFieldSize to 4096, which I think most all video cards can handle these days. Oh and you'll probably also have to modify getDepth() in Water.shader (replace 2048 with 4096). If you need to go beyond that, then I'd look at reducing the resolution of the height texture from 1 pixel per meter to 1 pixel to two meters. Assuming your world scale is 1 unit per meter. If it's less than that, I would highly recommend increasing it. Even at 1 unit per meter, you will start to run into floating point errors if you are moving your camera and have geometry over large distances.
     
  7. PiotrW

    PiotrW

    Joined:
    Nov 2, 2014
    Posts:
    20
    Is it possible to make this asset scaleable? I'm using in my game much smaller scale and much less camera draw distance than normally to avoid problem with large scale terrains rendering. In my game everything is much smaller. 1 unit in Unity is 100m or even more in our approach. I think every asset should be prepared and have such settings like scalling. I bought this asset but it is hard to use it. I tried to scale it down so much with parameters about texture size and others but it is not working as expected.
     
  8. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    It is very possible to scale it down. I just tried it and amazingly 100x does actually work, at least on my GPU. It's right at the limit for 32 bit floating point, so just be aware of that.

    So here are my scaled down settings:
    Wave construction:
    Tex Size: 2048 (1024 is fine too)
    Vert Density: 10-20 (I'd lean towards 10)
    Patch Size: 150

    Wave Settings:
    Amplitude: 0.021
    Frequency: 70
    Speed: 0.004
    Vert Complexity: 2
    Pix Complexity: 2

    That will get you the basic wave geometry, I'll leave it up to you to scale down the ShoreFX.
     
  9. Deleted User

    Deleted User

    Guest

    Hi,

    Is it possible to set different sea/wave state and colors for different areas/location?

    Thanks
     
  10. Deleted User

    Deleted User

    Guest

    Hi,

    Is it possible to set different sea/wave state and colors for different areas/location?

    Thanks
     
  11. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I'm afraid not at this time, no.
     
  12. illogikaStudios

    illogikaStudios

    Joined:
    Nov 19, 2008
    Posts:
    66
    Hi there, we were wondering if your plug-in was compatible on PS4 and Xbox one?
     
  13. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I believe you'll have to do some modification to the shaders to get it to compile, but nothing major if you are familiar with shader programming. I have NOT tried it myself so I don't know for sure.
     
  14. C_p_H

    C_p_H

    Joined:
    Nov 24, 2014
    Posts:
    153
    Hi @Xix-Interactive

    Can multiple instances of HydroformOS run in the same Unity scene?
     
  15. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    No, it's designed to draw one infinite ocean.
     
  16. C_p_H

    C_p_H

    Joined:
    Nov 24, 2014
    Posts:
    153
    T/U, appreciate your time.
     
  17. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Actually I can confirm that everything works fine on Xbox One (no need to change anything with the shaders). :)
     
  18. PatricMondouBorealys

    PatricMondouBorealys

    Joined:
    Dec 15, 2017
    Posts:
    4
    Hello!
    Your tech is good looking, gj ;)

    I have a weird issue that I want to share - I apologize in advance if it was already posted here although I searched rapidly and didn't find it.




    For some reason, after running around in the scene for a few seconds, it looks like the waves rendered can't keep up with the camera movement (we move rather rapidly - maybe 15 units per second). We get something that "looks" like camera near clip, but it's not. (Our camera clip is 0.01 and we can render objects closer to the cam then this). One other detail: the rendered waves clipping is "choppy" when moving forward - it's not a smooth clipping like a camera clipping.

    I suspect that the wave "chunks" to be rendered are updated with a small delay.

    Is there I way I can put a buffer around the camera frustrum for updating wave chunks? Otherwise can you recommend other work-arounds or hacks that might fix this?

    Thanks !
     
  19. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Hey Patric,

    Your game looks trippy in a cool way!

    If you are experiencing delays due to fast camera movement, you will want to attach the HydroMultiCamComp script to your camera. Make sure to drag the ocean prefab onto the script component after you attach it to the camera. That will make sure that the ocean and reflections are updated the same frame as the camera.

    The problem in your .gif is that somehow the brim mesh is being rendered when the camera is low to the water. To fix that, you can adjust the threshold which the brim mesh is renderered. Look in the DrawMeshes() function. If you look at the line:

    Code (csharp):
    1.  
    2. if( mBrimMesh && camPos.y > GetMaxWaveHeight() )
    3.  
    You could change it to:

    Code (csharp):
    1.  
    2. if( mBrimMesh && camPos.y > GetMaxWaveHeight() + 0.5f )
    3.  
    Increase the 0.5 value until it goes away.
     
  20. PatricMondouBorealys

    PatricMondouBorealys

    Joined:
    Dec 15, 2017
    Posts:
    4
    Hello, thanks for answering so promptly!

    I tried your solution, but it only removes the "lower layer" of the water - the brim as you call it? So it's not quite what I was hoping to fix. The fact remains: it looks like the waves are not rendering up until they reach the camera near clip.

    In the screenshot below, I put basic unity spheres above the water level, but closer to the camera than the edge of the rendered waves, to show what I mean. All 3 spheres are higher than the water level and none of them clip in the camera.



    Essentially, the waves that you see here would normally pass below the camera, so I shouldn't see whatever's below them.

    Any clue?

    Thanks
     
  21. PatricMondouBorealys

    PatricMondouBorealys

    Joined:
    Dec 15, 2017
    Posts:
    4
    Hey, just an update on this glitch I'm having:
    I hacked the FrustVerts in CalcGridParams() to extent to 50 instead of 10, I believe it gives a much larger buffer to the frustrum. Not sure it's a valid fix, but it works fow now.
     
  22. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    That could be a valid fix, but I'm not entirely sure why. I tried to reproduce the problem by increasing the camera FOV, and some other things, but couldn't get the clipping to behave that way.

    Does it do that in all camera directions, or only certain angles?

    What are your Wave Construction and Wave Settings values?
     
  23. PatricMondouBorealys

    PatricMondouBorealys

    Joined:
    Dec 15, 2017
    Posts:
    4
    I wrote you a message in pm!
     
  24. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I just saw this, thanks so much for confirming Seith!
     
    Seith likes this.
  25. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    General update:

    Patric's problem has been reproduced and is related to setting the height of the water to something other than zero. I'm working on a fix and am now wondering if that case has caused other problems so I'm going to investigate further.

    I have a fix for the "black square" appearing with some post process shaders such as SSAO. Lastly, I just finished up an improvement to the specular highlight from the sun.

    These will all go in a new update early next year. I'm going to continue to work on underwater rendering in January and am hoping to have a nice clean solution for that as soon as possible!

    Happy Holidays!
     
  26. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    The latest fixes are up in a new update. The asset is on sale in January, 30% off ($35).

    Here's a before/after image of my specular improvements:

    upload_2018-1-9_14-33-42.png
     
  27. Goobles

    Goobles

    Joined:
    Jan 10, 2018
    Posts:
    17
    I recently purchased this asset - loving it so far! Is there a way to enable shore FX while preventing it from detecting objects such as boats etc.? In my project the water occasionally creates a dent under the boat mesh. Thanks! (Sorry if this has already been answered)
     
  28. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Yes, what you want to do is set up your terrain on a layer and then set up culling mask on the Height Cam (located under the ocean prefab) to cull everything but the terrain layer. The Height Cam determines what the water interacts with in terms of foam, wave damping and translucency in shallow water.
     
    Goobles likes this.
  29. Goobles

    Goobles

    Joined:
    Jan 10, 2018
    Posts:
    17
    Thanks, that's a lot easier than I thought it would be.
     
    Xix-Interactive likes this.
  30. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    562
    Does this work in 2017.3 single pass rendering in VR or any demos to try in VR?
     
    Harinezumi likes this.
  31. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I don't know and no demos yet. I finally picked up a Rift, but I'm focused on underwater rendering right now so I haven't investigated VR.
     
  32. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    130
    Does that mean Hydroform doesn't currently have any underwater effects? I've been meaning to ask as I don't see it listed as a feature anywhere.

    Thanks!
     
  33. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Correct, it does not currently have underwater effects.
     
  34. Aubrey-Falconer

    Aubrey-Falconer

    Joined:
    Feb 13, 2008
    Posts:
    438
    I'm using Hydroform in a procedurally generated world, including day/night simulation. This scene already contains a realtime reflection probe I update via scripting. Other water systems I have played with (Aquas, UWS) pick up the scene's reflection probe automatically. I'm fine with assigning the scene's reflection probe texture to Hydroform's "Skybox" reflection cubemap via scripting, but I've been through all the scripting docs for Cubemaps & Textures and can't find a way to do this other than manually calling SetPixels for each side of a synthetically initialized cubemap object.

    I'm about to throw together a Camera.RenderToCubemap system specifically for Hydroform, but wanted to make sure I am not missing something obvious. Has anyone already solved this problem?

    Edit: Looks like the RenderToCubemap approach is inherently slower, and not capable of producing the same quality of reflection cubemaps as Reflection Probes are: https://forum.unity.com/threads/qua...with-that-of-default-reflection-probe.436271/
     
    Last edited: Feb 13, 2018
  35. Aubrey-Falconer

    Aubrey-Falconer

    Joined:
    Feb 13, 2008
    Posts:
    438
    Poll: What is everyone currently doing for underwater effects? I'm about to install Aquas and Hydroform in the same scene with Aquas disabled when the camera is above the water line, but open to other suggestions :)
     
  36. Goobles

    Goobles

    Joined:
    Jan 10, 2018
    Posts:
    17
    I haven't implemented any underwater stuff yet, but my plan is to invert the normals on the Hydroform water, bump the clarity setting way up, and add in some fog/blur once the camera dips below the water line.
     
  37. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Yeah sorry it doesn't currently support reading reflection probes, it is on my to-do list. I would recommend the RenderToCubemap approach for the moment, it should be relatively easy to implement, and you shouldn't need to do it every frame, maybe once a minute if your sun moves really fast.
     
  38. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I've been working hard on underwater rendering and I've finally got a fast solution with pixel-perfect coverage between the ocean surface and the underwater filter. I still need to add proper backside rendering of the surface, fix a clipping issue and do a couple simple screenspace shader effects. I'll have a beta up in a week or two, it's getting really close.
     
    Harinezumi, ibbybn and Goobles like this.
  39. Goobles

    Goobles

    Joined:
    Jan 10, 2018
    Posts:
    17
    That's great to hear, I was sort of dreading hacking together a somewhat decent looking system.
     
  40. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    It's not fun believe me, I've probably tried 20 different methods before I got the one I'm happy with. It's easy if the ocean is flat, or if you don't care if there's a glitch when the camera moves below the water line, but boy it is not otherwise. Looking forward to getting it in your hands.
     
    Goobles and Aubrey-Falconer like this.
  41. Aubrey-Falconer

    Aubrey-Falconer

    Joined:
    Feb 13, 2008
    Posts:
    438
    Thanks Xix! Looking forward to your next release!

    I just used Hydroform to flood a real-world city, and the depth-aware waves add a nice touch:

    Terra 2018-01-03 23.37.59.jpg
     
    Last edited: Feb 14, 2018
  42. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Looking great Aubrey, thanks for sharing! Fun to see Seattle flooded, especially being from Portland ;)
     
    Aubrey-Falconer likes this.
  43. Jason210

    Jason210

    Joined:
    Oct 14, 2012
    Posts:
    131
    This is the best looking ocean I've seen in the asset store. How difficult would it be to add edge foam and wakes to floating objects? Can anyone recommend any sky / cloud / celestial systems that work nicely with this?
     
    Shodan0101 likes this.
  44. Aubrey-Falconer

    Aubrey-Falconer

    Joined:
    Feb 13, 2008
    Posts:
    438
    Update on the Reflection Cubemap discussion. I have found the solution to create high-quality live-updated cubemaps from realtime reflection probes. Many thanks to Remy on Unity Answers!

    Code (CSharp):
    1.  
    2.         Cubemap tmp = new Cubemap(EnvironmentalReflectionProbe.resolution, TextureFormat.RGBAHalf, true);
    3.  
    4.         for (int i = 0; i < tmp.mipmapCount; ++i)
    5.         {
    6.             for (int f = 0; f < 6; ++f)
    7.             {
    8.                 Graphics.CopyTexture(EnvironmentalReflectionProbe.texture, f, i, tmp, f, i);
    9.             }
    10.         }
    11.     }
    This near-perfect horizon blending is achieved with a live reflection cubemap. No fog needed!

    Unity 2017.3.0f3 (64bit) - Xylia.jpg

    Note that you'll also need to disable swizzling in waterfunc.cginc's reflectCubemap routine for proper world reflection alignment.
     
    Last edited: Feb 28, 2018
    Harinezumi likes this.
  45. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    I bought this without doing my research I guess. I just saw in the reviews that the shader does not respond to time of day changes. Is this something you are going to add? It is not useful to me without that. :(

    I never thought to ask because I simply figured anyone making ocean water would include that.
     
  46. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I have an idea on how to add wakes, but it's not trivial, I've got a bunch of other things I want to finish first.
     
  47. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Awesome, thank you, can't wait to get on that!
     
    Aubrey-Falconer likes this.
  48. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Yes, after I get underwater 1.0 working (hopefully in the next few days), I will get some simple day/night working.
     
    Aubrey-Falconer likes this.
  49. Aubrey-Falconer

    Aubrey-Falconer

    Joined:
    Feb 13, 2008
    Posts:
    438
    Xix-Interactive likes this.
  50. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442