Search Unity

Graphics Hydroform Ocean Renderer [RELEASED]

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

  1. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,524
    Will this work on IOS METAL? ( Apple tv 4)
     
  2. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Unknown. It is not performant on most mobile devices so I wouldn't recommend it; don't know the specs on Metal though.
     
  3. Tazling

    Tazling

    Joined:
    Jan 26, 2017
    Posts:
    25
    Have just bought Hydroform and am trying it out. The wave texture of the Ocean seems to be continuous throughout, even when there is a chunk of land in the way which should interrupt the wave trains. So for example, waves inside the very narrow enclosed inlet on my island terrain are just as big as waves outside, and waves on the lee side of the island are just as big as waves on the windward side. Can this be fixed? Is there a way to get the waves to respect the collider boundaries of the terrain?
     
    Last edited: Mar 19, 2017
  4. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Waves will dampen in shallow areas of the terrain. If they are still big, extend the terrain out from the shore at a shallow angle like in the tropics demo. In the current release, the waves will start to dampen at a depth of 10 meters, in the next release you will have control over what depth they start to dampen at. Also make sure ShoreFX are enabled.
     
  5. Tazling

    Tazling

    Joined:
    Jan 26, 2017
    Posts:
    25
    Oh dear... In real life, ocean waves do not dampen when they hit shoal depths, they get taller.

    If I am understanding your wave gen rules right, it's not possible to make a convincing shore break (as for example Pipeline) -- the wave trains won't "stand up" as they hit the slope of the shore. It sounds like it's also impossible to make a deep, beautiful diving pool sheltered behind a peninsula: the depth would make the waves big, even though there is a solid mesh (with collider and rigidbody) in between the wave trains and the pool area. May I cautiously suggest a workaround that might not be that far from the direction you're already going? If you could allow the user to set a range of depths that maps to a range of wave height, like

    Depth range: 50 to 60 Unity units
    MAPS TO:
    Wave height: 10 to 15 percent of original setting

    Then I could build a lagoon with a floor of a very specific depth, any depth I want it to be for aesthetic purposes, that will reduce wave heights over that specific area. I think it's not all that different from what you are planning to provide, just a little more flexible? I realise the physics of wave trains hitting obstacles is not trivial, probably way too expensive to model in real time, and so we have to cheat :) but I'd like to be able to cheat in ways that look like real physics. Or enough like real physics not to break the illusion...
     
  6. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Lol, no it would not be possible to simulate breaking waves and still have good performance.

    I don't think having a table of depths->wave heights would be very practical. In your example of a diving pool, the pool would be calm, but then when it goes to open ocean, there will be weird looking areas that are not located in the pool that will have dampened waves.

    If you want to build that for your specific game, it wouldn't be to hard to hack something together; the shader is well commented and you have all the source.
     
  7. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    This is the only known video I found where you can see the shoreline kind of breaking....
     
  8. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,524
    this shore line is also not bad for the hardware it runs on
     
  9. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Neither one of those videos have breaking waves. The MGS one (wow, disturbing) is almost certainly custom done by artists, and the other one just has some foam animation on the shore.
     
  10. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,524
    I'm trying out the water, and I have some issues when I use Ambient Occlusion from the unity post processing stack
    Post Processing Stack - Asset Store - Unity

    It creates a black square in the center of the screen.
    I suspect from GridMeshObj

    Any idea how I can fix that?
     
  11. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Yes, I think I know what that is, I fixed it in Water.shader, but forgot to in Brim.shader. Try removing the Fallback line at the bottom of Brim.shader.
     
  12. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,524
    I did that but the black square is still showing up,
    I also put "Fallback off" to try if that worked but the same square is still there
     
  13. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    OK, make sure it's turned off in Water.shader as well.
     
  14. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,524
    It's off in all the shaders now and still shows the black square, maybe its a problem in the unity ambient occlusion.
     
  15. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    The black square is happening because a draw pass is occuring on Hydroform, but it's not using Hydroform geometry shaders. So the ambient occlusion is probably doing a pass on Hydroform using a replacement shader. To fix, find a way to exclude Hydroform from that pass (using a mask/layer). I'll have to take a look at the AO and see if there's an easy way to do that. It'll be a while before I can get to it though, so if you're inclined, you might want to poke around their code.
     
  16. KevinCain

    KevinCain

    Joined:
    Nov 8, 2016
    Posts:
    85
    In an open-ocean environment, is there any Hydroform-'native' way to handle splashes or wakes of the kind we'd expect from a landing bird?

    It occurs to me that there may be some way to simulate a wake by tracking hidden geometry under the approaching bird with 'Shore FX', but there may be a more elegant solution. For splashes, it would be possible to use Unity particles with mapped shaders, but I would be afraid that 'sprite' look wouldn't match the Hydroform water surface in a convincing way.
     
  17. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Just use particles, that's what AAA studios do. It's not worth doing fancy surface shaders for (I'm assuming) such a minor part of your game. How realistic they look just depends on the particle texture. I like to mix 2 or more particle types, one usually large / low density and another smaller/high density for a better look.
     
  18. KevinCain

    KevinCain

    Joined:
    Nov 8, 2016
    Posts:
    85
    Thanks for that, any reaction or improvements to my idea of using geometry to simulate a wake?
     
  19. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    The ocean geometry is waaaaay too low density to simulate a wake from a bird.
     
  20. KevinCain

    KevinCain

    Joined:
    Nov 8, 2016
    Posts:
    85
    Yes, of course. I was suggesting using other geometry to define the wake zone to apply your shoreline effects, without tesselating the ocean geometry.
     
  21. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    I figured out a way to make Hydroform even more optimized. Would it be possible to include an option where it only renders every certain number of frames rather than updating 60fps or whatever the default is?

    An example is if my Ocean is only background scenery where it's not the focus, I would for example like to update at 20 frames per second or 30 while the rest of my game is running at 60 fps or more. This would drastically improve performance and since the ocean wave animations are usually very slow it won't be noticeable anyway.
     
  22. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Not much bang for buck in terms of time spent on that one.
     
  23. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    It already limits what data is sent to the shaders, but in terms of calculating wave data, it has to do this every frame because there is no continuity of wave data between frames. Ie it has to construct the waves every frame in order to render them. The good news is that it doesn't need to send hundreds of thousands or even millions of verts across the bus from the CPU to the GPU constantly.
     
  24. Needleski

    Needleski

    Joined:
    Mar 16, 2013
    Posts:
    3
    Hi!

    First of all, awesome asset! I'm developing a prototype for SteamVR, it looks beautiful and doesn't hog resources. If anyone is using the "[Camera Rig]" SteamVR prefab, you just need to add the HydroMultiCamComp component to the "Camera (eye)" gameobject, set the ocean prefab and all is good.

    I do however have a problem with another asset I'm using in the same scene as Hydroform - "Tenkoku DynamicSky". If Tenkoku DynamicSky is enabled the Hydroform ocean simply disappears from game view (with and without SteamVR). I'm just wondering if anyone else has had the same problem and has some kind work around?
     
  25. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Note - you can change most the optimization settings (wave complexity,
    That is very strange, is the ocean completely gone in all directions, or only drawing partially? Have you tried in both deferred and forward rendering? Is the ocean prefab disabled in game mode?
     
  26. Needleski

    Needleski

    Joined:
    Mar 16, 2013
    Posts:
    3
    Its completely gone in all directions and forward/deferred makes no difference. The ocean prefab is not disabled. Heres a couple of before and after screenshots....

    Brand new project, drag drop ocean prefab, hit play:


    http://imgur.com/0pRl2up

    Next, drag and drop Tenkoku dynamic sky prefab and hit play:


    http://imgur.com/Il9EccB

    As you can see from the screenshots, Tenkoku adds a bunch of scripts to the main camera (and also has a lot of custom shaders). Disabling any of those scripts results in errors, they all need to be removed from the main camera and the Tenkoku gameobject deleted for the Ocean to come back.
     
  27. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Wow, that is very strange. It's hard for me to speculate as to what the problem is, but it appears that this is something being caused on Tenkoku's side. Have you asked them what could be the problem? Hydroform probably isn't the only asset it interferes with.
     
  28. Needleski

    Needleski

    Joined:
    Mar 16, 2013
    Posts:
    3
    Ok, so I managed to get it working :)

    As you suggested, I went over to the Tenkoku Support Forum and found a few posts describing issues with other assets relating to the Tenkoku Sky Fog component attached to the Main Camera. After playing around with this component I found if I disabled "Fog Horizon" and "Fog Skybox", then the Ocean came back....



    Obviously these 2 options are related to fog, however, I can see from the code their on/off state is simply passed into a *very* complicated shader and I am in no way a shader developer, so its impossible for me to say what's going wrong :). If I find more information Ill post it here!

    Thanks for getting back to me so quickly Xix!
     
  29. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Thanks so much for coming back and posting that, it will be helpful for Hydroform users and it's one less thing I have to track down!

    -Brian
     
  30. Sov3R3igN

    Sov3R3igN

    Joined:
    May 24, 2016
    Posts:
    22
    Any chance for colorization of water?
     
  31. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    The water colors can be changed to whatever you like in the editor, yes
     
  32. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,163
    Hi,
    awesome asset. I understand that target is Ocean .. but I am wondering if there is the capability for a lake.
     
  33. JamesWjRose

    JamesWjRose

    Joined:
    Apr 13, 2017
    Posts:
    687
    Hello,

    Purchased Hydroform a couple of days ago and it seems awesome. I have an odd problem and because I am a newbie (20+ years business software developer, but not a designer or game dev)

    The issue is I can see the Ocean from the Main Camera, but not from the PFS Controller's camera. I can see other objects but not the ocean. I'm sure I'm doing something wrong. Any clues?

    Some images to show you what I mean http://imgur.com/a/Rvpu9

    I also tried to get help elsewhere but so far no luck: https://www.reddit.com/r/Unity3D/comments/6502ud/help_some_game_objects_not_displayed_in_game_when/

    Thanks kindly
    James
     
  34. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    The asset is designed to be infinite, so no it doesn't support small patches that could be used as lakes. It would be possible to have a lake if all of the terrain were above water level - note that this would not impact performance much as the per-pixel calculations would be zbuffered out.
     
  35. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Hi James,

    If you want multiple cameras to work with Hydroform, you need to put the HydroMultiCamComp on each active camera in the scene. Don't forget to drag the ocean prefab onto the component! See the manual under "Using multiple cameras".

    -Brian
     
  36. JamesWjRose

    JamesWjRose

    Joined:
    Apr 13, 2017
    Posts:
    687
    Brian,

    Sorry for not being clearer. I only need the FSP camera. I had tried removing the Main Camera before, and just did it again (to make sure) and still I can only see the boat or other items, but not the ocean. I even created another app with just the ocean and the FPS and still cannot see the ocean.

    Thank you very much for such a quick response (I also posted to your site yesterday, so feel free to ignore that) So, what dumbass thing am I doing wrong?

    James
     
  37. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    The HydroMultiCamComp should still fix the problem.
     
  38. JamesWjRose

    JamesWjRose

    Joined:
    Apr 13, 2017
    Posts:
    687
    Thanks, but again I don't want or need multiple cameras. If this script will fix the issue, where is the script to be applied?
     
  39. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Add the script component to your camera. Make sure you drag the ocean prefab onto the script once it's attached.
     
    JamesWjRose likes this.
  40. JamesWjRose

    JamesWjRose

    Joined:
    Apr 13, 2017
    Posts:
    687
    Ok, that did it. It took some trial and error on which specific object (camera) to attach the script to, but I got it working. Thank you very much for your time. I have submitted a review and updated the Reddit post with details on the issue in case anyone else ever has this issue.

    Thanks again and best of luck to you.
     
  41. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Great! Glad it's working for you, thanks for the review James!

    -Brian
     
    JamesWjRose likes this.
  42. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I just submitted a new update to the store, here's the rundown:

    • Added control over water clarity so you can tweak how far out the underwater fog kicks in
    • Added control over the depth that wave damping begins
    • Added ability to set shallow water color
    • Added a fadeout (user controlled) for SSS as the camera height increases, thus reducing the obvious repeating patterns of SSS at altitude
    • Fixed some issues with Unity 5.5 and 5.6
    • Removed memory allocations that were occurring per-frame

    This image demonstrates increased water clarity and shallow water colorization (before/after):
    Hydro117-0.jpg


    This image shows how the SSS falls off with altitude (before/after):
    Hydro117-1.jpg
     
    Shodan0101 likes this.
  43. Vortavasail

    Vortavasail

    Joined:
    Apr 22, 2016
    Posts:
    44
    something seems to be wrong .... transparency dose not seem to be working for me and when downloading it to an empty project it doses not work at all ...
     
  44. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Do the demo scenes work for you?
     
  45. Vortavasail

    Vortavasail

    Joined:
    Apr 22, 2016
    Posts:
    44
    the exe yes
     
  46. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Heh, you're not giving me much to work with here. So the demo scenes are not working when you import them into an empty project? Do you have any errors or warnings in the console? Could you post a screenshot? Do you have any more information?
     
  47. Vortavasail

    Vortavasail

    Joined:
    Apr 22, 2016
    Posts:
    44
    upload_2017-5-2_19-45-27.png upload_2017-5-2_19-46-40.png
    upload_2017-5-2_19-47-58.png



    Errors

    Assets/HydroForm/Scripts/HydroformComponent.cs(508,35): warning CS0618: `UnityEditor.EditorUtility.SetSelectedWireframeHidden(UnityEngine.Renderer, bool)' is obsolete: `Use EditorUtility.SetSelectedRenderState'

    Releasing render texture that is set as Camera.targetTexture!
    UnityEngine.Object:DestroyImmediate(Object)
    HydroformComponent:CreateTextures() (at Assets/HydroForm/Scripts/HydroformComponent.cs:347)
    HydroformComponent:ResetData() (at Assets/HydroForm/Scripts/HydroformComponent.cs:331)
    HydroformComponent:periodUpdate() (at Assets/HydroForm/Scripts/HydroformComponent.cs:1003)
    HydroformComponent:LateUpdate() (at Assets/HydroForm/Scripts/HydroformComponent.cs:734)
     
  48. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Oh, OK, those are errors with Unity 5.6 that have been fixed with the latest update. Should be out in a day or two, whenever they approve it.
     
  49. Vortavasail

    Vortavasail

    Joined:
    Apr 22, 2016
    Posts:
    44
    o ok sweet it works fine / just the way I wanted in my project just no transparency.... that was just the blank project where it went crazy.
     
  50. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Hey guys,

    So I've read through this entire forum and I'm still not sure if this will work in VR. If I'm using Single Pass Stereo Rendering and disable the "Dynamic Reflections" will this water work? Thanks for your help.

    Cheers,
    Colton