Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[WIP] Flowmap Rivers for AQUAS

Discussion in 'Works In Progress - Archive' started by dogmachris, Apr 30, 2016.

  1. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    Hi everyone,

    I'm currently working on the next big Update for AQUAS (v1.3), which will have flowmap support for rivers implemented. Right now I'm tweaking one of the water shaders to support flowmaps and build a test river to see how it's working. Here's the first result:


    Unfortunately changing the flow speed also affects the consistence of the flow map, showing hard edges at certain points, whereas keeping the flow speed too low, will reduce that effect but also the visible flow. The flow speed can also be controlled by the way the flow map is being painted alright, but painting flow maps isn't all that easy if you've never done it before.

    Some more features I want to add and document the process of here are parallax mapping and ambient occlusion mapping for the normal textures. Since AQUAS is all flat shaders, parallax mapping to replace normal maps (or enhance them rather) makes sense. Parallax mapping works similar to normal mapping, with the bump effect being significantly more believable. I plan to make AQUAS look more natural this way. However having shadows is even nicer and here's where 2 problems come in.
    The first problem is that it can be a bit tricky to add believable shadows to normal textures on a perfectly flat plane. The other problem is that AQUAS consists of alpha blended shaders only which - as a limitation from Unity - can't receive shadows from light sources at all.

    Here's where the parallax mapping comes into play. The intention is to not only use parallax mapping, but instead use the alpha channel of the height map for the parallax effect to create an ambient occlusion map and effectively have a parallax occlusion map.

    As of yet, I don't have anything to show concerning this, but I'll keep the thread updated.

    EDIT:
    Added emission to the shader after a user pointed out, that it might be useful to make things like lava rivers. I prototyped a quick scene to test how that works:


    Obviously perfect lava looks different, yet still for things such as glowing green flowing stuff it might come in handy. One thing though that is still a bit tricky is the colors. Colors rely heavily on the light that the surface receives. In very dark scenes a slight influence of light is still required.

    Another thing I tried was to atlas the textures to keep the texture amount <4. This was because I wanted to avoid having to add another pass to the shader and keep it leight on performance. However I ran into some problems regarding the texture pan and the flow, which will distort and offset the textures far enough to make neighbouring textures from the atlas visible. So for now, I keep it at 5 textures with the additional pass. If I can't sort this out, I'll make the river shader an extra shader to leave the possibility open to use the classic triple textured shader if river flow isn't required. This way users will still be able to keep performance impact at a minimum, wherever they don't need a river.

    EDIT:
    Added the distance based tiling to the river shader today. It's designed to remove visible tiling at long distances. Will do that to the other shaders as well, but I was wondering if it's actually worth it, because it bloats up the shader quite a bit, so any feedback is appreciated. Here's a test video. It shows the water from about 3 m distance as the camera moves away. The farthest point to be seen at long distance is about 3 km away:


    EDIT:
    Reworked the normal textures. This is how it looks now:


    EDIT:
    Added a buoyancy feature. Turned out it was quite difficult to make it work on any mesh, since buoyancy forces applied on inhomogeneous meshes seem to cause overkill torques. For that I added balance koefficients for the rotation around each axis.

    Still for meshes that exceed a certain size, float precision is just not enough anymore and causes numerical inaccuracies. This can be compensated by reducing the water density. Since the water density can be set for every individual object, this shouldn't be a problem, so with that there's a buoyancy feature that should work on any mesh.


    EDIT:
    So AQUAS 1.3 is pretty much ready for release now. I'm currently having fun building some demo scenes:


    I have decided to leave the emission feature out of 1.3, because it bloats up the shaders for everyone who doesn't neet that.
     
    Last edited: Jun 5, 2016
  2. etaxi341

    etaxi341

    Joined:
    Oct 4, 2013
    Posts:
    64
    Wow pretty amazing! With a bit of work this could look pretty realistic without hard edges :) Keep on working! This is a thing many users would need! :)
     
    dogmachris likes this.
  3. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    @etaxi341 Thank you! :)
    The hard edges are a matter of the flow map. The shader handles them as they come in. The hard edges become visible as one increases the flow speed, so it's a balancing act getting the flow to look natural and still keep the edges as invisible as possible. I've messed around with gaussian blur on the flow map to reduce the visibility of those edges and it works pretty good, yet it's not able to remove them completely.
    I've also tested different angles and realised, the adges are pretty far away from each other if the flow map is a bit blurry. Then the edges are so far apart, that they wouldn't be visible in an FPS or 3rd person game, but would only be seen from far away.
    I'm still testing around, so we'll see. :)
     
    etaxi341 and BackwoodsGaming like this.
  4. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Amazing, Chris! Can't wait to use this. :) The asset store has needed this for a very long time.
     
    dogmachris likes this.
  5. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    Hehe, thank you. :)
    I've come to test a parallax occlusion mapping, but so far it doesn't look good on water. It works alright, it just doesn't seem to make it look any better, at least not considering how much more performance parallax mapping costs. However, I'm currently trying to use a custom reflection probe, which seems to be rather promising, especially in combination with the flow map support.
    I'll post updates as soon as I have them.

    P.S.: A user just hit me up and gave me the idea of adding emission to the shader. This way - with the flow maps - it could also be easily used for things such as lava - we'll see. :)
     
  6. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Uhm... Is it done yet? :p

    Seriously though, great work! Looking forward to seeing what you come up with here. Rivers and streams sound great.. Adding the emission option to it for lava flows = AWESOME!
     
    dogmachris likes this.
  7. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    I plan to have it ready by the end of may, but no guarantee as of yet - you know how it works: all those little issue that continuously pop up along the way... impossible to count them all in. :D
     
    Teila and BackwoodsGaming like this.
  8. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    Updated the initial post and prototyped a quick lava river scene to test the emissive shader.

     
    Last edited: May 5, 2016
    runningbird, zyzyx, Sigstan and 2 others like this.
  9. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    Just added the distance based tiling. It bloats up the shader quite a bit, so I'm wondering if I should really get this in, in short: I'm not sure, if it's actually worth it. Here's a quick demo video. It shows the camera starting at about 3 m from the water surface moving away and then closing back in. The farthest point to see is about 3 km away.

     
  10. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    Reworked the normal textures for 1.3. This is how it looks now:
     
  11. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Will there be any price raise with the new update? Planning to buy this eventually cause it seems awesome.
     
  12. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Can we turn off special stuff to increase performance? :)
     
    kittik likes this.
  13. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Isn't there several shaders? Can't you just use a less heavy one? Would be nice with finer control though I guess : )
     
    Teila likes this.
  14. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    From v1.3 on it will probably be $10 more for new customers, but I'll announce that again several days before it goes life, so no need to panic. :)
     
  15. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    @Teila special stuff being? As @virror says, there's a number of shaders for different performance levels and in the current version even the heaviest one is extremely light weight. The river shader will be a bit heavier, because it requires an additional pass, but it's only meant for creating rivers with it, other than that it's the same as the triple textured water. Yet still I have the river shader easily running at 300 FPS on my old machine.
     
    Teila likes this.
  16. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    I already own it so it doesn't matter. lol But I always ask that as I see the assets I buy become more and more complex. Looking forward to the river shader. :)
     
  17. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Btw, i guess the rivershader will also have different shaders for different machines?
     
  18. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    @virror nope, the river shader can only be used based on the triple textured shader. On the other ones it looks very unnatural, so I think there's only gonna be one river shader.
     
  19. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Ok, great to know!
     
  20. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    Added a buoyancy feature:
    More info in the first post.
     
  21. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Love the buoyancy! I never could get that to work in other water solutions. :)

    As for the hard edge on the river shader, can you add a little foam so we can blend it with the edge? That might help.
     
    one_one likes this.
  22. stevenc33

    stevenc33

    Joined:
    Apr 20, 2016
    Posts:
    18
    Distance based Tiling would be great. You can always make it a separate shader / one with and one without...
     
  23. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    Hey, sorry for being so late with the reply. Covering the edges with foam would have you end up seeng them anyway, just in the form of foam, which wouldn't look any nicer, I believe. But how many edges you have and how sharply they're to be seen all depends on the setup of the flow map. I'll do tutorials on how to optimize them, as soon as I have the Update ready.
     
    BackwoodsGaming likes this.
  24. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    Since it doesn't seem to be very expensive after all, it will be in in by default in the triple-textured shader. I'm just splitting up the triple textured shader in a version that supports flow maps and one that doesn't. This split makes a lot more sense, because the flowmap will add additional passes to the shader which is a bit more expensive. The distance based tiling however will be available in both versions.
     
  25. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,229
    Looking forward to the 1.3 release!
     
    dogmachris likes this.
  26. jamezbriggs

    jamezbriggs

    Joined:
    Apr 25, 2013
    Posts:
    6
    I just purchased AQUAS Water Set and went to look at the forums to troubleshoot an issue (water disappearing but it turns out its from having lights disabled in the view port). I was delighted to see v1.3 around the corner when I was already sold on the previous version! Keep up the great work!
     
    dogmachris likes this.
  27. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    How is that river shader going? I am not having luck with tiling aquas on my river. I have to use two many tiles which causes performance hits so am eagerly awaiting the new release.

    With Unity's water and Suimono, I can scale up and change tiling and no issue with a large plane, but for some reason Aquas has an issue with that. Not sure why.
     
  28. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    The Update is pretty much ready - I'm just doing some final polishing and smaller things that need to be done before release. Then after the demos are ready, I'll publish.

    How many tiles are you using? Does performance increase, if you turn off reflections on them? You don't have mesh colliders on the tiles, do you?
     
  29. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    I will check those things and see what I can do. We are in the middle of figuring out a new version control tool, just dealt with a tropical storm that went over our house, and life is complicated. lol
     
  30. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Any word on the release date yet?

    @dogmachris I see your main thread updating daily, but no response here in a while.
     
    Last edited: Jun 28, 2016
  31. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    Hi everyone,

    AQUAS 1.3 is almost ready for the Update. I'm happy to present you a demo pack for Download >>
    The Pack contains 4 different scenes to see AQUAS in action in different environments and with different settings. The following scenarios are included:
    • An RTS-Style river scene
    • An RTS-Style ocean scene
    • An FPS-Style tropical island scene
    • An FPS-Style desert lake scene
    The scenes are designed to show as many of the different features of AQUAS, as possible.

    Enjoy and all feedback is of course highly appreciated!

    Cheers!
     
    camel82106 and magique like this.
  32. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Nice demo, but one thing you might want to add before release is volume masking so that you don't see water inside the boat as it floats. I asked another water developer to add this feature based on seeing it in a Playway Water video and he said he'd consider it, but also linked me to a way to implement it myself with some free open source code. I never gave it a try, but it looked really easy to do. You can see it in action at the :32 second mark of their video:



    If I can find the example code that the one author sent me, I'll post it here.

    EDIT: I think this was it. http://wiki.unity3d.com/index.php?title=DepthMask
     
    dogmachris likes this.
  33. camel82106

    camel82106

    Joined:
    Jul 2, 2013
    Posts:
    304
    That river is crazy awesome. I was waiting exactly for this. At morning you have new customer now I must go to sleep :)
     
    dogmachris likes this.
  34. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    Glad you like it. I hope Unity will manage to get it reviewed sometime next week.
     
  35. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    Thanks a lot for the heads-up! I'll see if I can get it worked in.
     
    magique likes this.
  36. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    AQUAS 1.3 is out!

    I have to apologize at this point: it has been out for some weeks now, I just simply forgot to update this thread too, I made the announcement only on the main AQUAS thread - sorry for that to everyone who missed it. :confused:

    Here's some more info:

    New Feature Video:

    Demo Pack for Download >> Contains 4 scenes with different camera views and environments

    Demo APK >>

    Asset Store Link >>

    Main Forum Thread >>

    Sorry & Cheers
    Chris​
     
    BackwoodsGaming likes this.
  37. mohitsabhi

    mohitsabhi

    Joined:
    Feb 11, 2017
    Posts:
    5
    Hi !! Chris,

    Just downloaded AQUAS and as soon as added to my project, get this message on the console;

    Assets/AQUAS/Scripts/AQUAS_LensEffects.cs(100,57): error CS0122: `UnityStandardAssets.ImageEffects.GlobalFog' is inaccessible due to its protection level

    Can you please assist what needs to be done.

    Thanks and Brgds

    Mohit
     
  38. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Open the GlobalFog.cs script and add public before the class name:

    public class GlobalFog
     
    dogmachris likes this.
  39. sebou42240

    sebou42240

    Joined:
    Aug 21, 2015
    Posts:
    19
    Hello, i have a block with water around. I can dig in, and i would like water go Inside the hole, except if y dig in center of my bloc i wouldn't have water... can i do this with your asset ?
    Thanks you
     
  40. Wishymashy

    Wishymashy

    Joined:
    Jun 3, 2017
    Posts:
    16
    Hello is there a documentation on how to work the Buoyancy? I try to set it from a demo but seems the small boat gets fling up in the sky and down deep in the water like a yoyo. Can't get it to sit on the water like a normal boat.
     
  41. Corvwyn

    Corvwyn

    Joined:
    Nov 15, 2013
    Posts:
    114
    AQUAS is a flat water shader that uses a water plane, so it doesn't have any fluid dynamics. I guess you could "cheat" by spawning water planes at runtime, but that might not be what you're after.

    You would probably get more feedback in the main AQUAS thread: https://forum.unity3d.com/threads/u...ater-rivers-for-mobile-vr-web-desktop.378519/
     
    Last edited: Aug 14, 2017
  42. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,375
    Add a collider component to your boat and see if that makes it any better.