1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Unity 5.6 is now released.
    Dismiss Notice
  6. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

[Updated v1.26] Stylized Water Shader

Discussion in 'Assets and Asset Store' started by Jonny10, Sep 8, 2016.

  1. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    [​IMG]


    A shader inspired by Zelda: The Windwaker, customizable to your liking through various parameters. Texture maps are sourced from a Substance material which makes this package customizable and lightweight (~50kb). All shaders are including ShaderForge nodes, so they can be edited. Also includes two simplified shader, for low-end devices.

    Features:
    • Custom inspector, for ease of use
    • Intersection effect with other objects
    • 5 types of normal/refraction maps
    • 5 intersection textures
    • Ability to add custom textures for waves and intersection
    • Depth control
    • Refraction
    • Wave animation
    • World-space or UV-based tiling

    Contents:
    • Documentation
    • Demo scene (+30 stylized models)
    • ShaderForge nodes
    • Desktop shader (+Tessellation variant)
    • Advanced mobile shader
    • Basic mobile shader

    Note: Does not support orthographics cameras or Lab Renderer

    [​IMG]

    Intersection textures:
    [​IMG]

    Wave types (exaggerated)
    [​IMG]

    User images:
    Sharpflint, by EATMEAT Games
    [​IMG]

    The Knight's Willow, by Kenney
    [​IMG]

    v1.25
    Added:
    - Cells + Cloudy wave types
    - Perlin intersection style

    Changed:
    - Minor script improvements
    - Improved appearance of the different waves and intersection styles

    v1.24
    Changed:
    - Fixed depth banding artifact on some mobile GPU's.

    v1.23
    Added:
    - Intersection distance parameter (as seen in GIF)
    - Prefabs
    - Square and Circle water mesh, high-poly and low-poly variant
    - Transparency parameter for Mobile Basic shader

    Changed:
    - Set Substance to generate all outputs by default, to avoid empty textures

    Removed:
    - Disabled shadow-casting in shader, as this is unwanted behaviour anyway

    v1.22

    Changed:
    - Set Substance to 'Uncompressed' by default for Mobile
    - Improved normal map blending
    - Restored light reflection to its former glory

    v1.21
    Added:
    - Shaders can now be modified using ShaderForge.
    - Unity 5.5 support
    - Demo scene with 30 free stylized models
    - Option to randomize seed in inspector

    Changed:
    - Improved support for Substance material instances
    - Changing materials shows/hides the new parameters automatically
    - Wave vertex offset now follows the mesh's normal direction, rather than offsetting in the world Y-axis (useful for curved surfaces)
    - Switched from glossiness to roughness type, for better results under low/no light conditions
    - Inspector GUI improvements
    - Substance will generate both texture maps regardless of "Generate all outputs" option

    v1.2
    Added:
    - Custom inspector component for ease of use
    - Fresnel color (alpha controls opacity)
    - New mobile shader variant "Basic"
    - Documentation now contains a parameter glossary

    Changed:
    - Previous mobile shader is now called "Mobile Advanced"
    - Updated demo scene
    - Set Substance to 'Uncompressed' for Desktop
    - Mobile shader has been tweaked for performance

    v1.15
    Added:
    - Fresnel control
    - Multi-light support
    - Rim color alpha now controls intersection amount
    - Support for Unity 5.3.0 and up.

    Changed:
    - Fresnel color is now derived from Ambient Light rather than Directional Light
    - UV/WorldSpace tiling values are more logical
    - Reflection intensity is now bound to the glossiness parameter
    - Depth control is more physically correct

    v1.1
    Added:
    - Surface highlights.

    Removed:
    - Heightmap, since it was not used.

    Changed:
    - Name of depth buffer script to avoid conflicts.

    v1.0

    Initial release

    Feature requests:
    • Waves heightmap
    • Flow direction
    • Orthographic camera support
    • Realtime reflections
    • Filter objects subject to intersection effect
     
    Last edited: Apr 10, 2017
  2. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    393
    Nice! 3 queries (priority order):
    - Artificial surface highlight based on wave (to mimic specular reflections)
    - Caustics (on underwater objects)
    - Underwater effect?
     
  3. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    Good call! Although I think the last two points would be outside of the scope of this project. To my understanding people usually achieve caustics through the use of Projectors and an underwater camera effect through a camera shader.

    I'd like to add the ability to use the intersection texture on the surface as well, but tiled larger, much like in Windwaker. It warrants some experimentation :)
     
  4. MinhDao

    MinhDao

    Joined:
    Oct 28, 2013
    Posts:
    152
    It looks really nice! Can you provide web or apk demo for testing?
     
  5. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    Will do! My idea would be to expose the shader parameters in a UI, so you can try out all the things ;)
     
  6. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
  7. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    [​IMG]

    Upcoming update (v1.1) will add surface highlight detail. Size and transparency are adjustable.
     
    theANMATOR2b, TeagansDad and zyzyx like this.
  8. Redbrook

    Redbrook

    Joined:
    Aug 30, 2016
    Posts:
    3
    Just wanted to let you know this gif sold me on the asset. I'm getting it now and I look forward to this update. Thank you for sharing your work.
     
    Jonny10 likes this.
  9. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    If anyone is experiencing issues with Unity 5.5, some underlying shader changes were made, which prevents this shader from compiling.

    However, I have a fixed version. If you're set on using 5.5 and you'd like to use this shader in your project please contact me with your invoice number and I'll sort it out for you!

    The manual fix for compatibility with 5.5 will be included in the next manual update. Unfortunately, It's pretty difficult to ensure compatibility with different versions of Unity, I'm currently looking for the lowest possible version it's compatible with, since not everyone is on 5.4 yet.
     
  10. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    Received some important feedback from several users, aiming to submit version 1.15 this week!

    Added:
    - Fresnel control
    - Multi-light support
    - Rim color alpha now controls intersection amount
    - Support for Unity 5.3.0 and up.

    Removed:
    -

    Changed:
    - Fresnel color is now derived from Ambient Light rather than Directional Light
    - UV/WorldSpace tiling values are more logical
    - Reflection intensity is now bound to the glossiness parameter
    - Shadermap is now assigned by default
    when resetting the shader
    - Depth control is more physically correct

    New demo image:

    [​IMG]

    Shader as seen in "The Night's Willow"
    [​IMG]
     
    theANMATOR2b and zyzyx like this.
  11. Amadeu

    Amadeu

    Joined:
    Dec 11, 2014
    Posts:
    5
    Hi Jonathan, I just wanna say that you've done a great job with this water. It's a great new to see that you're still supporting and improve it with those new features and control options.

    I'm working in a personal project and I'm pretty confident that your water will be the one that I'll use in it.

    Keep working hard!!
     
  12. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    Thank you for your kind words! I appreciate it :)

    In the next update I'm aiming to add a custom inspector, so all the shader and substance parameters are in one place, and neatly organized. This update will introduce a slight price increase, because of the time investment and the added functionality.

    I noticed I accidentally included my work-in-progress script for this in the last version. So all I can ask now is: please ignore it :>
     
  13. JoiSigurdss

    JoiSigurdss

    Joined:
    Dec 6, 2015
    Posts:
    1
    Hey Jonny, I recently bought this shader and I've been using it for a project I've got going. It fits really well, love it, great job! :)

    Custom inspector sounds really cool as well, looking forward to it!

    I've got one question/request. I have day/night cycle going and I make small real time changes to some of the properties to make the water fit better, but there's this grey gradient effect ( fresnel ? ) that I can't seem to change at all, pictured in the image below. Is there any chance you can expose the controls of it as a property, so I can either remove the effect during night or change the color of it?

    [​IMG]
     
  14. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    Hi,

    Please send me an email (contact info is on the asset store page) and I'll fix you a modified shader with the fresnel color exposed (currently linked to the scene ambient color). I'll include the fresnel color in the next update, where the alpha channel will control its opacity.
     
    JoiSigurdss likes this.
  15. Amadeu

    Amadeu

    Joined:
    Dec 11, 2014
    Posts:
    5
    A price increase is totally fair man, the new update sounds very interesting!
     
  16. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    Making good progress on the custom inspector. Right now the undo function is too wonky for comfort :rolleyes:

    I've also added a toggle which allows you to use the intersection texture type (either the built-in or a custom provided map) as the surface highlight. When switched off this is derived from the normal map.

    [​IMG]
     
  17. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    Did some experimenting with animating Substances, to see if I could move some of the texture cross-panning out of the shader. Which seems to be a huge performance bottleneck on mobile.

    https://gfycat.com/TepidShrillCrayfish
    [​IMG]

    The result is visually identical, but yields a 300% performance boost on mobile (tested with Oneplus One). Another benefit is that I can now utilize all of Substance's functionality to replace certain shader operations.

    If you're interested in giving it a spin, contact me with your invoice number and I'll sent it out as soon as I've ironed out the kinks ;) Feedback is much appreciated at this point!
     
  18. Rafmorais

    Rafmorais

    Joined:
    Jan 13, 2015
    Posts:
    34
    Hey there, awesome stuff with this water shader... I'm about to buy it but wanted to ask if you could share some vertical examples using this shaders, luje waterfakks as well as using this very shader on a sphere or other surface that it is not 100% flat.
     
  19. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    [​IMG]

    If you're worried about stretching, you can toggle world-space tiling

    [​IMG]
     
  20. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    Version 1.2 has been submitted for review! Documentation is now available online, as is an Android APK demo. Links are in the first post.

    Added:
    - Custom inspector component for ease of use
    - Fresnel color (alpha controls opacity)
    - New mobile shader variant "Basic"
    - Documentation now contains a parameter glossary

    Changed:
    - Previous mobile shader is now called "Mobile Advanced"
    - Updated demo scene
    - Set Substance to 'Uncompressed' for Desktop
    - Mobile shader has been tweaked for performance

    [​IMG]
     
  21. Bravojr

    Bravojr

    Joined:
    Jan 28, 2015
    Posts:
    1
    Just picked this up, loving it so far! The substance control is super neat.
    However, there is a vital feature for me that is missing, and that is surface shadows.
    I tried going about it by adding a plane on top of the water with a shadow cutout shader, but to no avail as the blending seems to eat up the shadows.
    Any idea what can be done to amend this? Thankful for any help!
     
  22. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    Hi, transparent objects cannot receive shadows, as it is not supported in Unity's rendering pipeline. This post should hopefully clarify this: http://answers.unity3d.com/answers/1198627/view.html

    I realize this means the water can look very detached from an environment, but I do not know any way around this. Personally, I usually make the water at least 60% transparent, so you can see some shadowing underneath the surface.
     
  23. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    300
    Hey @Jonny10 i have a problem with the shader
    first of all it is a great shader, a tremendous shader i have a great respect for your shader:
    [​IMG]
    this is it in Redwood Tale were making.

    However upon testing it in build it turns out the shader refuses to show up no matter what i do.
    • The object is in scene with desktop shader
    • shader is included in always include list
    Shader shows me an error
    [​IMG]
    Maybe that is the issue?
    upload_2016-11-29_22-41-3.png

    I did all i could, the water just refuses to build, i use Unity 5.4.0f3
     
  24. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    Hi! I have not been able to replicate the error on 5.4.0f3 when building. Please shoot me an email (contact@jonathan3d.com) with any more details you can spare and hopefully we can work it out.
     
  25. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    The next update will introduce some new content! Desktop shaders will work will multiple lights, as has been requested and have been modified to work correctly under low/no light conditions. Package is now also compatible with Unity 5.5.

    The ShaderForge source for all shaders will be available. Users who own ShaderForge can make changes to the shaders as they see fit. However, ShaderForge is not required to use this package!

    I have also had permission from the artists who worked on the assets you see in the demo image to include this with the package, as an added bonus ;) These are from The Torch, our school student from a while back.

    [​IMG]
     
    ethanwgross likes this.
  26. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
  27. Asset_Store_Deals

    Asset_Store_Deals

    Joined:
    May 2, 2016
    Posts:
    221
    Just to let you know we are adding Stylized Water Shader to AssetStoreDeals.com.

    When you have other sales, you can add them to this website yourself simply by pasting the link to your asset in the designated area.

    Best of luck to you with this sale!
     
  28. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    Thanks! I had already submitted it! :)
     
  29. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    3,366
    Pretty shader :)
    Do you have a non substance version ? with textures without needing Substance plugin ?
     
  30. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    Nope, using Substance in my pipeline has a lot of benefits.

    However, you can export the generated maps and use these directly in the shader. You can do this by selecting the Substance material instance and choosing "Export Bitmaps (original alpha channels)". This will prompt a save location and export two .tga files: StylizedWater_normal and StylizedWater_shadermap. Assign these two in the respective slots in the shader and you will not be involving Substance anymore.

    [​IMG]
    Is there any specific issue you're encountering with the Substance plugin?
     
  31. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    3,366
    It will work for a project using only few Substance materials ( less i use better it is, i don't want long game loading times because of textures generation, it was a disaster in Recore game).
     
  32. mthicke2

    mthicke2

    Joined:
    Aug 23, 2012
    Posts:
    15
    Just purchased this package. All I'm getting is a grey surface - I'm using the latest Unity version and I noticed that the instructions say 5.5 is not supported. Is this the problem?
     
  33. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    The note in the manual was regarding the Unity 5.5 beta, it works without modification in the official release. This will be removed from the manual in the next update, which I am finishing up tomorrow.

    Please contact me at contact@jonathan3d.com with any information about your project setup, so we can work out the issue you're having.
     
  34. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    New version has been submitted and will be available soon! http://u3d.as/A2R

    [​IMG]

    Added:
    - Shaders can now be modified using ShaderForge.
    - Unity 5.5 support
    - Demo scene with 30 free stylized models
    - Option to randomize seed in inspector

    Changed:
    - Improved support for Substance material instances
    - Changing materials shows/hides the new parameters automatically
    - Wave vertex offset now follows the mesh's normal direction, rather than offsetting in the world Y-axis (useful for curved surfaces)
    - Switched from glossiness to roughness type, for better results under low/no light conditions
    - Inspector GUI improvements
    - Substance will generate both texture maps regardless of "Generate all outputs" option
     
    Hans and GMax like this.
  35. Image3d

    Image3d

    Joined:
    Jun 20, 2008
    Posts:
    81
    Hi Jonny,

    Is possible to have the Intersection to work with an specific Layer ?
     
    Lars-Steenhoff likes this.
  36. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    Regarding selective objects, to my understanding that is not possible. Because the shader takes the depth texture from the main camera. So multiple cameras would have to be used, I'm not entirely sure if, or how that would work. But it would probably add more complexity to your game than desired.

    Or excluded objects would need a custom shader that excludes them from the depth buffer. But that would exclude them from any image effect that uses it too (for example fog and AO). So I'm afraid given my current knowledge and tools I won't be able to implement such a feature.
     
  37. Image3d

    Image3d

    Joined:
    Jun 20, 2008
    Posts:
    81
    Maybe I am mistaken...but I was talking about the shoreline ( the rim..) that is generated from the water intersection with the objects. I want to use the Stylized Water Shader mainly for the shoreline, but it is colliding with another water plane where we have an animated surf wave and it is generating a shoreline in the intersection of the Stylized Water plane and this surf wave plane.
     
  38. jason-fisher

    jason-fisher

    Joined:
    Mar 19, 2014
    Posts:
    132
    I don't own the asset yet but I might be interested in a solution there also. I am generating chunks of a planet and as you get closer to the surface, I plan on separating out the water into a separate meshes and using something like this. There shouldn't be any overlap with the chunks but my concern is that floating point precision issues might trigger this. It would be nice to have all water in a separate layer to keep it from interacting with itself. Alternatively, a trigger distance value vs -normal could provide a buffer against any precision issues.
     
  39. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    I could create a variant which works with vertex color, so the intersection effect can be manually painted where wanted. Would that be a viable solution for you?
     
  40. pro-bchevalier

    pro-bchevalier

    Joined:
    May 30, 2013
    Posts:
    43
    Hello @Jonny10 would you consider adding lightmaps support? This is for mobile :)
     
  41. Image3d

    Image3d

    Joined:
    Jun 20, 2008
    Posts:
    81
    Yes, but how are we going to paint it over the intersection effect ? It would be better if could generate I depth map image from the intersection and save it localy. Your script would have an option to use this depth map for the intersection.

    This is what some of the other water packages in the market are doing...
     
  42. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    Objects with alpha blended shaders, like this water, do not contribute to Enlighten, so lightmaps will have no effect on the water surface, unfortunately.

    This is an interesting suggestions, and warrants some R&D. I'll be sure to experiment to find a way to exclude certain objects from the intersection effect.
     
  43. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    New update submitted!

    Changed:
    - Set Substance to 'Uncompressed' by default for Mobile
    - Improved normal map blending
    - Restored light reflection to its former glory

    [​IMG]
     
  44. se

    se

    Joined:
    May 20, 2013
    Posts:
    10
    Is there any way to access earlier versions? I had a nice and narrow sun reflection the first time I tried it maybe two weeks ago, but it's gone no matter how I twiddle with the knobs.

    I also get errors like

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.EditorStyles.get_toolbarDropDown () (at C:/buildslave/unity/build/Editor/Mono/GUI/EditorStyles.cs:183)
    StylizedWaterInspector.setStyling () (at Assets/StylizedWater/Scripts/StylizedWaterInspector.cs:614)
    StylizedWaterInspector.OnEnable () (at Assets/StylizedWater/Scripts/StylizedWaterInspector.cs:94)


    which didn't happen before.
     
  45. EnAppstudioAlex

    EnAppstudioAlex

    Joined:
    Dec 1, 2015
    Posts:
    4
    Hey! I've been implementing your plugin into my webgl game. But when i try to build i get this error - `Procedural Material' could not be found. Are you missing a using directive or an assembly reference?

    If i let it take me to the error it directs me to your StylizedWater class and highlights:
    public ProceduralMaterial substance;

    It works fine when i build to any other platform... Any ideas? Is your water supposed to be supported for web builds?
     
  46. pro-bchevalier

    pro-bchevalier

    Joined:
    May 30, 2013
    Posts:
    43
  47. Jonny10

    Jonny10

    Joined:
    Feb 18, 2015
    Posts:
    150
    This is due to an oversight on my part, the last update will restore the reflections. It's currently under review and will probably be available in a few days.

    The Substance plugin is not supported on WebGL, I didn't realize this. I will add a check for this platform in the script so it won't be included in a build and you will be able to build without error.
     
  48. EnAppstudioAlex

    EnAppstudioAlex

    Joined:
    Dec 1, 2015
    Posts:
    4
    Alright! Thanks for looking into fixing it! Please tell me when WebGL builds will work :)
     
  49. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    1,069
    Would you be able to make a water shader that works well from the side as seen in ori and the blind forest?



    [​IMG]
     
    FeastSC2 and GMax like this.
  50. jason-fisher

    jason-fisher

    Joined:
    Mar 19, 2014
    Posts:
    132
    GMax likes this.