[Bf-committers] New filter mode for game engine

Alexander Ewering blender at instinctive.de
Tue Jan 18 21:09:51 CET 2005

I've introduced a new blending mode for faces in instinctive-blender's
game engine, and I thought I could share the (very satisfying) results:


This is a true color filter, which can be used to create, among other
things, realistic coloured glass (which is NOT possible by simply using
a coloured face and alpha).

It behaves like this:

Black is completely opaque (and black), white is completely
transparent, and for example, red is only transparent for the
red component of faces behind, and opaque (and black) for all

This acts similar to the physical behaviour of real coloured

(With alpha, you will only ever get an approximation of this
behaviour - i.e., a washed out colour).

The changes involved are very simple.

In DNA_mesh_types.h, a new define for the new mode:

#define TF_FILTER   4

In drawmesh.c, a new case for the new mode:
(Around line 220):

             else if(alphamode==TF_FILTER) {
                 glBlendFunc(GL_ZERO, GL_SRC_COLOR);

And finally in the engine, the same. Though I don't know where
to do it in the current engine, as the Material stuff has been
changed there (instinctive-blender still uses the old non-unified
material code). Here, it is in GPC_PolygonMaterial.cpp.
Just grep for TF_ALPHA.

Kester; Your new material stuff and the use of the ztransp parameter
works well. I still can't use the current game engine code though, as
it still has issues with motion and collision. Check the NaN walkthrough
demo (the one with the ugly red and green tiled floor). Player movement
is very sluggish and unpredictable.

| alexander ewering              instinctive mediaworks
| ae[@]instinctive[.]de   http://www[.]instinctive[.]de

More information about the Bf-committers mailing list