Planar reflections in the BGE

After some request about reflection in the Blender Game Engine (BGE) I decided to write a small post about it.

There are three techniques to achieve this effect in the BGE, as far as I know, which are listed below:

  • Shader based (fragment viewport coordinates – GPU expensive)
  • Render to texture (with texture.ImageMirror() )
  • Duplicated and mirrored geometry
So, lets have a look on each method.

Shader based reflections is the method that modern game engines uses to render planar reflections. Martinsh has developed a demo in the BGE that uses fragment viewport coordinates instead geometry UV map , wich according to his description  the reflecting surface size can be unlimited with this method, but take into account that you will need a decent Video Card to run this.

Here is the link to the Blenderartist forums where you can see the Martinsh post about this, with videos and sample files.


Render to texture  module allows us to manipulate textures during the game.

Several sources for texture are possible: video files, image files, video capture, memory buffer, camera render or a mix of that.

The video and image files can be loaded from the internet using an URL instead of a file name.

In addition, you can apply filters on the images before sending them to the GPU, allowing video effect: blue screen, color band, gray, normal map.

bge.texture uses FFmpeg to load images and videos. All the formats and codecs that FFmpeg supports are supported by this module, including but not limited to:

  •  AVI
  •  Ogg
  •  Xvid
  •  Theora
  •  dv1394 camera
  •  video4linux capture card (this includes many webcams)
  •  videoForWindows capture card (this includes many webcams)
  •  JPG

(source & more info)

And watch this video and read the description inthe youtube page (thanks maykon!)

Monster (BlenderArtist forum member) has developed a more friendly module that allow us to manage more easily the video texture module, grab the blend file here with demo and have a look.

More tutorials about this here:

Video Texture ImageMirror: flip

Render to Texture


And the last method is by duplicating geometry and mirroring as simple as that, maybe is not the most fancy method but I think is widely used in mobile platforms due to hardware restrictions and optimizations.

fake_reflections

Grab sample file here

Hope you fin this useful, thanks!

“Need to Knows” about Game Design by Dr. Lewis Pulsipher

Just found this and I thought it would be more a “must know” rather a “interesting” topic for those guys who want to be game designers, and want to make it for a living.

Some points to consider, check the link below to see for yourself!

“Need to Knows” about Game Designby Dr. Lewis Pulsipher

Adding 2DFilters in the BGE

I recieve a request in my youtube channel to make a video showing off how to add Filter 2D in the BGE, although this kind of stuff might sound a bit easy for many people, maybe is not for newcomer people.

On the video you will see that I usually copy the “filter 2d” code from a txt file and then I paste to a text file in the blender text editor, then add a proper name and that’s it, you have a 2d filter, unassigned but you have it there. And of course you can add it from the File/open menu in the same text editor if you already have it as a txt file in your hard drive.

Here is a sample Filter 2D you can use, in case you don’t have one.

If need some more 2d Filters, look for it in the blenderartist forums, or get ir from this sample file

Once getting this file, you can get the 2d filters by opening the file and going to the text editor and copy the code, or by merging them / append into your blend file.

And do not forget the default filters there!

2dfilters

Hope it helps!

Enemy Patrol with Logic Bricks – Blender

Here is a simple example I did to teach some college internship students at work, it was meant to teach them the basis regarding logic bricks and the state machine in blender in a very basic way.

Blend file here

This example was done with three (invisible) points, that represents the red area, wich is protected by “the red enemy“, and if you “the blue player” get into the red area, the enemy will face you and chase you, and if get too close to you (in the red player’s sight area) then it will shoot you, even if you are no longer in the red area…so, very simple, but enough for the newcomers.

And here is the  “game test” that one of them did at the end of the course.

 

Not the nicest video capture (it was recorded with my smartphone ..) but that was one of the students result :)

patrol

FPS template mini tutorial – Blender

This is a small tutorial for the people who are new to the Blender game engine but willing to learn the basis in the BGE. Here you will see how to set-up your First Person Shooter template using logic bricks in blender, wich means no coding.

I'm assuming you already known some blender basis, like object transformation (move, rotate, scale), etc.

Be aware that at this moment the actuator has some issues regarding screen resolution, this cause some malfunction with movements in “X” axis on screen, so at this time I thinks is not very usable.

I’ve wrote about this here.

Grab the blend file here

You can find a more elaborated explanation here,  and another example clicking here.

Feel free to comment if you need to :) FPSMTB

FPS Template – blend file download

Some people have asked me about the FPS test I did some time ago (that was some weeks ago, sorry for that!) so, here is it.

This is the blend test I did, in case you missed it:

And the blend file is here

Please take into account that the mouse actuator (look mode) has a bug that makes it behave a little weird at high resolution or when compiled. So, I use to execute the game test inside blender, but not in full screen (I mean, not in viewport maximized) in order to work properly.

And sorry for the mess, it was intended to be only a mouse actuator test.

The other scene contains the billboard planes that act like mist, as a overlay scene, so this way I avoid the overlapping look with the plane-objects. Maybe with a python script would work better, but again, it was just a test.

To see how it works just look arround, and for the 2DFilters and scene overlay, select the object “ammo&clip” (that red rectangle background area where are the ammo, clip and grenades -yep, it is a mess, shame on me..) to see the logic brinks that manage that.

Thanks!, hope you find this useful.

godRays

Reviewing Mouse Actuator in Blender

MouseAct

If you are a Blender Game Engine (BGE) enthusiast, you may have noticed in the past releases the inclusion of the new Look mode in  the “Mouse Actuator“. This new mode is going to be really useful if you are new to python coding and need a way to create your own FPS template,just like the classic Quake or DOOM camera style template without code, just by linking some logic bricks. Continue reading Reviewing Mouse Actuator in Blender

%d bloggers like this: