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

81

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.

Share.
  • Kriss Berzkalns

    Great water shader, really improves BGE! I am pretty sure his name is Martins Upitis :)

  • chadwick

    Nice,

    can we port this to regular blender { BI } also?

    • bramvito

      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).

  • Kevin

    "plz be blender,plz be blender...YAYYYY!"

    Nice work :)

  • http://twitter.com/m13253 ???

    Beautiful!

  • lexi

    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.

    • http://www.blendernation.com Bart Veldhuizen

      It should work i FF. Did you happen to disable Javascript maybe?

      • Guest

        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

    • Blendiac

      I'm reading (and replying) to this in ff16...

    • Blendiac

      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.

      • lexi

        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.

        • http://www.blendernation.com Bart Veldhuizen

          Maybe you should contact Disqus support about this; other people have no issues so I really don't have a clue..

          • Guest

            Just weighing in, FF 14.0 works like a charm. :)

          • Daniel

            I'm still using FF 3.6.

          • lexi

            Stupid me had once set sendRefererHeader in About:Config to 0. That was it. But now as the paint dried up i could get out of my corner and leave that room trough the door.

  • Riptyde

    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?

    • Blendiac

      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

        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.

    • http://www.facebook.com/alkalis David Alkalis Franjau

      go for it !

    • JudeJackson

      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.

  • Sorbus

    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.

    • Sorbus

      Followed RossBlenderArt's tip above. Using 2.63a solved problem for me.

  • daniel

    Looks super! Now only some foam at the water borders (beach) or smooth blending of the water.

  • jiggles100

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

    • Blendiac

      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.

  • Shamusboy

    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?

  • Darius B.

    That's so awesome...
    Is a Blender internal Version planned?

  • http://www.facebook.com/joaclinti Joaclint Istgud

    Incredible!!!. Congratulations. I will be waiting for more...
    Thanks

  • Andrew Curry

    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

  • greylica

    Wow, it's running here 1900 X 1200 flawlessly in GTX 285 ! Incredible ! Thanks Martin Supitis !

  • Blendiac

    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

    • RossBlenderArt

      It will be in his game, or so he says. :)

  • Tristan D

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

    • Tristan D

      Oh, it works with 2.62 for me but not 2.63. Is it supposed to work with 2.63?
      Anyway, awesome shader! The BGE is really moving up!

      • Guest

        I can't get it working with either. 2.63 it's all black, 2.62 it's all gray. :/

        • Tristan D

          Try 2.63a as RossBlenderArt says above.

    • http://www.facebook.com/alkalis David Alkalis Franjau

      +1 :/

    • RossBlenderArt

      Use 2.63a, there was a rotation bug in the game engine in 2.63.

      • Sorbus

        Thanks!

      • Tristan D

        That did the trick, thanks!

  • educos

    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.

  • Mataii

    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.

  • http://www.facebook.com/lorenzwellmer Lorenz Wellmer

    HOLY SHIT!!! This looks EPIC!

  • jacklin

    whats the background music? the name of the piece?

    • Martins Upitis

      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

  • ryanjohnsond

    are you using the blender game engine for your shader? What did you write your shader in?

    • Chaos

      please, download the blend. don't be a lammer...

  • Vickie

    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.

    • Chaos

      and what about 2.63a?

  • Voodoo Doctor

    That is beautiful... absolutely stunning. I love the fractals in the water.

    • Voodoo Doctor

      Correction: caustics in the water.

  • Sinan

    Thanks!

  • http://www.facebook.com/niklas.holmberg Niklas Holmberg

    Great work. I am impressed for real.

  • http://www.facebook.com/paul.tschirgi Paul Tschirgi

    Damn! How much to incorporate it into my game!? haha AMAZING WORK!

  • http://twitter.com/dfelinto Dalai Felinto

    @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

    • http://www.blendernation.com Bart Veldhuizen

      Thanks Dalai! I've updated the article.

  • Vorda

    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!

    • Vorda

      I forgot---I'm runing Blender 2.63.0 r46461:46487M...if it matters..:D

  • Olaf

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

    Fantastic job.

  • rnsierra

    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.

  • Sebastian Erler

    Simply beautiful! Can't stop walking around the scene and watching the watersurface :)

  • J Fraser Macdonald

    This is amazing. What a talented guy!

  • http://twitter.com/DramaKing19 David Stringham

    Looking good, Martins. I'm looking forward to playing around with this.

  • picco

    This is awesome! OMG Great work!

  • Rza

    EXCELLENT! YOU ARE GENIUS! I am very happy to see this water shader in blender!

  • Terrachild

    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.

  • Tony Slacik

    +Riptide
    I do! This was amazing!

  • fergoblender

    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!

  • Kirill Poltavets

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

  • http://twitter.com/reynantem Reynante Martinez

    '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

  • Zoran Vitez

    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

      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.

      • Zoran Vitez

        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!

        • young_voter

          good recovery

  • Gunguos

    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.

  • Gilberto Echeverria

    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

  • http://www.facebook.com/people/Victor-van-Schagen/100003139261267 Victor van Schagen

    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 :-)

  • grzesiek3e6

    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! :)

  • Noah

    Amazing! Just wondering how to move the sun?

  • Joseph Miles

    FUZZY BUNNY! This is absolutely amazing! Extremely helpful too!

  • http://www.evolutionmastering.com Jonathan

    Amazing stuff mate, well done

Share.
7ads6x98y