BlenderNation
It looks like you're using an ad blocker! I really need the income to keep this site running.
If you enjoy BlenderNation and you think it’s a valuable resource to the Blender community, please take a moment to read how you can support BlenderNation.

Game Engine Water Shader

Here's a GREAT water setup by Martins Upitis.

Martins writes:

This is a water shader I am working on in my spare time. The work is based on my own observations of water characteristics and written from a scratch. It is still a work in progress. Right now the water surface is a plane, but support for real geometry waves is on its way.

Due my really old computer I am currently on, I am almost unable to capture a video with decent framerate, but the shader uses simple calculations and runs very well on even 6 years old mid-end hardware.

Download the .blend here.

Note that it is a work in progress so shader code is a mess and setup is fragile.

82 Comments

    • I think this is a shader that can be used in the blender game engine, not in the rendering part of blender (cycles or BI).

  1. First i thinked: A whale. than i reallized my confusion and later an alien seeing a desaster come through: "You ... apes! Go to ...!"
    Sidenote: Disqus only shows up complete in IE not FF where i only could read the comments by viewing the HTML code.

      • Using IE 9 i can´t see what box is for the email and wich is for the name,("name" and "email" does not show up) i had to guess the firs time

    • Some adblockers (ie Ghostery) will block Disqus... Do you have anything like that running? If so, you can always choose to whitelist BlenderNation (or not) as you wish.

      • Even whitelistening/disabling and javascript from FF options was on didn't worked. They show shortly up and then disapear only sharing icons and the animated Disqus logo show up permanently. Header and footer are always shown. For the ads with only links i hadn't adblock installed. Ugh i restarted in "abgesichter Modus" secure mode? and the same happens. So now i was really risky and deaktivating avast scanner. Same.
        Using FF 13.0.1.

  2. I am more and more impressed with the bge. This looks great. I vote that the next Blender Foundation project is a bge project to showcase what it can do and incorporate this stuff like this. Anyone else agree?

    • Hellz yeah!

      I know the last Blender game project was a bit of a disaster.... but that was only when they *didn't* use the BGE. Then Pablo managed to pull something decent out in no time *by* using the BGE. What would have happened if they used the bge from the start with todays enhancements? Today, games are pulling more $ than hollywood, so really they are the main future of 3d.

      • JudeJackson on

        I'm pretty skeptical of that notion. Games have been very willing and ready to jump on new formats and distribution methods (especially downloads and streaming), whereas Hollywood's been very hesitant to jump on board (for lots of reasons, including bigger IP stakes, non tech-savvy executives, &c.). But it's still a very accessible medium, I don't think it's being supplanted by games.

    • JudeJackson on

      I wouldn't be opposed to an Open Game Project, but I don't think that's really an effort that needs large funding. There are hundreds of open source games out there already, using all different engines. I like that BGE exists, but I'd rather the same money be put into, say, features to allow improved 2D animation workflow, or project that uses highly modular character rigs and setpieces to make it easier for any old fool to jump in and make a complete movie. If there's a niche that is currently only being filled by commercial software (or crappy freeware) and still fits Blender's mission, I'd love to see it integrated.

  3. I can see the water, but the screen flickers like crazy for me, like the camera is spinning really fast... Using newest blender on Mac OS X.

  4. Wow ... runs beautifully on my new rig. Fantastic work. Definitely need a BGE project from BF next year

    • That would be awesome. My understanding is that Ton already has Mango +1 (Goosberry) decided as a feature length live action film with other Blender studio's around the world pitching in to make it happen, but I *definitely* think that the project after should be a game project. Get some of the people like Moguri, Kupoman, Martinsh, Haidme, Victor Biallbo (sorry about the spelling! XD), Mat Goles, ndee, Glenn Melenhorst and the guys who did Super Blender Galaxy and that Sonic game recently in... get them using the BGE right from the start (unlike the Crystalspace debacle last time) and I guarantee we'll see something awesome.

  5. Looks amazing although I wish you didn't keep shifting the camera around, stopping to look would have been nice. Tried running the blend file but my system isn't fast enough for it. What are the min requirements do you suppose to run this in the BGE?

  6. Andrew Curry on

    That is a fantastic demo and again highlights to me the amazing capabilities of the BGE. I've been working on a project that I'd like to try and port to the BGE but unfortunately don't have any experience at all...if anyone would like to help me please reply below :)

    Andy Curry
    Project Lead
    The Journeyman Project Tribute
    http://andyjourneyman.blogspot.com

  7. So many nice little touches, like the way the "sand" is darker around the edges of the water, like it's wet, or the way the caustics fade away the deeper you go into the water, or the way there seems to be a bit of a glow underneath objects underwater, as though the light was bouncing off the sand.

    Gorgeous.

    Now why the heck aren't we seeing this in a game? :P

  8. I'm having the same problem Sorbus mentioned above. It runs on my system but the view spins around like crazy.

  9. Really excellent. Thank you. The shader works great with Blender 2.6.3 on Windows 7 (not sure about the issues reported by Tristan D) - just make sure to look through the camera (0) before starting the game.

  10. I agree with some people here, maybe the next project may not be a game, in fact I don't think it has to be a game, but a really cool tech-demo of the actual potential of the game engine, after six months of improvements and development.

    Regards.

    • Martins Upitis on

      Hi jacklin, YouTube has video statistics button, there it shows all information including soundtrack of the video. I used AudioSwap to add a random song, it shows: artist: Rob Simonsen, song:Frozen Light

  11. Every time I try to open the blend file it crashes before I even get it open. Any ideas? I am using Blender 2.63, but I see other people have gotten it open with Blender 2.63. Could it have to do with it being a packed file? If so, what is the procedure to open it? It really looks awesome from what I saw on Youtube.

  12. @Bart, it's Martins Upitis. And damned good work Martins! I'm curious if the underwater effect is really all artistic-eye-balling or if you got some attenuation papers to base you work on (I have a good one I can send if you want). Cheers

  13. Hello there,like others I'm impressed by this piece of art.
    Congratulations and thanks to Martin!

    My experience with file:
    First;as I was anxious to see the looks I changed one of windows into 3D view-and all was -white(didn't see that separate one opened..)
    That separate window looks kind of strange to me-all is black-and with yellow conturs-not sure if thats supose to be that way..
    As I moved a mouse little to see how that one look (before starting an engine)-I realize later that is a mistake..?!?

    -starting with engine (P)-all together looked very funny-can't explain in words easilly-
    -moving with mouse or WASD-one "layer"was moving-and "main layer"-frame that you looking before starting engine-is still...
    all together mixing and brakeing one into another?!?-very strange..

    -cure is (I do not know it for know :D ),but if you do not move scene at all before starting BGE;just press P in that other window-all works fine;
    and looks beautifull!!
    I'm very happy that BGE can do such a powerfull stuff.

    ..and yes..-I'm runing AMD machine-Sapphire 6950-if that matters
    hopefully someone would repair that issue-whatever it is.

    Cheers!

  14. I have no words...this is truly stunning. And that it works in real-time is utterly amazing.

    Fantastic job.

  15. I could be wrong ,but when i use this file with build that have planet texture it run beautiful,however it won't run on current release blender or just get an gray,black screen.

  16. Excellent work.
    I agree with the concept of another game engine project from the Blender Foundation.
    If I tell people to check out Blender and they see 'Yo Frankie'....well, do I need to say more. That is not a good advertisement for Blender. Obviously, Blender is capable of so much more. I propose that a simple straightforward game be developed that showcases what the game engine is capable of. It doesn't have to be a giant game with lots of levels. Leave that sort of thing to the big companies that have teams of people working for years on a single game. We'll never make something from the Blender Foundation that can compare to that. Focus on a simple, but clever game, that plays well and looks fantastic. That would be the best advertisement.

  17. fergoblender on

    I love it. Looks so much like realistic water. Can't wait to see what it looks like with waves :D Keep up the good work!

  18. Kirill Poltavets on

    Awesome stuff! :) Thanks for sharing! I think it needs just some foam on shores and it will be looking very impressive.

  19. 'GREAT'? No. There's got to be some better adjective for this. I'm totally stunned. Nice to see some BGE action happening in Blender again. Hoping to see more of this stuff. The least I could do is comment, if only I knew how to code the 'proper' way, I'd be helping these awesome guys. :)

    -Reyn

  20. A friend and I used the engine presented at http://wtomandev.blogspot.pt/p/projects.html. When I referred him to this shader he told it is an exact copy of the water implemented in that engine and shown at http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/rendering-water-as-a-post-process-effect-r2642 with the shader made available at http://downloads.gamedev.net/features/programming/ppWaterRender/water_shader.zip. The author on the other hand says "The work is based on my own observations of water characteristics and written from a scratch."
    I have not confirmed my friend's claims but It seemed like a good idea to note this here. It doesn't seem fair to take credit for other people's work, if that is the case with the author here.

    • Martins Upitis on

      Hello Zoran, if you compare both shader codes, they are completely different. I have used existing math calculations from Snell's laws, but otherwise the code is made entirely on my own and it has been a many year process. I can see where you found similarities between Wojciech Toman's and my shader - it is in the color extinction of the water which gives this distinct color gradient based on rays travelled distance in the water volume. And it is a common technique used for volumetric fog and atmosphere rendering. Hope it clears things out a bit.

      • Hey, good work then I guess. It's funny that both of you came up with a similar implementation, especially since my friend saw 40+ water implementations and immediately associated yours with his.
        Sorry for the accusation, I did leave room for doubt though because you never know, and guess in this case I didn't.
        Good luck in your future work!

  21. Does this create splashes if we drop a cube using physics or is it just a plain shader with no physical interaction? Sorry I'm a bit confused.

  22. Gilberto Echeverria on

    Wow! There is no words to describe this. It is beyond amazing!
    I'm really excited to see this can be done in the BGE.
    Congratulations Martins! And thanks for sharing your work with the community.
    Cheers

  23. Tried it in the latest version of Blender (2.63a). Runs smoothly without problems.
    Except from some strange reflection bugs, this water looks absolutely stunning!
    Excellent work. I'd love to see it prominently featured in some tropical (pirate?) game :-)

  24. Martinsh! You are awesome!
    It reminds me OGRE's Hydrax addon.
    There are reflection errors in places where terrain touches water and reflections look squarish. Perhaps you used a low-res normalmap for them?
    And I urge everyone making BGE videos to turn antialiasing on! :)

Leave A Reply

To add a profile picture to your message, register your email address with Gravatar.com. To protect your email address, create an account on BlenderNation and log in when posting a message.

Share this story: