“Hola!, this is Pablo..”, that’s the first thing I say in this video that tries to explain a couple of effects I came up with the last week, playing around with shading nodes in real time.

The thing was that Mist option is still not supported in GLSL, how can I work around this?, Nodes! the great “Camera Data” is an input node that let you use information from the camera view to play with, such as the View Vector, View Z Depth, and View Distance (which is the one i’m using in this video). After playing for a while, I found out that this method was much more better than the boring Mist!

I ended up using this method for effects such as:

  • MultiColor Mist:  Color in front of the camera is more peachy, slightly noticeable, then more far away is a bit orange/red, and veery far away the color tries to mix with the sky.
  • SunRays: Just planes with a bright alpha texture, the trick is made by the View Distance factor of the camera, changing the alpha to zero when you get close to them, or far away from them (you don’t want to always see sunrays).
  • ChangeAlpha: for walking through trees leaves in a way that they don’t block the view, they have a node setup that makes them alpha zero when they get close to the camera, so you can see through.

Here the video:

Download the OGG version. (~30mb)

Nothing of this is actually new, you can do this for rendering since past year, and for GLSL is also there since weeks, so you can play with this by using any barely recent build.

* by the way, expect more videotutorials like this one (but better explained, better quality, etc), in the Apricot DVD! :)

That’s all folks! Enjoy!



48 Responses to “Blender GLSL: Shading Nodes Goodies”
  1. Pavel Siska says:

    Great :))

  2. Nice ! I wouldn’t have think about doing this with materials.

    But as far as I know, mist in real time games have 2 goals :
    1) visual
    2) reduce the number of polygons to display

    I don’t think this “trick” actually does the second point. But maybe there is a “max viewable distance” in the BGE. I don’t know about it.

  3. Hi Steren, it actually does, if you use the last color as the same as the background you can fake mist, and cut the clip of the camera speeding up the game, without seeing the popping of the meshes.

  4. huu nice effect. Is the water without shader, because you tried this out in BGE? I must say I get a little bit confused about crystal space and BGE:

    1. Will BGE be used in the end result or only for development?
    2. Will BGE be a full game engine in the future or is it dedicated to previewing features in development process?
    3. Are there constraints for things, which aren’t “possible” (not convenient) in BGE, but in Crystalspace?
    4. What are the benefits of using Crystalspace (Is it the entity layer).
    5. Will features similar to CrystalSpaces features like CEL be developed for BGE?

    I’d like to start developing a game by myself in the beginning of 2009 and I’m curious if I could (if I wanted) use BGE for creating the hole game.

    My plan is to use following components:

    1. Blender/Gimp/Inkscape for graphics/rigs/anims/levels
    2. Ogre3d as graphics engine (ogre4j).
    3. OpenAL for sound (JOAL)
    4. Not sure which physics engine I should use, yet. (with a nice java wrapper)
    5. Java for the game logic

  5. oohhh really amazing!!!!!! NODE POWER!!!

  6. Neat tricks! =)

  7. It looks great! And I thought nodes were not that important for a project…

    Anyways, I’m starting a serious game project right now -after lots of practice in Blender- and I feel quite confident that I’ll be able to manage it thanks to the improvements done to the Blender Game Engine through the Apricot Project!

    Thank you very much, guys!

    @johnny:

    The only “strong point” on CrystalSpace it’s that, being created as a Rendering Engine, it can achieve a good amount of visual effects, like reflection, shadow casting, etc…

  8. Blendiac says:

    Pablo,

    Your posts make me happy. :) Thankyou.

  9. Thank you thank you thank you for this glsl thing!!! My dreams come true.

  10. campbell says:

    @johnny:
    1. yes, final
    2. yes, enough to make a fun playable game with nice graphics and sound. “full game engine”? too vague a question. depends a lot on what you expect. but it wont be re-written or anything.
    3. yes. but that goes both ways.
    4. have not used cel enough, darisuz could answer? - I expect its more flexible.
    5. blender has states now which make developing complex logic much easier, but otherwise we are just making sure logic bricks and python api work for us. features and bug fixes are being done in both areas.

  11. WOW! I can’t believe this stuff works in real time! I thought it was super insane and was only for non-real time stuff.

    I’ve seen some pretty insane material nodes, does that mean they can all work in real time (even with 1fps)?

  12. thank you for the answers.
    @campell: your answer to 1. means yes, can be used for final result or yes it will be used for final result of the apricot project (alias “The rise of Frankie” ;) )

  13. @j: this means that they WORK in real time, and at full 60fps here (like in the video), and 88fps in an ATI card that brecht tested today :)

  14. That node mist works great, thanks for showing how it’s done.

  15. Not sure if leaves fading out when you get close to them is such a bright idea - I mean, real leaves don’t do that either… ;-)

  16. Mist with nodes… thats something I didn’t think of…

    Why don’t you apricot guys create node based: bloom effects, motion blur, etc… in game?

    Also upgraded rag dolls that use armatures would be super sweet!

  17. you guys are awesome. i have meant to comment earlier, and more often, but everything you do is wonderful. thanks for all the amazing development. ( i was just being supportive of the project at first, not having a use for the game engine. but now i am inspired, constantly. thanks! )

  18. Francisco Ortiz says:

    This video gives some awesome ideas! Very clear :) thankx for sharing.

  19. WoW - Great awesom - cant wait for the Final Blender Version that will contain all this feautures… And the Game…
    the Flytrough that you use in Edit mode… Cant wait to use it… it will make navigating so much easyer… How do you controll your flying?

  20. MatrixNAN says:

    Dude guys totally rock. Holly cow this is awesome. This game is looking so good and completely current gen for your target platform audience. I can’t believe you have node based GLSL shading working already. That is so fast. I am flipping out how fast you guys are working. I check this page everyday.

    If possible could you change the logic system on the graphical end to be more like the node based shading system. Like Kismet in Unreal Engine 3. By this I mean not changing the nodes but the way you can connect them and set them up into node modules. It would be good if we could do array variables or lists variables allowing assigning logic systems to a whole number of objects instead of setting up the same logic systems over and over for each new object. You guys are awesome.

    Cheers,
    Nate Nesler

  21. Very cool effect. It would be great if you also could fix the problem with vertex deformation and reload of the “physik mesh” of bullet physik engine.

    I mean this problem (from GameLogic API):
    Note: The physics simulation is NOT currently updated - physics will not respond to changes in the vertex position.

    Class KX_VertexProxy

  22. wow.. very clever use.. and I just assumed we couldn’t use the camera node.. tut tut. Thanks for the cool vid tut!!

  23. * by the way, expect more videotutorials like this one (but better explained, better quality, etc), in the Apricot DVD! :)

  24. @15 Remember the camera is floating about a meter behind the character. So from 1st person you wouldn’t see those leaves anyway.

  25. @ RH2: motion blur with nodes? you mean composition nodes? they don’t work in real time (yet!..?)

  26. johny:
    >1. Will BGE be used in the end result or only for development?

    We use both BGE and Crystal Space+CEL+B2CS+Blender now.

    3. Are there constraints for things, which aren’t “possible” (not convenient) in BGE, but in Crystalspace?

    Crystal Space is a huge project. You can use C++, Perl, Java, Python, XML. Supports a lot of things, big worlds, etc. Too many things to describe in comment - see http://www.crystalspace3d.org about engine details.

    4. What are the benefits of using Crystal Space (Is it the entity layer).

    I’m not BGE specialist so it’s hard to compare it for me. But yes - probably Entities is that cool thing. Crystal Entity Layer is what convince me to using CS and makes Crystal Space different from other solutions. CEL has set of ready to use components like actors, cameras, projectiles, neural networks, path finding, even cars and hovers, so it’s really cool concept.

  27. I’m a bit confused as to Crystal Space vs. Blender… there’s lots of contradicting posts, and nobody seems to be able to clear it up… I guess it’s a surprise until the end and nobody in the team really knows what the final outcome will be, either ;)

  28. Alexander, sorry if we don’t make it clear, but we have all clear here, there will be an official word/blogpost soon to clarify this.

  29. cool !! and also, I build the apricot branch today and finaly the demo works with my ATI X700 with 40fps…
    only there is some problem with the way it interpret the glsl colors : I got a white circle around the spot light and funny “LSD” colors effect in the demo on all objects : image here : http://tinyurl.com/6yfwuu

  30. Tomorrow another production update yeah… but to be as clear as possible; we use both CS as Blender GE here for delivering Apricot results!

  31. OH MY GOD!
    El textured mode te funciona en realtime?!?!?!?!
    Yo ni con un cubo puedo…
    (radeon 9200 pro family)
    What graphic card do tou use?

  32. I have an ATi x1800xi. I get an ugly green color or strange artifacts. I know there have been tons of ATi issues in the past, but I am hoping that it is just this Graphicall build that is the problem. I really want to try this!

  33. It’s a cool game. (Sorry for the previous post)

  34. @ jairo: si! funca en textured mode, en realtime, fijate que tu placa soporte opengl2.
    The graphics card in my computer (the one used for the demo) is GeForce 8800GTS 640mb.

    @ Bmud & Olm-Z: we have an ATi card here since a few days so optimizations (and fixes) will be done for this.

  35. Woah! Pretty cool stuff. This
    is getting better and better, good work guys!

    Btw: is that FEZ from that 70’s show commenting? ;)

  36. @ JoOngle: Fez? thanks! as a That 70’s Show fan I can say his english at least is correct (sometimes : ), unlike mine.

  37. @venomgfx

    Sorry ;) I couldn’t help myself, I thought it was somewhat charming and the voice really is very close ;)

    Anyway - awesome work!

  38. AMAZING! When i first heard about the combination of CS I was afraid that the logic block would be a thing of the past but its not so I’m happy also a really quick question for the v-man (venom) how is this gonna play on regular CPU’s like ones with out the impressive CPU’s and GPU’s you have, I have a AMD Althon x-2 2.4 GHz and no GPU and my facecount cant go past 20k in 3D mode (around like 30-40 in game since polygons get transformed to tris), I know thers that shiney new texture limiter but that can only do so much (but it still is a blessing) is there gonna be a new feature not told to us like a LOD or a control of options?

  39. How do I get this “Purple Blender?”
    If it hasn’t came out, when can I get it? PLEASE Help.

  40. @Killian: Enter http://venomgfx.com.ar/misc.php , at the end of the paga, there is the theme… (con permiso de pablo :P)
    @Venom: Gracias por responder. He investigado y mi tarjeta es del 2003 y quedó mas anticuada que…bueno, anticuada…
    Ah! y perdon por el extraño espanglish de mi post anterior XD
    Bueno, chao

  41. Two Things… Does it have real time shadows in the game engine, and will it work on my Mac?

  42. Also do you happen to know how to export a rendered animation to a quicktime file, and save the runtime of a game all on a Mac?

  43. AnakLelakiLaut says:

    you are genius!

  44. @ Killian, yes Real Time shadows as you can see in the demo. (only frankie). and yes, they will work cross-platform (linux, mac, win), according to your graphic card capabilities.

    @ OldJim, sorry for the late answer, the fly mode can be found already in Blender 2.46, with Shift + F in object mode, check the header of the 3dview for controls.

  45. I Haven`T this Blender game engine GLSL button_________please help me !!!!!!!!!!!!!!!!!!!!!!

  46. where i can get ur blender please I`m working on a FPS game, I would render my M4 carabine here a link off my M4 http://files.filefront.com/M4blend/;11196629;/file please help me

  47. Also, again, how can I export Render’s into movies like quicktime formats?

  48. …And could you give me step by step instructions for installing B.blend in the right place on my computer?

Leave a Reply