Search Unity

Aubergines Water Shaders

Discussion in 'Assets and Asset Store' started by aubergine, Dec 2, 2012.

  1. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,294
    Still hoping for that feature.
     
  2. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    I made it work with shader model 3.0 but the waves look ugly at the moment. Need to improve it so i cant promise a definite time to release it yet.
     
  3. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    Just submitted the new update of v1.2 which includes a bonus pack for pro licence owners.
    *There are 2 double sided water shaders which support specular highlights both from above and below.
    *Shallow and depth colors can be calculated via a mask texture.
    *Water transition from above to below as well as reflections/refractions and fog is controlled by a watermanager script.
    *There is an image effect to enhance illusion of underwater like rippling and wiggling.
    *There also is a special terrain shader which uses bumpmaps for 4 splats, but the 4 splat is also used for animated caustic images. So, if you want ou can use the 4th splat on underwater terrains, which is also going to animate caustics.

    Its not easy to setup this bonus pack, it takes alittle work on your side. And this is a bonus pack, so i wont support it or update it.

    Oh, by the way this update brings a price increase. So if you havent bought it yet, you should hurry before the package is accepted.
     
  4. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    new update is live in the store.
    Keep in mind that the bonus terrain shader is not compatible with Unity 4 and its only meant for unity 3.x
     
  5. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    Very nice water shader. How's performance?
     
  6. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    There is 10-12 shaders in the pack for every situation. Performance is variable but the heaviest shader runs smooth enough that you shouldnt worry about.

    All my products are most optimised for the purpose.
     
  7. mattSydney

    mattSydney

    Joined:
    Nov 10, 2011
    Posts:
    171
    Cool looking water

    Which one would you recommend for water on mobile or are they not suited to that, any tips on shader settings to improve performance?

    so far

    iphone 4 g - no good 3fps
    iphone ipad 1 - no good 5fps
    iphone ipad 3 - almost ! but not quite quick enough for game as 22fps, 45fps without water shader
     
    Last edited: Feb 22, 2013
  8. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    Sorry i missed your post and only just saw it.

    For mobile gadgets, you should only use cubemapped, no alpha, no mask, no flow map shaders if your scene is already crowded and is not a simple game. With alittle texture work, they would look the same as the more feature rich versions.
    One more thing, if you have some shader knowledge, i have added 5 different fresnel term calculations in each shader and only one is active(the most expensive one), you can try others and they surely will gain some speed but lose some realism on fresnel but noone will care or notice on mobile screens.
    Also, some shaders have same smiliarity but "FAST" tag, try to use those, although the non-compiled shaders seem heavier, after compilation they are faster and requires less gpu.

    EDIT: Ive to mention again, if you have some shader knowledge, you will see all shaders have modular design that you can easily remove unwanted features from any shader and make your own, just check the codes.
     
  9. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Hi, I found an issue on the mobile. The cube map reflection are wrong if the scale of the water is big. Emailed you screenshots
     
  10. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    As i mentioned in my mail;

    According to the photos, i nderstand that you are trying in unity remote. This will give you such results because of texture compression. Try to publish to apk(for android, i dont know what it is for ios) and then try it on the actual mobile gadget.

    One important aspect is, make sure your normal map is marked as "normal map" after switching platforms.
    Another important thing is, while scaling the plane mesh also adjust your normal maps tiling suitable to the scale value.

    Also, not relevant but dont use unity provided plane mesh, use a custom one with 4 vertices instead.

    If all fails, open the relevant shader, and change this line;
    into;
     
  11. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    I have decided to update the package with more mobile friendly shaders.
    Here is the most basic water with 1 water texture + 1 bump map (used for fake distortions) + shallow and deep water colors + correct and cheap fresnel calculation.
    This can be used as lake water or ocean water, water texture defines which one.

    This is as simple as it gets and still keeps enough fancy visuals.

     
    Last edited: May 23, 2013
  12. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Does this fixed the issue I reported? Also , can you please update this in your shader pack
     
  13. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    I am still working on the issue you mentioned, that is a very odd one and i couldnt find out why it happens yet.
    I am updating the pack with new shaders for mobile usage as some more people mentioned that they are abit slow, and i am also adding flow variations.
    Obviously i will add it to shader pack as well.
     
  14. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    New update is ready and im just polishing around.
    This will be a major update,
    1- Removed math fresnel calculations and replaced with cheaper texture lookups for mobile
    2- Refractions are now done with a 2d texture(ocean/lake bottom, tiled or 1 big texture) for mobile
    3- Added specular for 1 directional light to all shaders(There are options to remove them as well)
    4- Everything is calculated in object space now to avoid extra math operations as optimisation
    5- Added 1 super shader that includes double sided, specular, shallow/deep water, flow mapped, foam mapped, transcluent/SSS water shader(like in assassins creed water) as a request from a customer.
    6- Added 1 dirty/foggy river water shader (like in left 4 dead series)

    Im planning 1 more shader with rain water drops(as seen in skyrim water visible in some caves) for a future update.

    If you have any extra requests, please let me know before i push this on the assetstore.

    EDIT: This update brings a major price increase as well.
    Also i would like to know what you guys would think if i release it as compiled shaders rather than source files.
    Reason is, lately i noticed people copying some of my assets and releasing again in assetstore and i think assetstore doesnt realise this and/or has no policy against it.
     
    Last edited: Jun 7, 2013
  15. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,294
    I would like to see an underwater shader for mobile in this package.
     
  16. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    I can do an underwater shader, but for the purposes of this pack it can only be the water mesh shader itself. If you mean the bluriness of the whole underwater scene, some ripples on the floor, caustics, bubbles..etc it is a subject of a whole new pack.

    Can you use the bonus shader and custom terrain shader?
     
  17. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Is the water issue I reported two weeks ago fixed ? I hope so.

    Please don't released compiled, i prefer source. People can also release your compiled shader so you are not really protecting anything, only pissing off customers.
     
  18. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    Sorry missed your post and just noticed.
    You are right, i will keep releasing the sources for all my products. Hope people will appreciate it.

    Also sorry again it took a while for this update. But i wanted to also include the flow painter and just finished it. Needs some polishing on the gui part now and luckly we have an upcoming holidays here and this is what im going to work on.

    Here is what the flow painter looks like:


    Good thing is, you paint directly on Mesh, not on an image. So this is going to be very accurate and will require much less work for your end.

    EDIT: Ignore the painting color thing in the gui, i just forgot it there and its not used.
     
  19. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    Long time no news, so here is an update on the status.
    Im still working on optimisations and making sure its all bug-free.

    I managed to triple the frame rates though. So, that should be enough i will update the pack this week with Unity 4.1.5, so if you want to make a copy of the old shaders, i suggest you do now.
     
  20. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    Just submitted the new V2.0 package to the assetstore with Unity 4.1.5 version.
    This is a complete rewrite of everything, so you might want to make a backup copy of the old shaders if you want to keep them.

    *Now includes a "FlowMap Painter" to easily paint on meshes for accuracy.

    I now am working on the 2.1 update with bonus double sided shader with terrain caustics and underwater image effect(This shader is for PRO only).
     
  21. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    New update is accepted and live on the store.

    Dont forget to delete old package before importing this new one.
    Also watch the tutorial video for flowmap painter.
     
  22. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Is the water issue fixed?
     
  23. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    Yep.
     
  24. Games-Foundry

    Games-Foundry

    Joined:
    May 19, 2011
    Posts:
    632
    Do you have a webplayer of this up?
     
  25. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    No webplayers anymore, i may put a video though. And that shader is not in the pack yet but here is a photo of a double sided, specular, shallow/deep water, foam, transcluent water shader. Photo is from the pro version.

    In this shader, refractions and reflections as well as foam and fresnel term is calculated according to vertex animated wave heights. There is also a non wavy version for lakes and rivers.
     

    Attached Files:

    • $1.jpg
      $1.jpg
      File size:
      192.3 KB
      Views:
      1,006
  26. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    Here is a video of the new shaders, sorry about the poor quality.

    [video=youtube_share;fTJp7Sxgi48]http://youtu.be/fTJp7Sxgi48
     
  27. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Can you please update the main shader pack too.
     
  28. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    Updating the Shader Pack is not easy, there are way too many shaders in there and im not using 3.5.7 anymore. So, i will have to update all individual packs first and then update the shader pack itself.
    It will take some time.
     
  29. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    I will also add this raindrops shader as bonus. This is done via texture bombing and is animated.

    This is used in Skyrim the game inside cave waters.
     

    Attached Files:

    • $1.jpg
      $1.jpg
      File size:
      31 KB
      Views:
      1,044
  30. Casto

    Casto

    Joined:
    Aug 14, 2013
    Posts:
    44
    Hi,

    I'm currently using water4 in my project but I have some troubles with it and I'm planning to buy your asset, but I'd like to be sure I won't get the same problem with your water shaders.

    My problem occurs when I use several cameras in my scene. The main camera is displaying everything from 0.01 to 500 (clipping plane) and has clear flags to "depth only", with depth of 0. My second camera is there just to render far away objects like clouds in the sky, and has clear flags to "skybox", with a depth of -50. This works perfectly.
    But as soon as I add the water4 prefab to the scene, it creates its own camera (rendering to a texture). I don't know why, but this makes the background not being cleared properly (see the screenshot below).

    $Sans titre.png


    So, I would like to be sure I won't get any trouble if I use your shaders in a scene where there are multiple cameras.

    Thanks in advance!
     
  31. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    If you want realtime reflections/refractions, same thing will happen with my packs pro shaders as well. Cube reflected scenes will work.
    Thing is, if you are happy with water4, then you can easily fix it. Just check the code for water script and you will see how the reflection and refraction cameras are created.(They are copied from the main camera with some properties changed) So, create them as how you want.

    Now the question is, why would you need 2 cameras for rendering the same scene twice? I dont understand that.
     
  32. Casto

    Casto

    Joined:
    Aug 14, 2013
    Posts:
    44
    Thank you for your honest reply. I will check water4's code then. What would your shaders give that water4 doesn't have?

    I need several camera because I'm generating the terrain dynamically during the game, and I don't want the player to see the terrain being build in front of him, that's why I need the main camera to have a far clipping plane of 500 (the terrain is being build at about 540). My second camera is here to render only weather effects and the sky (with clouds, etc.), and so need a bigger far clipping plane.
    Also, I will probably need one more camera to render only the weapon of my player as I'm making a FPS.
     
  33. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    (Can be used as lake, ocean, river, pool)Variation, simplicity, (in some cases)better and faster visuals, flow map support(with editor to paint right on top of meshes in scene)
    Also there is a bonus setup doing both above and under water rendering in one pass with correct speculars, reflections/refractions which has an image effect and fog controller aaand caustics(which is not in the pack yet).

    Too many cameras, you are doing something wrong there.
     
  34. Casto

    Casto

    Joined:
    Aug 14, 2013
    Posts:
    44
    Thanks!

    Caustics is made to render rain impacts on water right? Will it be available soon?
    Also, does your system automatically creates its camera like water4 does?
     
  35. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    Caustics is the light rays distorted and projected on the bottom of water surfaces. You can see it in pools or shallow rivers/lakes and clean sea mostly.
    Rain drops is something else, and it will be in the next update.
     
  36. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    Just submitted 2.1 update with;
    *transparent variations for Unity Free users.
    *Mask image transparency to smooth shores for PRO users.
    *New and improved Bonus setup with correct double sided lighting, waves, underwater image effects...etc.

    I think caustics cant be done genericly to fit everyones needs. So, if you want caustics on your underwater terrain parts, just let me know through the email provided in readme file and i will write you a custom one for your situation.
     
  37. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
  38. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
  39. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
  40. sgtkoolaid

    sgtkoolaid

    Joined:
    May 11, 2010
    Posts:
    899
    seems I can't update 1.1 it keeps saying waiting for server. doesn't happen to anything else. what gives?
     
  41. sgtkoolaid

    sgtkoolaid

    Joined:
    May 11, 2010
    Posts:
    899
    never mind, I found out the reason. disregard.
     
  42. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    There will be a new update next week, some folder structure will change with additional stuff.
    If you are not in a hurry, i suggest to wait for next weeks update to insert in a big project so you wont have to deal with setting up again.
     
  43. BooBi

    BooBi

    Joined:
    Jan 18, 2010
    Posts:
    534
    Does aubergine water support linear color space?
     
  44. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    Water shaders have their own lighting/specular system which doesnt rely on surface shaders or the lighting functions. And the outcome is always between 0-1 range already.

    Thanks for reminding though, im already working on the next update now with additional features.
     
  45. BooBi

    BooBi

    Joined:
    Jan 18, 2010
    Posts:
    534
    Hi I'm not sure I understand sorry, is it working now or are you working on the linear color space now? I've seen that the tasharen water doesn't work in linear and I'm looking for water for a pool and that could be also used for a sea. Yours seems perfect, the only thing is the linear color space it has to work with it as I'm working with the marmoset skyshop system.

    Thanks a lot for your help
     
  46. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    What i mean is, yes it already works in gamma and/or linear space. The reason is im not using surface shaders or unity provided lighting stuff. The shaders have their own specular/lighting calculations and the outcome is always in 0-1 range.

    One problem is, if you use forexample standart unity skybox shader, the outcome will differ on the skybox or any other object and it will effect the water color because it gets its color from reflections and surrounding.
    Attached you can see a photo of comparison.

    EDIT: As you see the greenish color of the water turns grayish because of the changes on the skybox.
     

    Attached Files:

    Last edited: May 6, 2014
  47. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    Im working on the next update.
    Here is a new feature for the pro double sided water, underwater light shafts.
    Much better when animated obviously.
     

    Attached Files:

    • $wat.jpg
      $wat.jpg
      File size:
      39.3 KB
      Views:
      800
  48. sfaok

    sfaok

    Joined:
    Nov 27, 2012
    Posts:
    23
    Hi - I'm getting some nice results with your shaders for an underwater scene but I have a couple of questions:

    1. For the medium quality shaders I'm 'fixing' the shader for underwater by flipping the y normal (normalW.y *= -1); This produces nice results but I'm wondering if there's anything else I could do to improve it?

    2. When running the pro shaders, the reflected image flickers objects (and sections of the terrain) on and off depending on camera position and camera angle, like the culling system is malfunctioning or something. Any idea what could cause this or how I could fix?

    Thanks
     
  49. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    Yolu should change the view.y not the normal.
    Check the Bonus duble sided shader anda script to see how its done.

    Flickering only should happen in editor not the final Build. Anyways i have Updated the package adressing the issue and some improvements.
     
  50. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    Finished the update and will submit it in a few days.
    Meanwhile, let me know if you have any suggestions or features you want added.