Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

AS Water Shader

Discussion in 'Assets and Asset Store' started by MarkD, Jul 15, 2018.

  1. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    171
    Release Nr. 2.1:
    SRP update: added support for the URP/LWRP pipeline. (HDRP not currently supported).
    Reworked color calculations to take light frequency absorption into account in deeper areas.


    “AS Water Shader” is a flow and normal map based shader that enables users to turn surfaces in to highly realistic water. The shader is highly customizable with easy to tweak features such as: water density, Foam, interpret/apply flowmaps, use detail textures to add dirt and lastly use custom wave shapes in the form of normal maps.

    With the Flowmap-Canvas users can render a flowmap texture based on the mesh normals below the surface. This Canvas automatically generates the appropriate channels in the flowmap texture for the shader to use.

    The benefit of AS Water Shader using flowmaps, is that users can also paint/edit their own flowmap or even render them out in third-party software. A reference texture is given to observe which channel represents which direction. This enables the user to have full control over the behavior of their water surface.

    Main features:
    -Compatible with Amplify Shader Editor. Users who own ASE can view and edit the node network.

    -dual detail textures.

    -dual normal maps for different wave sizes and blending.

    -Flowmap to create smooth and realistic waterflows.

    -Caustics: static or animation sheet based caustics that project themselves based on light positions, normal, depth and flow map values.
    Generated procedurally based on GPU powered Voronoi noise.

    -Flowmap Canvas to render flowmaps in the engine

    Supported render pipelines: Built-in (yes), URP(yes) ,HDRP(currently no).

    2c939649-4cce-4d1b-9827-c8228a8f638d_scaled.jpg 07cb390b-49e9-4fc5-a112-d614ca79d039_scaled.jpg 11543bb6-b26b-4637-b1dc-e142deeb92f7_scaled.jpg 46015ea7-6870-4eab-a8d8-44d2a21ebeb8_scaled.jpg 63001502-2f2a-486f-a324-5ab7cd757aab_scaled.jpg





     
    Last edited: May 4, 2020
    mgear, DrOcto and Neviah like this.
  2. DespairBear

    DespairBear

    Joined:
    Nov 1, 2013
    Posts:
    230
    Looks fantastic. How reliable is the flowmap generator? Could this potentially be used for rivers and such? Any plans to implement shoreline foam?

    Also just curious if you're planning on implementing any sort of underwater volume image effect?

    The result looks excellent, keep it up
    Maybe provide a demo that always switching between material presets? Just to get an idea of the use beyond the visual style in the scene
     
  3. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    171
    Hi, the flowmap generator is very "geometry" dependent as it uses the normal direction of a mesh-collider's face. External tools such as Houdini which actually create a flowmap from a fluid simulation, will always be better.

    So the results with the provided generator will depend on your scene and the size of your water surface.

    If for instance, you render out a 512x512px flowmap texture for a 4x4u (unit) area, it will have a better result than rendering that same 512x512px for a 400x400u area (because of the amount of pixels being divided over said scale).

    The generator is there for people to get started or not know to other applications. But if you have the knowledge to generate one in Houdini or even Maya/3dsMax, then those will of-course always be the better option.


    A scene showcasing several material presets is not a bad idea at all!


    I hope this put some light on your questions.

    Sincerely,
    Mark

    Edit: This feature is now replaced with an interactive Canvas that uses particle systems to simulate/render its flowmaps.
     
    Last edited: Aug 19, 2019
  4. Adam_Starcaster

    Adam_Starcaster

    Joined:
    Dec 7, 2012
    Posts:
    37
    Looks like what we need, but question. How hard to make it work in HDRP?
     
  5. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    171
    Hi Adam,

    The shader is completely build within forward rendering because of how pixelgrabs within a shader are handled in the standard renderpipeline (pre HDRP), the whole shader is dependent on this crucial part. This means that at the moment it is not compatible within the HDRP.
    It is only compatible with the classic forward and deferred pipeline (since the shader can force itself into forward mode).

    I am still working/figuring out the new HDRP and the approaches that need to be tackled before porting the shader.
    An official version will probably happen only after the HDRP is out of preview mode (as it will be more complete and stable to base a build on). But for now in the short term, there is no HDRP release planned.

    So if your project is completely relying within HDRP, I would not recommend buying my AS watershader asset in all honesty, as within that workflow it will be of 0 functional use to you.


    Hopefully this information was of any use to you.

    Sincerely,
    Mark
     
  6. Adam_Starcaster

    Adam_Starcaster

    Joined:
    Dec 7, 2012
    Posts:
    37
    Thanks so much for the quick reply. It has been a huge pain for us lol, and this looks really amazing. We have attempted to write our own, but this tool is super amazing. I was hoping because of Amplify compatible shaders have HDRP support now, but still we are stranded.
     
  7. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    171
    Yes, Ampify shader editor itself has compatibility for HDRP, however it uses a different lighting model for the HDRP part, so that is what makes it incompatible currently with ASWS.

    So making HDRP shaders requires starting in a HDRP shader mode/lighting model.
     
    Adam_Starcaster likes this.
  8. Adam_Starcaster

    Adam_Starcaster

    Joined:
    Dec 7, 2012
    Posts:
    37
    Got you! :D
     
  9. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,835
    Does this support shadow casting on the water?
     
  10. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    171
    Hi,
    Sorry for the late reply on the forum.

    Yes, the water surface itself supports realtime shadows (not baked).


    And if you are an Amplify ShaderEditor user, you can always tweak the default lightmapping of the shader yourself. By default it ignores everything except shadow maps.
     
    magique likes this.
  11. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    923
    Hi, can it works on mobile using standard rendering pipeline?
     
  12. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    171
    Hi Kenshin,
    At the moment no.
    The shader is depended on certain methods that are not available on mobile platforms. On top of that would all the computations needed eat up to much resources on mobile platforms in their current state.

    The shader is being developed with pc and console platforms in mind.

    I hope this information was of use to you.
     
  13. Dreamwalker23

    Dreamwalker23

    Joined:
    Mar 18, 2018
    Posts:
    10
    Supported render pipelines: Standart (yes), LRP(currently no),HDRP(currently no).
    spelling error :)
     
  14. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    171
    Hi,
    Thank you very much pointing this out! Fixed in main thread and subsequent locations where the same description was used.
     
  15. Koogi-Krain

    Koogi-Krain

    Joined:
    Jun 17, 2014
    Posts:
    5
    Excited about this solution!

    1.Can this work I'm VR with ORift?
    2. Can this be modified and produce ocean waves?
     
  16. Ocalvillo

    Ocalvillo

    Joined:
    Jun 19, 2019
    Posts:
    2
    Hello,

    I currently updated my project, which includes your water asset, and started using the Universal Render Pipeline.
    Before that, it was working completely fine, and now it doesn't.
    Furthermore, I have already installed the Universal support Pack.

    Do you know what is happening? How can I fix it?

    I'll appreciate your reply,

    Oscar
     
  17. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    171
    Hi,

    Does the same issue also happen if you use LWRP instead of URP?
    Could you perhaps post an example of your issue.

    Edit: I tested the URP shader and found an issue with URP in Unity version 2019.3.x after updating to the new database. I have already made a patch and it should be live in a few days.
     
    Last edited: Mar 4, 2020
  18. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    171

    Hi

    1: This is untested. The shader uses the GrabPass (_grabTexture/OpaqueTexture for srp) which "should take VR into account. However a lot of other areas of the shader uses single camera depth, which will probably break in VR.
    So for the moment, no it will probably not work in VR.

    2:Ocean waves can be faked by lowering the wave normal's tiling and upping the vertex displacement. It gives a good "shape", however there is no dynamic height based foam or anything that you would expect in a proper ocean shader. This shader is focused on streams, closed water areas and similar situations. These water surfaces their flow direction can be controlled through a flow map in which the B channel control's the foam amount on areas. Which would be useless in the scenario of an ocean, but very useful in the scenario of above mentioned water systems.


    I hope this answers your questions.
     
  19. Ocalvillo

    Ocalvillo

    Joined:
    Jun 19, 2019
    Posts:
    2
    Hi,
    Hi,

    The water worked perfectly before installing URP. We don't want to try with LWRP, since now all our project settings are adapted to URP. We were wondering if there is a specific shader that works well with URP, or if you can give us some indications of how to fix it.

    The problem is that right now the appearance is as if there would not be any material applied, so everything is pink.

    Thank you!
     
  20. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    171
    I have recompiled the shader for the newer URP and it should work again as expected. Also make sure your URP renderer provides an "OpaqueTexture" which is used for the refraction effect.

    If you can't wait till the patch goes live (which I fully understand), email me your package's invoice number and I will send you the new build directly.

    Contact: https://markduisters.com/contact/
     
    Last edited: Mar 5, 2020
unityunity