November 24, 2013

water/underwater & sky shader update #03

Yep, I haven`t been very active blogger lately.
I am very glad that company I am working for brought me to Amsterdam to Blender Conference this year. I even did a presentation there together with my colleague Michael Otto about GLSL shaders in Blender Game Engine. And for the presentation purposes I decided to demo my water/underwater shader there.
Just before the presentation I managed to tune up the shader and the scenery a bit.




so the changes since last update are:
- projected grid approach for the water surface (lousy implementation)
- per-vertex displacement mapping for waves
- basic but effective shoreline detection for water surface and ground
- added some subtle cloud layer and stars in the skies

yet to be done:
- fixes on inconsistencies
- better and procedural wave propagation model
- focus to underwater visuals
- better camera transition from water/underwater
- better coastline behaviors
- buoyancy (partly done)
- heavy optimization
- when it`s done, as many have requested - implement in Unity

trees are generated with tree[d] by frecle

blend file to be uploaded (have to clean and optimize the code a bit)

29 comments:

  1. Whoaaa... I am eager to discover update #04... That's really thrilling!

    ReplyDelete
    Replies
    1. :D thanks.
      btw. really awesome website and blog you have, love your works!

      Delete
    2. More than three months later, thank you very much !

      Delete
  2. this looks great, I would like to see a blend file soon. I actually think though, that version #2 has better looking wave patterns(choppier with more lateral movement). could this be implemented as a blender internal shader, or at least as a viewport glsl shader so I can render it and composite it into other renders?

    ReplyDelete
  3. Looks really great (as do all your blender works). Do you have an idea of when a blend might be available?

    ReplyDelete
  4. I LOVE the work you put into your shaders. I believe video 3 does a better job of the mid distance refraction but I do think that there is too much specularity making the water look like GEL / PLASTICky. Great job on the atmosphere. Very inspirational. I hope you continue developing and I will donate because I love BGE (Linux guy here). Keep up the great work.

    ReplyDelete
  5. Awesome shader work as usual!
    How about instead of converting it to Unity, why not make it into a module for the fully open-source Torque3D engine ( http://www.garagegames.com/products/torque-3d ). They also now have a Linux and MacOSX port soon, and with its awesome terrain editing features, this king of water and sky simulation would really be the greatest combination of open-source game dev. efforts :)

    ReplyDelete
  6. Upitis martins friend wanted to ask if I can use your water in my game you say?

    ReplyDelete
    Replies
    1. MARTINS thanks I'll teach my game like this with your water ok
      I send you a video link and facebook page and some pictures thanks
      https://www.youtube.com/watch?v=Mmviq40i6jE&list=UUdmD2jCm_Nicy38KcJtAxMA
      https://www.facebook.com/eusogames

      Delete
  7. Hello Martin,

    Very nice code. How do u created those water drops on the camera?

    Thanks,
    Leslie

    ReplyDelete
    Replies
    1. that is a GLSL shader with procedural simplex noise. Then with derivatives you can calculate the normals to displace the UV coordinates. If you need in-depth explanation feel free to ask.

      Delete
  8. Thanks Martin!
    Can you post some code in this?
    I need a little more on this :)

    Thanks

    ReplyDelete
  9. Martin I working on mobil phones. This water drop shader is very expensive on this?

    ReplyDelete
    Replies
    1. yeah it is, I would think of another way to do that on mobile phones. Maybe a pre-generated mask. and then use lower resolution texture to blend the wet parts on lens.

      Delete
  10. Martin can you lead us with the water drop effect? where we should start to achieve this effect? any paper?we need your help:)

    ReplyDelete
    Replies
    1. btw I am using unity3d. You know many people using this engine, it has million of people community but I have never seen such a talented and great people like you:) I am a greate follower of you:)

      Delete
    2. Hey hey,
      thanks :)
      I actually jut got Unity Pro to be able to create stuff for Asset Store.
      In next months I hope to recreate the water rendering system, and some of effects. Will see how it goes.

      Delete
    3. we will wait the news from you and be happy if you inform us about the news:)

      Delete
    4. Can you convert your area lights to unity also?That would be awesome��

      Delete
    5. Someone already did that, though without texture support I think:
      http://blog.mpanknin.de/?p=996

      Delete
  11. hello Martin, could you take a look at this https://www.youtube.com/watch?v=6eINQYq7akg i have problems with this scene, i made floor reflective by using your earlier method with spinning plane refraction + reflection. So i'm using only reflections with 4 texture channels reflection 0, refraction 1(disabled), normal 2, diffuse 3 and i want to have specular on the floor as well. I have tried to edit the code by adding specular to the variables and texture channels but it didn't work. Maybe i should bake specular ? and then add it to the code ? Another problem is that while using 3 cameras i can't or don't know how to set multiple objects to reflect, for example, i want my TV also reflect a room so i tried to duplicate, rename the camera and watercamera and edit the code with changed names but it didn't work as well. I know multiple reflections can be done with cube maps but i don't know how to set it ptoperly :/

    ReplyDelete
  12. Can't wait to test this. I hope so this one won't have grey or blue, unreflective and unrefractive buffer as previous ones with underater shader had for me(the one without underwater looks good, but it crashes when I leave scene with it and return to that scene again...

    ReplyDelete
  13. martin, I've got an idea- you could make an add on that allows the player to tweak the water. You could add a special material option that allows the user to switch to water(similarry like switching between internal and nodes). Also a ground water checkbox in material tab for any other materials so the user can set which areas are large and used as gorund. In water material settings you can put a section for muliple versions of water(water 0.95, water 0.99, water surface 1.1 etc.). Also include all the tweaks and some extra data(for example, water distortion lens, shiny speculars, foam etc.). I hope you have time to make this because we all would love that...;) However, could you, please, take a look at this? https://www.youtube.com/watch?v=0JZqd7wAwGc

    ReplyDelete
  14. Hi, Martin, Could you update the link?
    dropbox link crashed

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. Hello Martin, I know it's a bit of an old post, but it's so amazing, I can't find the download for this one (with sand). I download the one from Blendswap but works only once. I click P, works fine, the ESC, and P again and the controls WASD don't work any more with Blender 2.79 (downloaded today). Thanks, Sebastian

    ReplyDelete
  17. Great work! will the blend file to be uploaded? thanks!

    ReplyDelete