Search Unity

Graphics Hydroform Ocean Renderer [RELEASED]

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

  1. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,209
    Has anyone got this to work successfully with Fog Volume 3 or TrueSky?

    TrueSky Unity5.6-4.1.440 sort of works, I just get constant black flickering where the ocean is.

    Thanks.
     
    Last edited: Jul 1, 2017
  2. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,209
    Also the Unity Post Process Stack > Motion Blur doesn't refresh when activated. I'm running Unity 5.6.1f1.
     
  3. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,209
    Is there a way to get the water to reflect correctly if I'm setting up a time of day sceen?

    Also if I look straight down at the water that black starts to grow like in the attached until the ocean is completely blacked out, then it resets and renders correctly until I look down again.

    water.jpg
     
  4. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Try switching from SSR reflection to Planar reflection.

    The black issue looks like it's probably an issue with another asset. Try switching off other assets until it disappears so you know which is causing the problem.
     
  5. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,209
    I created a new project and only imported Hydrofoam, created a new scene and dragged in the Ocean prefab,
    I'm running WIndows 10 64 bit, a Nvidia 970 with the latest drivers, and Unity 5.6.1f1. I created a fresh project, and installed only the latest HydroFoam from the asset store.

    Same black problem when I start to look down (screenshot attached).
    ss.jpg

    Also when I Play my scene not select Maximize on Play in the Game tab, the ocean vanishes if I don't have the Main Camera selected in the Hierarchy. So I can't play around with the ocean options when the game is running. Same thing with all your Scenes, I need to have the Camera selected otherwise the ocean vanishes.
     
  6. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Hmm, so this is happening in the demo scene? Could you try an earlier version of Unity, 5.5 or 5.4? I haven't tested with 5.6.1 yet, but 5.6.0 looked fine. I suspect this is a driver problem more than a Unity problem though, unless they broke something in 5.6.1. Do you have your driver settings all to default?
     
  7. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    It looks like from your screenshot that is not the demo scene. Can you confirm the demo scene is running properly?
     
  8. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,209
    Well I had the same issue with using an older driver for my video card, so I tried to install the latest to see if that fixed the issue in which I didn't.

    I installed 2017.1.of1 and I still get the same issue with the black. Your demo scenes on both 5.6.1 and 2017 work fine, so maybe it has to do with something missing within the prefab. Is there another way to setup a fresh scene without using one of your demos and deleting everything I don't need?
     
  9. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    You should be able to open a new scene, drop in the prefab and you're good to go.

    I was able to reproduce some of your artifacts by having both the scene and game windows showing at the same time like you do in the screenshot. Try doing one or the other, that's at least part of the issue.
     
  10. miyumiyuna5

    miyumiyuna5

    Joined:
    Jan 27, 2016
    Posts:
    3
    Running with HTC Vive causes a lot of errors.

    Assertion failed on expression: 'entry-> m_Rect.width == width'

    Single pass is on.

    I check it with Unity 5.6.2f.
     
  11. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    That error could be anything. Try disabling Hydroform and see if it persists.
     
  12. Struders

    Struders

    Joined:
    Jul 28, 2012
    Posts:
    14
    Is there a way of masking off an area you dont want water in?
     
  13. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    How do you intend to use it? If you want a lake, you'd have to mask it with terrain. If you want underground tunnels near the ocean, you'd have to set up triggers to disable the ocean when entering the tunnel.
     
  14. Struders

    Struders

    Joined:
    Jul 28, 2012
    Posts:
    14
    I wanted to make a harbour, I tried using the shoreline dampening to achieve it but just not getting the results I was hoping for.
     
  15. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    If you want more dampening, try modifying the "Min Wave Amp" and "Wave Damp Depth" values under "ShoreFX". If the issue is that the waves are showing up past your shoreline, set MinWaveAmp to 0.0.
     
    Last edited: Jul 3, 2017
  16. miyumiyuna5

    miyumiyuna5

    Joined:
    Jan 27, 2016
    Posts:
    3
    If you disable Hydroform Ocean, no error will be issued.
     
  17. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    OK, do you have any more info like what file and line number the assert is occurring on? Have you tried an older version of Unity, like 5.4 or 5.5?
     
  18. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I just tested with Unity 5.6.2, there are definitely some things that were broken with this version. I recommend using 5.4 or 5.5 until I get them resolved.

    *EDIT* Whoops, I thought some things were broken, but they were resolved once the lighting was finished. 5.6.2 appears to be working without problems.
     
    Last edited: Jul 4, 2017
    Shodan0101 likes this.
  19. JDrem1

    JDrem1

    Joined:
    Jun 24, 2017
    Posts:
    199
    @Xix-Interactive.

    Hello.

    Hydroform looks beautiful.

    I have 4 questions please.
    I hope you can help. And I apologise if they have already been asked and answered I did skip through the forum.

    • 1, Underwater. I have seen that this has been asked for a number of times. And that you confirmed a while ago that you would be implementing it. And I just wondered if this was still coming?

    • 2, And please forgive if this is a basic, or even noobish question / suggestion.

    I LOVE the endless ocean mechanic. As well as the waves. "Loving them larger waves." (I downloaded the demo, fantastic. ) Waves are one of the main points that drew me to Hydroform.
    But as Hydroform also has the ability to create calm (none ocean water) I wondered if there is a way to turn off the endless mechanic when needed. So-as to be able to create smaller bodies of water in-land but with different "waves / colour / foam," settings that would be more like lakes etc.

    I am new to unity. But I can imagine that implementing the ability with the "endless ocean" system that allows the user to cut out a part where their landmass is, would be tricky?
    However if this is the case, would it be possible just to have an option where the user could just have a scalable "none endless" mode. (Like the Unity default water, but with all the Hydroform goodness.)

    So lakes, ponds, even rivers could be included in-land, just at a higher ground level.
    And the "endless ocean" (with its oceanic settings) is hidden by the land?
    I realise this would not work for everyone as some would like lakes etc, that are lower than sea level.
    But at least it would give the user the option of still having Hydroform water, with all of its effects, and aesthetics, with other water areas within the map, using different settings?
    (does this make sense?)

    • 3. (another nooby question I'm afraid.)
    In this forums you have responded to a thread with. "Hydroform is not currently integrated with any buoyancy assets"
    However in the reviews section on Unity one reviewers says.. Quote "The handling of buoyancy is also quite rudimentary." I dont think he is moaning, as he has given 5 stars rating. He's just saying tha professional devs might need more control.
    But my question here is, is there a buoyancy option included in the asset?
    Again forgive this being a noobs question, we all have to learn sometime. :)

    • 4, PC VR optimisation. (HTC Vive in my case.) Reflections, single pass stereo water etc. (I think) Again I just wondered if you were looking into this.


    I hope you can help with these questions.

    Thank you.
     
    Last edited: Jul 10, 2017
    Xix-Interactive likes this.
  20. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442

    Hi thanks for your interest in Hydroform! I'll try and answer your questions as best I can

    • Underwater - yes, I've been actively working on underwater for about a week and I hope to have at least some kind of basic underwater rendering out by the end of the month
    • There is not currently a way to turn off the endless mechanic or mask it out. However, people request this all the time, and I may tackle a way to mask out the water after I get something going on underwater.
    • What is in the asset is a height query and a demo of cubes floating on the surface with the height query. There aren't any actual buoyancy physics in place to control how high something floats based on mass/volume, but I imagine it would be easy to port such a thing and just plug in the height query. I think there is an open source script out there for buoyancy?
    • I've gotten mixed feedback on Vive VR working with the asset. I would think that dynamic reflections would not work, but skybox reflections would. Some people say the asset works fine in VR. I don't unfortunately have VR rig to check it out. If it doesn't work for your needs, if you could send me a video of your issues, I can give you a refund. I don't want anyone to feel like they've been stuck with a broken asset.
     
    JDrem1 likes this.
  21. JDrem1

    JDrem1

    Joined:
    Jun 24, 2017
    Posts:
    199

    What a brilliant answer. Thank you.

    I will definitely be purchasing when funds permit. On Wednesday hopefully.

    I am Very pleased that underwater is coming. awesome news.

    And equally that you will be looking into "smaller" versions. Or the ability to crop parts out of the Hydroform ocean.
    However it happens will be great.
    But please still keep the endless option, that is just such a fantastic.

    I am a little saddened to hear that even rudimentary buoyancy is not included. As we all want that raft / row boat / galleon / or aircraft carrier bouncing along.
    But as you say once I am more "au fait" with Hydroform I'm sure ill be bringing other stuff in. I just want to be able to have some form of it on those "waves." ;)

    And as to VR, TBH I'm not really bothered about dynamic reflections. Even though I'm not working with low poly ATM. Because in VR I prefer a more realistic look. (Using Gaia) I also am realistic,- (myself) -in knowing that certain concessions need to be made.
    As long as the waves, and some basic (skybox would be nice) reflections, are possible, Ill be chuffed.

    The ability to 1, have waves, 2, endless ocean, 3 underwater, and 4 have "smaller bodies of water with different effects inland. Is more than I could ask for.

    Thank you so much for the excellent reply.
     
  22. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    You bet, thanks for your interest and support!
     
  23. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Is there a way to fake some sort of simple shaped shadows or boat water wake other than particles (even if takes its cut from performance)? projectors don't have any effect and neither any other similar tricks as I assume these are ignored in the shader.
     
    Last edited: Jul 12, 2017
  24. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I was looking at shadows the other day. For shadows and projectors to work, I would have to add a shadow pass in the shader, which would render the geometry an extra time. For some people that would be a nice option. Unfortunately in Unity, we can't control when the shadow pass occurs, and so the regular pass always occurs after the shadow pass renders to the depth buffer. The consequence of that is that refraction doesn't work because the depth is now zero at the water surface when it renders the regular pass. It also breaks deferred rendering, but I didn't dig into why.

    If you don't care about refraction or the extra render, it's not hard to add your own shadow pass. Duplicate the Pass{} code in Water.shader and tag one of them "ShadowCaster".

    https://docs.unity3d.com/Manual/SL-PassTags.html
     
  25. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Yeah I tried that (added Tags{ "LightMode" = "ShadowCaster" } inside the new pass) plus commented out the ForceNoShadowCasting, enabled receive shadows on the mesh and initially tried some other stuff but projectors or shadows don't seem to appear and it looks like some combinations create just square mesh (goes to fallback?). Maybe some other step missing or some of my settings block it? should the change work with one of the demo scene settings?

    I'm using forward only and missing refractions probably are not that big of an issue with reflections or artistic choices with the water colors.
     
  26. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I just went back and tried it again with everything that you have set up (shadowcaster tag, forcenoshadowcasting off) and it does show shadows, but you need shorefx and refraction turned on to see them. So it should look like this when you drag a tree into deeper water. It's hard to see because the water is clear, but the shadow is actually on the surface.

    upload_2017-7-12_14-51-10.png

    After looking at it further, the reason you need refraction on to see the shadow is that it is drawn before the regular water pass. The water then overwrites the shadow. So shadows won't work in this way, but it still may be possible to read the shadow buffer from the water shader. I haven't looked into this. Projectors should still work if they are reading the depth buffer - they would need to render after the water and probably offset above it on the y axis to avoid being zbuffered out.
     
  27. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Yeah the reason I did not see anything in any of the scenes I tried is because I dragged my ship to the sea where there is nothing below the water mesh (not even a terrain mesh). I did not get projectors to work in a way they would be useful. There is also a problem with the water mesh fading breaking with the brim by using the changes.

    upload_2017-7-13_15-0-14.png

    Not sure if there are any other tricks to have or fake effects on the water surface when the use case is a boat or anything dynamic in middle of an ocean with no land visible? Particles do not really work that well with heavier waves when they clip.

    Shadows are not that important but some sort of foam or flat wake texture around the moving objects would be.
     
  28. pablosergarcia

    pablosergarcia

    Joined:
    Nov 23, 2016
    Posts:
    1
    Hi, great work!!, there are documentation in some place?

    Thanks.
     
  29. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Your best bet would probably be to add a texture projection inside the water surface code (WaterFunc.cginc). If you have some shader programming skills it's not too bad. It should be more efficient than projectors or adding a shadow pass.
     
  30. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Thank you and thanks for your support!

    There's a manual (MANUAL.TXT) in the base Hydroform directory. I'm pretty responsive on this forum if you have a question that's not in the doc.
     
  31. JamesWjRose

    JamesWjRose

    Joined:
    Apr 13, 2017
    Posts:
    687
    EDIT: Nevermind, it was an issue of the camera's Culling. I'm leaving this here in case anyone else has the issue

    --------------------------
    Hello again,

    I am unable to see the ocean in any project. I even loaded the 4 scenes you include. I can see the ocean in the Scene tab when NOT running the scene, but when I run it the Game and Scene tabs do not show the ocean. For example when I run the Boxes scene I can see the boxes bob up and down, so it's working sort of....

    I am currently using Unity 5.6.1f1 and I noticed a few posts above that you mentioned an issue with 5.6 so I wanted to give you some info. I can't roll back to a previous version, sorry, so if there is any other info that I can give, or something else I can do to help you debug this issue you let me know.

    Have a great weekend

    Peace,
    James
     
    Last edited: Jul 14, 2017
  32. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I just purchased this and I'm getting 2 shader compiler errors in a Wii U project.

    upload_2017-7-14_7-55-8.png
     
  33. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Hi James, do you have both game and scene windows visible onscreen at the same time? It will not render correctly in that case.
     
  34. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Right, those 'errors' are present on PC as well, but do not interfere with running the asset. The manual describes how to remove the first one. The second one appears to be a compiler error as there are no uninitialized variables in that function, and even initializing that line to const numbers has no effect. I wouldn't worry about it unless it's preventing a build somehow.
     
  35. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I didn't try a build so I don't know, but the water was not moving so I figured it must be an issue. It just looked like a static mesh. I was in a hurry and had to leave so I didn't look too deep into it. Does the water only move in play mode?
     
  36. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    It should move in the editor if 'animated materials' is checked in the scene window dropdown.
     
  37. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'll check when I get home, but I think it might be having an issue. I had loaded it into another project for PC and it seemed OK there.
     
  38. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Well, this is really strange. Animated Materials wasn't checked and when I turn it on then I can see it working in the scene view. But ironically, it doesn't animate in the game view even when I hit play. That's just weird.

    [EDIT]
    Here is a video:

     
  39. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I decided to just give it a try on the Wii U hardware to see what happens there. In that case I get some shader compiler errors:

    Shader error in 'Hydroform/Octave': Compilation Error for vertex shader
    position : 0
    error code: INVALID_OPERATION
    error string: ERROR: 0:29: error(#132) Syntax error: '_FoamTex' parse error
    ERROR: error(#273) 1 compilation errors. No code generated

    Compilation Error for pixel shader
    position : 0
    error code: INVALID_OPERATION
    error string: ERROR: 0:29: error(#132) Syntax error: '_FoamTex' parse error
    ERROR: error(#273) 1 compilation errors. No code generated

    (on wiiu)
    Compiling Vertex program
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING

    Error building Player: Shader error in 'Hydroform/Octave': Compilation Error for vertex shader
    position : 0
    error code: INVALID_OPERATION
    error string: ERROR: 0:29: error(#132) Syntax error: '_FoamTex' parse error
    ERROR: error(#273) 1 compilation errors. No code generated

    Compilation Error for pixel shader
    position : 0
    error code: INVALID_OPERATION
    error string: ERROR: 0:29: error(#132) Syntax error: '_FoamTex' parse error
    ERROR: error(#273) 1 compilation errors. No code generated

    (on wiiu)
    Compiling Vertex program
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING
     
  40. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Yeah that's odd, never seen that happen before. Try restarting Unity.

    For the compile errors, try putting:
    #pragma target 3.5

    at the top of Octave.shader. Are you running 5.6?
     
  41. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Can you be more specific to exactly where I should put this? I've tried a couple of places and all fail for new reasons.

    No, I'm running 5.5.4p1.
     
  42. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Put it right before or after the other pragma statements
     
  43. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I put the #pragma target 3.5 in Octave.shader right below CG_PROGRAM:

    CGPROGRAM
    #pragma target 3.5

    I was able to build and run on the Wii U, but all that shows is a small pink square in the center of the display. I also tried #pragma target 4.0, but same result. I don't see any other errors anywhere.
     
  44. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I figured out what the non-animating water in play mode was. I should have remembered this, but when I use RFPS they set the Time Scale to 0 for some crazy reason. I've told them about this before, but the author doesn't seem to think it's a problem. So, I have to set it back to 1 myself. I doubt this will solve the pink square issue, but I'll give it a try at some point just in case.
     
  45. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    The pink square means that one of the shaders is not compiling or there is a problem with the material. Try lower pragma targets like 2 or 3. What happens again if you don't put the pragma statements in?
     
  46. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    So I'm curious what about this system is hard on mobile exactly? Draw calls are in line. Having issues with the unity gpu profiler right now so I can't use that to look at what's going on.

    I'm already targeting higher end devices. Current generation tablets mainly, which will be last gen by the time the game launches for mobile.
     
  47. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Ah I see you cover that in the manual:)
     
    Xix-Interactive likes this.
  48. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Right, it's got few draw calls, and the tri/vert count can be cut down and still look pretty good. What kills many mobile devices is the pixel shader. Some mobile devices like my Samsung S6 have insanely high resolution (2500x1400) so the mobile GPU has to do more work than a 1080p PC monitor. Really what mobile devs should do for complex shaders on crazy high rez displays is render the whole game to 1/4 the frame size and stretch that to full screen, it would barely be noticeable.

    What I plan on doing when I get to a mobile version is to cut out a bunch of features from the pixel shader, reduce it to 2 octaves max, maybe even use a surface texture rather than a procedurally generated one. You could test that yourself and see how it goes. Reducing the octaves to 2 might be enough to run fine on iPhone 6/7 even.
     
    Shodan0101 likes this.
  49. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    BONUS POINTS to you for reading the manual! ;)
     
    Shodan0101 likes this.
  50. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Hmm I wouldn't mind testing that mobile version on PC when it's available just to see the performance comparison.