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
    I will put this as a high priority when I get some time to jump in again.
     
  2. twiggyash

    twiggyash

    Joined:
    Nov 7, 2013
    Posts:
    45
    Thank you! :)

    Have a nice day.
     
  3. SergeantBiscuits

    SergeantBiscuits

    Joined:
    Jul 22, 2012
    Posts:
    17
    Hi all! Purchased this asset recently for use in an aircraft-based game, been using it in conjunction with Azure[Sky]... yields incredible results. Can't believe how good the water looks for the amount of resources it uses.

    Sorry if this has been answered already, but is there a way to make the water accept shadows? I don't mind if the surface becomes opaque and shore fade effects are lost... shadows are more important for my game.

    Thank you!

    dat ocean.png
     
  4. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    Is single pass working? Hoping to use this for VR on Oculus Go/Quest/GearVR :D with Forward Single-Pass rendering
     
  5. KarlLakner

    KarlLakner

    Joined:
    Jan 30, 2019
    Posts:
    18
  6. KarlLakner

    KarlLakner

    Joined:
    Jan 30, 2019
    Posts:
    18
    Hey, did you get anywhere with this? Have the same problem, but with a different asset (Lux), and also need shadows for gameplay reasons...
     
  7. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Hey everyone, so sorry to get back so late on this. Because Hydroform doesn't write to the DepthTexture (because it's very difficult to do with a custom shader), it cannot easily accept shadows or projections. One thing that might be possible for shadows is to read the existing shadow buffer that Unity generates. I haven't attempted this, but if you know how to write shaders, it's worth a shot.
     
    RagingJacob likes this.
  8. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    eaque and KarlLakner like this.
  9. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    788
    Just bought Hydroform ocean and getting an issue as in image below.: No discernable compile errors. Any ideas how to fix it? Thanks

    ocean.PNG

    Of course the scene is usually clear. This is in play mode.

    ADDITION: I fixed this. It was post processing causing the issue. In particular motion blur.
     
    Last edited: Nov 12, 2019
  10. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Seems like a photo taken during a monitor fall.
    Can't help you though, just came by to drop a cringe joke :oops:
     
    Xix-Interactive and ROBYER1 like this.
  11. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Thanks for reporting back on the issue and the fix!
     
    Hawk0077 likes this.
  12. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    788
    There was also another issue with RAM Water Rivers as it used the Water Layer too. They need to be on different layers.
     
    eaque likes this.
  13. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    Hi, I'm kinda mad at myself that I just discovered this Asset. I was looking for a water solution that supports SSR, and only this water solution supports it.

    Anyway, I added to my test scene and this is what I get.
    upload_2019-11-26_15-44-45.png

    I'm using the default water setup and using Unity 2019.3b12, and Hydroform 1.38.

    As you can see it in #1, there is a ghost image of the character. #2 is the water level.
    Also, the big displacement of the character and underwater character looks pretty bad.

    Can you please tell me what's going on?
    Thanks.
     
  14. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Hmm, it could be multiple things. First thing is to make sure another asset isn't causing this, so try and disable any assets that affect the camera or have camera filters, etc.

    Another thing you can do, hopefully as a quick fix is go into WaterFunc.cginc and look at getRefractColor() - try changing the distortion value in there and see if the issue goes away.
     
  15. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    I was able to reproduce on many other assets.
    UMA is free and you can see it yourself. This is running "UMA DCS Demo - Simple Setup"
    https://www.assetstore.unity3d.com/en/?stay#!/content/35611

    I'll appreciate for your help. I'm using 2019.3b12

    upload_2019-11-26_16-27-49.png

    And also, the underwater effect doesn't seem to work.
    upload_2019-11-26_16-28-22.png
     
    ROBYER1 likes this.
  16. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    It looks like you may have not set up the camera. Did you add the HydroMultiCamComp component and UnderwaterFilter component to it?
     
  17. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    You are right! I forgot the underwater component. I would have not missed it if it called HydroUnderwaterFilter though. ^^

    I guess the remaining problem is the ghosting image.
    Were you able to reproduce it? You can easily reproduce it using UMA, I believe.

    Thanks.
     
  18. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I haven't had a chance to test it on the UMA (been sick), but it's very odd that UMA would give it problems where other objects do not.
     
  19. Acme3dProd

    Acme3dProd

    Joined:
    Mar 13, 2016
    Posts:
    7
    Hello,

    We are looking to buy an ocean system for our project. Your ocean system seems the best. We would like some more info. We are developing a game that has a day-night cycle and we already have implemented that feature with directional light. Could you please inform us how the custom shader of your ocean reacts to directional light? For example, will we be able to Lerp values from your ocean system through our C# script and darken the ocean at night having the results we want?

    Thank you
     
  20. Acme3dProd

    Acme3dProd

    Joined:
    Mar 13, 2016
    Posts:
    7
    We actually have two more questions for you. Will this work without problems with the default Unity's linear and exponential fog? Is the ocean compatible with Unity 2018.3?
     
  21. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    @Xix-Interactive, I also have the same problem using Opsive Character Controller. Both UMA and Opsive are the most popular character system and I'm using both. I would appreciate if you can help nail down the problem.
    Thanks.
     
  22. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    The day/night lighting works by lerping between day and night water colors that can be set via the editor or script. It also samples the skybox so that the reflection matches the changing sky. You can set the frequency at which it captures the sky.

    Hydroform supports linear, exp and exp2 fogging in linear and gamma modes - at least for the surface, underwater it only works with linear fog. Underwater support is very basic and should be considered beta.

    The ocean is compatible with 2018.3 yes.
     
  23. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I am very limited in my bandwidth right now for this type of support, but I will try and get to it soon. If I cannot for some reason, or you are unsatisfied with it for this or any other reason, please get in contact and I'll get you a refund.

    Have you tried looking at the shader and changing the distortion value like I posted above a while ago?
     
  24. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    Hi, if I turn off the distortion, there is no submerged image either and it looks not right. I think it's important to have perturbed submerged images. I think I can wait a bit and just please let me know when you have a chance to take a look. Thanks.
     
  25. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    Is this Asset being actively developed? Unless the problem above is solved, I don't think I can use this Asset in my game. Besides, underwater rendering seems pretty basic compared to other solutions out there. Could you please share your roadmap with us?
    Thanks
     
  26. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Generally no, it is not being actively developed, at least in terms of adding new features. That may change in 2020 if my contracting slows down and I have more time for side projects like this.

    That being said, I do try and tackle bugs that are reported such as your distortion issue. I'll see if I can reproduce it today. I've got a bit of time, but I'm also packing up to do a long flight tomorrow. I may not have more time to look at it till the weekend.

    As always, if you find you cannot use it or do not like it for any reason, I'm happy to send you a refund for the asset.
     
  27. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    I see. I'll decide whether to refund based on fixing the artifact above. Thanks.
     
  28. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Alright, so I've taken a look and reproduced the issue. Unfortunately I don't see an easy way to fix it. What is happening is that at the pixels that look sort of like "stealth mode", the shader is sampling pixels that are distorted and the source pixels at that location are the object in front of the water (the character). Ideally I could sample the ground that is behind the character, but that would require extra passes, knowledge that there would be a character there, etc. Since I cannot do that, I sample the ground un-distorted rather than sample the character, which would produce a sort of ghost effect.

    This happens with any object that intersects the water, but it's normally not noticeable because the ground isn't typically flat and shallow like in that demo. It also tends to be hidden by the foam and the falloff to less clear water.

    The best I can suggest is to reduce the distortion like I mentioned above (set it to .95 or .99 instead of .90), or turn it off entirely.

    I would think this would be an issue with any water system that features refraction/distortion, and indeed I have seen it occur in many AAA games, though usually the distortion is turned down more than in this instance.

    Again, if this doesn't work for you, shoot an email to support@xixinteractive.com with your invoice number and I'll get a refund started for you.

    -Brian
     
  29. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    And please notice that it's not just about the flat ground. If you look at the character from underwater, it displays the same problem.

    Are you using depth buffer information when you are sampling? For this type of work to work, depth information on the water intersection is a must.

    Any shallow water, swimming, or object that are on the water will have the same problem and I need all of them for my game.

    Unless you are going to abandon, I hope you have a chace to look at it.
    I really like to use your Asset because it support SSR and I haven't found any other asset that supports it. That's why it makes your asset special.

    Thanks.
     
  30. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Yes, the flat ground is not the source of the problem, it just makes it very noticeable.

    Yes, I am using depth buffer sampling, but it doesn't help in this case. If you look at the red dot, what is happening is the shader is firing a ray at that location, and then the distortion is causing it to sample the "background" texture at a different location (refraction). That particular pixel is hitting the character object, so it does a depth test to see if the object is in front of the water (it is). Since it is in front of the water, we don't want to sample that pixel because it would be the character, so what should be sampled? I choose to do an unperturbed sample of the background, which is the ground in this case because it usually looks OK (esp for a high frequency texture like sand) and is better than sampling the character.

    upload_2019-12-20_9-44-52.png

    The only decent solution I can think of would be to do a grab of the "background" without the character in it, so sampling the character would not be a problem. Even so, in that case, the bits of the character that are underwater would not be refracted (which would look much better than what it's doing now). You'd have to arrange the rendering such that the characters are rendered after the water, so maybe you can experiment with that.
     
  31. goldwyn11

    goldwyn11

    Joined:
    Apr 8, 2019
    Posts:
    12
    Howdy, I saw your asset and I had a question about it's functionality before I bought it.

    Does this asset work like a solid plane, or can it go around an island? I'm going to have some underground areas in an island, so I can't have a water plane that cuts through the sea level.
     
  32. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    It works like a solid plane, but you can create geometric "cutouts" for it where it will not render. Note that those cutouts do not currently work properly with VR.
     
  33. goldwyn11

    goldwyn11

    Joined:
    Apr 8, 2019
    Posts:
    12
    Thank you for the response c:
     
  34. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    has anyone tried this on WebGL yet? (I saw the dev's comment about that -- won't work on WebGL 1, might work on 2 -- has anyone tried it?)
     
  35. Ceciaman

    Ceciaman

    Joined:
    Jul 30, 2013
    Posts:
    52
    Hi,
    I try to record a video 360 with 360 panoramic but when i see the result the ocean appear dark, why?
     
  36. oliran

    oliran

    Joined:
    Sep 29, 2015
    Posts:
    49
    For some reason Ocean doesn't detect terrains in my scene. The waves just go through it like there's nothing there, even with ShoreFX turned on (which has no effect whatsoever). I tried creating new terrains from scratch and it seems to sometimes work and sometimes doesn't. Any ideas on how to solve this?
     
  37. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I don't know why. Could you post a screenshot and tell me how you are trying to record the 360 video?
     
  38. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    It detects terrain via the Height Cam (under the ocean prefab in the hierarchy). Make sure that the height cam isn't culling the layer that the terrain may be assigned to (prob not if you haven't touched it). I can't think of too many reasons why this would happen. Do you have extremely large scale terrain? Could you post a screenshot or send me the terrain geometry?
     
  39. OneManEscapePlan

    OneManEscapePlan

    Joined:
    Oct 14, 2015
    Posts:
    222
    Works great in Firefox, doesn't show up at all in Edge (but IIRC Edge uses WebGL 1).
     
  40. OneManEscapePlan

    OneManEscapePlan

    Joined:
    Oct 14, 2015
    Posts:
    222
    HydroformComponent spams hundreds of errors per second if the scene camera is ever put into orthographic mode. Are you planning to implement a fix for this?
     
  41. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    It would take considerable work to support orthographic mode, so probably not no. If this makes it unusable for you, LMK and I'll be happy to refund your purchase.

    -Brian
     
  42. OneManEscapePlan

    OneManEscapePlan

    Joined:
    Oct 14, 2015
    Posts:
    222
    Sorry if I was unclear. I was not asking you to make HydroForm support orthographic mode for builds. The problem right now is that if you are looking at a scene with HydroForm in the Unity Editor and put the Scene view camera into 2D (orthographic) mode while the scene isn't running, HydroForm immediately starts spamming hundreds of errors per second:

    Code (CSharp):
    1. Screen position out of view frustum (screen pos 512.000000, 0.000000, 10000.000000) (Camera rect 0 0 512 512)
    2. Screen position out of view frustum (screen pos 512.000000, 0.000000, 10000.000000) (Camera rect 0 0 512 512)
    3. Screen position out of view frustum (screen pos 512.000000, 0.000000, 10000.000000) (Camera rect 0 0 512 512)
    Any workaround you could implement that would prevent HydroForm from spamming these errors would be great; presumably the solution would be to detect if the Scene camera is in orthographic mode and skip trying to render the water if so.
     
    Last edited: Feb 25, 2020
  43. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Oh yeah, I can definitely take a look at that.
     
  44. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I loaded up the demo scene, switch the camera into orthographic mode and didn't see any spam in the editor or game modes. I tested in Unity 5.6, 2018.3 and 2019.2. Are you sure that Hydroform is the asset that is spamming?
     
  45. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    When I tested 2019.2.15f1, Hydroform (and animated materials) were not working in the editor. Is anyone else seeing this issue with any 2019 version? Thanks!
     
  46. OneManEscapePlan

    OneManEscapePlan

    Joined:
    Oct 14, 2015
    Posts:
    222
    I'm using Unity 2019.3.2f1. HydroformComponent is the class that's throwing the errors when the scene camera is in 2D mode.

    EDIT: Looks like the issue only happens when "Planar Reflection" is enabled. Specific steps to reproduce:

    1. Open TropicalIsland demo scene
    2. Select Ocean object. In the Inspector, under "Reflect FX", enable "Planar Reflection"
    3. Click Play to start the scene
    4. Click Play to stop the scene
    5. In the Scene view window, click the "2D" button to enable the 2D (orthographic) view.
     
    Last edited: Feb 26, 2020
  47. OneManEscapePlan

    OneManEscapePlan

    Joined:
    Oct 14, 2015
    Posts:
    222
    FYI in WaterFunc.cginc there's a function
    getVertexHeight()
    which includes this code on one line:

    Code (CSharp):
    1. choppy = lerp(choppy,1.0,0.2);
    However, the value of
    choppy
    is never actually used anywhere in the function, so presumably you can remove that lerp call (and the
    choppy
    variable) to improve performance slightly.
     
  48. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Ok, great, thanks for the feedback, I'll take a look. Is Hydroform running OK in the editor for you? I think I may be missing a switch in the editor or something because the water is not updating for me in 2019.2 (just in the editor, in play mode it's fine)
     
  49. OneManEscapePlan

    OneManEscapePlan

    Joined:
    Oct 14, 2015
    Posts:
    222
    It's displaying fine in Edit mode, though take note I'm using 2019.3.

    I've found we occasionally get the "Screen position out of view frustum" error from the main camera while the game is running, when the camera is at very specific angles.
     
  50. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Alright here's a quick fix for you. Find this line in UpdateReflection():

    Code (csharp):
    1. if( mReflectCam != null && reflectFX.enablePlanarReflect )
    and change it to:

    Code (csharp):
    1. if( mReflectCam != null && reflectFX.enablePlanarReflect && !cam.orthographic )