Search Unity

Graphics Hydroform Ocean Renderer [RELEASED]

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

  1. Farelle

    Farelle

    Joined:
    Feb 20, 2015
    Posts:
    504
    this looks awesome :D
     
    Xix-Interactive likes this.
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Not heard much recently, how goes it?
     
  3. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I'm back on it again after a break. Right now I've got a problem where GrabPass fails in game mode, but works fine in editor mode. I believe this is a bug that was supposed to be fixed in 5.3.4, but I'm seeing it in that build. I think I'm going to try and use a CommandBuffer grab rather than track down the GrabPass issue. Hopefully I won't have to fall back to rendering the reflection and refraction via RenderTextures through separate cameras because that's waaaaay slower.

    I looked at the SSR in the Unity bitbucket - looks nice but is probably overkill for water reflections. I may just bundle it with the asset anyway and let it do the SSR. If the user wants SSR anyway, why do it twice? Later on I'd like to take a shot at doing a simpler implementation and see if it looks OK / performs well.

    Here's a screen since I haven't posted one in forever: tropicIsland01.jpg
     
    Farelle and hippocoder like this.
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Looks mint.
     
  5. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Thanks! Ha, haven't heard that phrase in a while, you from the NYC area?
     
  6. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Alright, I've finally found some time to finish this thing off. I'll post some demo links tomorrow. Here's a video of the shore effects:



    Oh, BTW I got screenspace reflections going! A little crude but super-fast. The shore effects work automatically based on terrain/rock depth. Notice the waves damp out near the shore as well, so you don't have giant waves coming up on the beach and poking up in the middle of it.
     
    roryo, Lex4art, Farelle and 1 other person like this.
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Lets have it then! I'll test it out.

    A question though, is it possible to get the height at a position so we can proper check if we're under or over, or do floaty stuff.
     
  8. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Yes, absolutely, although the waves are entirely GPU generated, a getHeight() script query duplicates what the GPU is doing and returns an accurate height point at whatever x/z position you want in the world. One of the included demos has some floating boxes demonstrating how to use it.

    Are you still up for some PS4 testing? Do you have access to Xbox as well?
     
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    No XBox but I'll give it a go on PS4. That thing has a lot of reserved shader names for some reason, so it ends up being just renaming stuff.
     
  10. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    484
    Hi Xix-Interactive,
    Nice Ocean! I have a question that will your ocean run in editor mode (don't need to click Play button)? or only rendering in runtime mode.
     
  11. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Beautiful ocean! :)
     
    Xix-Interactive likes this.
  12. FreeFly90

    FreeFly90

    Joined:
    May 28, 2016
    Posts:
    177
    Looks great, wow!
     
    Xix-Interactive likes this.
  13. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Yes, it runs in editor mode and reacts to all the inputs in realtime in the editor. Here's a screen: Hydroform_editor.jpg
     
  14. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    OK here are some demo links. Especially interested to hear from Mac and Linux users since I haven't been able to test on those platforms. It should look like the videos:

    PC DEMO
    MAC DEMO
    LINUX DEMO
     
  15. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Right this is as perfect as it gets for a high performance solution. I have a wish list of things that should be trivial but make a big difference:

    1. possible to fade verts to at the shore? very unimportant to me but it goes almost to zero at the shore.
    2. the reflection is awesome! voodoo! but at distance to the rock it can become quite noisy, how can we tweak that?
    3. need to be able to flip the water rendering for when we are under water. I'm thinking I'll disguise the transition to below the waves with a bit of fx and so on, so I really just need to flip it + have it rendered right lighting wise from under it optionally :) atm it can't be used underwater.
    4. Need to be able to control the look enough to do time of day. Really don't mind moving all the values myself over time, just need it to be able to represent a night time look.

    That's all I can think of, just the final usability stuff!


    Oh yeah! did you know Unity's inspector lets you use property drawers? for example

    [Header("Wave Stuff ")]
    public float waveStuff = 0f;

    Puts nice headers on and stuff in inspector. Figured you might want to know about them to save time on getting tool presentable.
     
  16. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,374
    Thanks for the demo. Looks great. I would like to see what it looks like from a high altitude though, but the camera is locked to a very low maximum altitude.
     
    Xix-Interactive likes this.
  17. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    484
    Nice that run in editor mode!
    Wanna try your Mac build, but after decompressed the zip, i got folder call "HydroformDemo_Data", I don't see any executable app file.
     
    pixelsteam likes this.
  18. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    This looks fantastic. When will it be available? and how is it for larger areas. Also yes, MAC version not working...PC is great though.
     
  19. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Yeah the ocean fogs out after you get much higher. To simulate a higher height, increase the frequency in the demo, it'll look pretty much like that. I'll definitely consider raising the cap if I update the demos. You making a flight game?
     
  20. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Ack, sorry about that guys, I just put up a proper Mac build. The same link should work.
     
    Luckymouse likes this.
  21. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I'm hoping to submit to the store within a week. Haven't done that before so I'm not sure how long the process will be.

    It works great for large areas, the ocean is infinite and the shore effects are based on where the camera is, so you should get the same wave detail, shore fx, and performance no matter how large the area is. Try out the demo, you can go on forever - or to the point where you hit floating point errors for 32 bit floats anyway.
     
    pixelsteam likes this.
  22. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    1) Well it's not actually transparent because I don't want to burn GPU speed on alpha blending especially when most of the ocean is opaque. It would probably be possible to fade out the refraction index on very shallow water based on depth, which would be close to invisible.

    2) Yeah that's what I dislike the most about reflections. I think the solution is to blur them.

    3) Yeah underwater fx may be the first update I do depending on what people want. I've gotten good results before by just doing a grabpass and perturbing that based on the waves, and then tweaked the reflections/refraction. Don't think you'll need transition fx unless the camera moves slowly. Or are you talking about water beads on camera?

    4) You'll have full control of the water colors and foam color from script, so that should be possible. Specular is done from a regular light object, so just move that around with the sun/moon.

    I should point out that this comes with the full source, so you can tweak to your heart's content!

    Yes, I am aware of better inspector stuff, I'll be taking a look at that immediately, it's time.
     
  23. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yeah that all sounds great. As for wakes and other things on the surface, is there an easy thing going on with that, or is there an available render texture of wave heights I can read in my own shaders? all things I can do to work with/around that.

    Another thing, what happens where the wave clips the camera? My solution would be to force camera above the highest wave then after a threshold pop the camera under water. Another way would be I guess to fill the portion thats clipped with a tint colour of some kind so it has that fish tank wave affect, no biggie just thoughts...

    All good.
     
  24. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    I am making a flying game and hope to use your water for it ;)
     
    Xix-Interactive likes this.
  25. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    There is sort of a wave height texture, but I think the best way to handle wakes might be to use a projector to project them on top of the ocean surface.

    I'm not sure the best way to handle a wave clipping the camera. Personally I'd just try to avoid it - have the camera rest on top of the surface if it's going to be above, and then if it's going to move down, then make sure it's below the surface and start the underwater render. I wouldn't want to spend a lot of time on fancy fx in the in-between case unless that was going to happen a lot in my game.
     
  26. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    OK, that's 2 requests for removing the height cap. I'll do that on the next round of demos. I'm waiting to hear back on a bug fix for Mac, I'll update everything after that if it's indeed fixed.
     
    John-G likes this.
  27. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    I've looked at your Mac demo (2nd one) and it is working very good. Running smooth on 2013 Macbook Pro.

    Is it possible to use Flow maps with your asset?
    Can this be used as small water bodies? or is this infinite water only?

    Thanks
     
    Xix-Interactive likes this.
  28. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,374
    Yes, also. Most water solutions don't look good from a high altitude. Too much repetitive patterns is the main issue.
     
  29. MinhDao

    MinhDao

    Joined:
    Oct 28, 2013
    Posts:
    155
    This looks awesome!
    Dose it support mobile? I really need good ocean on mobile!
     
    Xix-Interactive likes this.
  30. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    No on flow maps, it would hurt performance. This asset will not be for small water bodies, just infinite only. I may release another asset that is more suited to small bodies in the future if there is interest in this asset.
     
  31. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    It does work on mobile that supports opengl es 3.0, but it's not very speedy, at least on my Samsung Galaxy S6 with it's insane 1440 x 2560 resolution. I believe I could optimize it quite a bit to run much faster. In terms of future updates, it will likely be either a mobile version or underwater fx that come first, depending on what you guys want.
     
    pixelsteam likes this.
  32. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    I vote underwater first ;)
     
    Xix-Interactive likes this.
  33. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    OK, I've updated all the demos. I fixed a couple of problems with the Mac demo, so hopefully that is running well for everyone now. I've also removed the height cap, increased the view distance to 4k, and pushed out the fog, so you folks making flight games can get a look from higher up.

    Note - I would recommend turning off subsurface scatter if you go high up - it looks great lower, but produces an obvious pattern from high up. Note also that in the actual asset, you will have quite a bit of control over the color and threshold for the SSS, so it can be made much more subtle for high altitudes, etc.

    Here are the links again:

    PC DEMO
    MAC DEMO
    LINUX DEMO
     
  34. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Ha, nice, I'll have to use that image for underwater reference ;)
     
    pixelsteam likes this.
  35. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Finally submitted to the store! Lord that took longer than I expected.
     
    pixelsteam likes this.
  36. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    I have some terrain that is thirsty for your water...
     
  37. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Oh wow that looks amazing! Love the depth-of-field in that image, very nice!
     
    pixelsteam likes this.
  38. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    Any update on the submission to the asset store?
     
  39. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    It's still officially 'pending review'. The publishing site says it can take 5-10 business days to review. It hasn't been 10 biz days yet, so I'm not too concerned. I wouldn't be surprised if things are a little slower closer to the holidays though.
     
    pixelsteam likes this.
  40. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    You could check out how it looks in Dying Light. Imho they've found a very nice solution:
     
  41. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It's perfect. I love how it's a simple tinted fill where it's clipped. Can we have that please? Don't need all the fancy effects, just solving the tint + clipped area.
     
    Martin_H likes this.
  42. stanislavdol

    stanislavdol

    Joined:
    Aug 3, 2013
    Posts:
    282
    This looks very promissing, I'd love to give it a try when it hits the store.
     
    Xix-Interactive likes this.
  43. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    Yeah that looks very nice. I can't think of a good way to do it efficiently, any ideas?
     
  44. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    all I can think of is always pulling the closest verts down and snap their depth to near clip + fudge or something like that... would totally depend on how tessellated it all is ? sorry not much help. @bgolus maybe you have an insight?
     
    Xix-Interactive likes this.
  45. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    I'm not sure the specifics of how they're doing that effect, but I can tell you a few things.

    The near camera water edge & surface and the water surface everywhere else are completely unrelated. Might be an full screen effect, might be a camera locked mesh, probably a combination of both, but not sure what parts. If you look closely you can see the "distant" water fades out and the near water fades in with no surface texture, and when going in and out of the water the "black edge" on the bottom is there to obscure the fact that there's a gap between the far water surface and the ripple. It is quite nicely done though.
     
    Xix-Interactive likes this.
  46. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    OK, yeah those are interesting suggestions. I might be able to do it with an image effect that "ray traces" each pixel to see if it would be above or below the water at the clip distance. For pixels that are above the surface, nothing gets drawn, within a certain threshold of the clipped surface and the "black" area gets drawn, and below gets tinted. It would be expensive, but could be run at a lower resolution than the actual screen.
     
  47. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Tested the demo, looks great. Have you done any testing in VR?
     
    pixelsteam likes this.
  48. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    It *should* work in VR, and it seems perfect for it because it's very fast. HOWEVER, I have not tested it in VR so there may be issues. If there's anyone reading this who is a legit VR dev and wants to help out testing, let me know.
     
  49. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    The PC Demo link is broken. I get a 404 error message.
    Thanks!
     
  50. Xix-Interactive

    Xix-Interactive

    Joined:
    Aug 26, 2015
    Posts:
    442
    I moved the demo links over to the store page. It's LIVE!!! Woot!!!

    http://u3d.as/Ep3
     
    Wavinator, John-G and pixelsteam like this.