UPBGEĀ Documentation



Real-time cube maps

Realtime cube maps are used to reproduce dynamic reflections of an object by rendering the scene from its position in six faces of a cube map.
The real-time cube map requests to use an exisiting texture with a proper size for cube maps. The image is used in a new environment texture sub type named Realtime. The UI of this sub type is mostly the same as the type Animated:

The only options added are the Auto Update, which allow the user to disard update other than in the first frame. And the option Filtering, which specify the texture filtering method used. The list is:

Mipmap Filtering call a regeneration of all the mipmaps every render. Linear Filtering simply use a texture filtering without mipmaps. And None set none filtering or mipmaps.

Examples of realtime cube maps usages:

Real-time cube maps are also exposing a python proxy class named KX_CubeMap.
The cube map is accessed from a material texture with:


The KX_CubeMap class exposes the same attributes than in the UI:

Excepted for the attribut:

It enables or not the rendering even if KX_CubeMap.autoUpdate is to true.

And the function:

This function calls to render the real-time cube map for the next frame when KX_CubeMap.autoUpdate is to false.

Video Tutorial

See also: KX_CubeMap and BL_Texture

Percentage closer filtering shadow

Percentage closer filtering (PCF) is a shadow graphic technic which average multiple samples of a shadow map with a small gap.
This technic allow to made soft edge of hard shadow, but it don't replace variance shadow mapping (VSM).

PCF is a filtering technic requiring a render with a simple shadow map. Two filtering modes for simple shadows are exposed: PCF and PCF Early Bail. The first mode is the regular PCF algorithm. The second mode is the PCF with a optimization which consists in discarding sampling when the four first samples are of the same value. It reduces render time but can create some artifacts in shadow edge cut.

The options related to PCF and PCF Early Bail exposed in the UI are:

Samples, the number of samples in heigh and width, equal to the squared root of the total samples count. Soft the gap between samples depending of the shadow map size.

For example a shadow without PCF looks like:

With PCF, samples to 4 and soft to 0.3:

With samples to 16 and soft to 1.0:

Soft particle

Soft particle (or Depth transparency) is a graphic technique used to avoid geometry cut between transparency meshes and opaque meshes. It simply multiply the transparency depending of the depth to the closest surface.

The UI is the following:

The option Depth Transparency enables the special render. Depth Factor is the influence of the depth in the transparency.

Without depth transparency the render is:

With depth transparency and a factor of 0.2:

With a factor of 5.0:

New joystick support

The joystick management was refactored. This refactor allow to keep compatibility between joystickS for the buttons name and axis.
But the compatibility with previous joystick sensor is broken. The UI of this sensor is now:

As the buttons now had a name, the button index is removed to a list of buttons. The list is:

The event types handled for joysticks are mostly the same as before:

In the same way, the refactor implement the auto detection of removed and added joystick at runtime.

Joystick vibration

Joystick vibration is a very simple effect send to the joystick to rumble. The effect is send through an actuator and takes two parameters:
Strength, an arbitrary value between 0 and 1. Duration, the duration of the effect in ms.

The UI of the vibration actuator is:

Geometry shaders

Geometry shader allows the user to set a custom program alterating the geometry of a renders mesh by adding, removing, ect... vertices.
The geometry shader (or program) is sent to an instance of BL_Shader to a new function used to send programs:

Where sources is a python dictionnary containing all the programs for the keys vertex, fragment and geometry corresponding to the program prefixed the same.

For example:
sources = {
"vertex" : vertexProgram,
"fragment" : fragmentProgram,
"geometry" : geometryProgram
BL_Shader.setSourceList(sources, apply)

See also: BL_Shader.setSourceList

Off screen render

Off screen rendering consists in render the scene directly to a off screen (FBO with color texture and depth texture) and at the frame end render the off screen to screen. Internally a lot of things are improved and simplified like the 2d filters, render textures and soft particles.

From the user point of view, two things changed in the UI:

The option AA Samples is the same as standalone player, but doesn't request to restart blender.

The HDR option is to control the image format of the off screen. None is GL_RGBA8, Half GL_RGBA_16F and Full GL_RGBA_32F.

As render to texture is now obligated to use an off screen. The python OffScreen class was removed in the purpose of multiple arguments in the ImageRender and ImageMirror constructor.

The constructors are now:
ImageRender(scene, camera, width, height, samples)
ImageMirror(scene, observer, mirror, material=0, width, height, samples)

The arguments width, height and samples are optional.

Variable vertex memory size

A new system with template vertex class is used internally. This system allows to reduce memory usage by reducing the number of UV layers used, in the same way the mesh transformation are optimized. The only side effect in the user point of view is that he will not acces anymore to an inexisting uv layer from the KX_VertexProxy python class.

Per material storage settings

The user is now able to set a rendering storage per material and not globally per scene. In the UI, similar setting related to render storage than in scene are added in the Game Settings material sub panel. The only option added it the mode is named Scene Default. This mode is reusing the render storage settings from the scene.

The UI is:

Object culling state

The culling state of an object is exposed in python thanks to the variable:

The value returned by this attribut is valid only in scene callback KX_Scene.pre_draw and KX_Scene.post_draw, not KX_Scene.pre_draw_setup.

See also: KX_GameObject.culled

Blenderplayer python main script override

Blenderplayer now accepts to receive an override python main script from the command line after the argument -p.
For example:
blenderplayer -p script.py file.blend

Billboard object rotation

Object rotation is now taken in account for objects with billboard material. It allows the user to choose the billboard axis by rotating the Z axis (which is used for the billboard) to the X axis for example.

Refactors and clean up
- Remove GEMAT_TEXT. (see 13abc63)
- Allocate KX_CollisionContactPointList on stack instead of heap. (see 600eaed)
- Implement MT_Matrix[3x3/4x4]::Identity(). (see cb0d42b)
- Use GPUBuffer in RAS_InstancingBuffer. (see b585b4a)
- Optimization in SetViewMatrix about negative scale. (see 399ffc4)
- Add ostream operator for RAS_Rect. (see 7e9dc15)
- Remove files MT_[Point[2/3]/Tuple[2/3/4]].[h/cpp]. (see 8aa70f5)
- Use GPUShader in RAS_Shader. (see 82b8573)
- Add a notifier to update material when we create a new texture. (see 8129f1d)
- Implement CListValue for cameras and fonts. (see 3bdba40)
- Add lodbias option for world textures. (see 2e2c55b)
- Move render overlay plane in class RAS_OpenGLRasterizer::ScreenPlane. (see f6e98bd)
- Move OglDebugShape and RayCastTranform in private RAS_OpenGLRasterizer. (see a24a277)
- Remove KX_Dome. (see fdadae1)
- Set the window on top at python interpreter end. (see 5a35942)
- Print message when launch python interpreter. (see 212def9)
- Restore anisotropic filtering value in LA_Launcher instead of RAS_OpenGLRasterizer. (see a7ed66a)
- Remove 2d filter vertex transformation. (see 6b47c01)
- Remove bgl_LuminanceTexture. (see 7fba3fd)
- Remove GLEW_ARB_multitexture and GLEW_ARB_vertex_program checks. (see 02f4248)
- Use data_to_c_simple instead of STRINGIFY for built in 2d filters. (see 9e3b5a4)
- Explicitly convert stereo mode from blender to game. (see fb7cdb4)
- Remove viewport bounding box gray clear. (see 6df1e38)
- Implement memory and gpu debug option in blenderplayer. (see d642a1c)
- Use glDrawElementsInstancedARB instead of glDrawElementsInstanced. (see 53e7c80)
- Caching active mesh slot count per bucket type. (see e76442c)
- Enable WITH_PLAYER by default. (see 1641916)
- Implement per mesh material attributes layers. (see e6917d2)
- Securise std::vector erase iteration. (see 2c669cc)

Bugs fixed
- Fix opengl state with text render. (see 71827fa)
- Fix mipmapping on cube maps. (see b51d7c6)
- Fix python interpreter support on windows. (see ec2f88f)
- Fix shared reloaded gpu texture in BL_Texture. (see ab5612e)
- Fix parralax mapping without UV. (see e8233f3)
- Fix Compilation error WITH_SDL. (see 08ab6e5)
- Fix warning in setUpdateShadow. (see ad6e12c)
- Fix inputs instead of events in SCA_InputEvent python API documentation. (see f202982)
- Avoid ghosting python interpreter on windows. (see b8e82db)
- Compile shader when creating 2d filter. (see fdc48f4)
- Fix material vertex color attributs. (see 8e94aa8)
- Fix geometry instancing vertex attributs disabled. (see d9d8b9e)
- Fix crash when calling setUniform when setSource has not been called (see 8f98642)
- Fix non-updated BL_Texture bind code for filters. (see ef6b11b)
- Fix recusrive call in BL_Texture::GetName(). (see edbde8a)
- Fix not culled texts. (see 18c0d1c)
- Fix VAO shadow render. (see 70cd11c)
- Fix blenderplayer wireframe render. (see d818340)
- Fix for python joysticks not updated during attach/detach procedure. (see a89a2ab)
- Fix T46650 animation on culled armature, refactor 583fa7d1e (Fix for T32054) (see 1d81d51, ce5ba1f, ce32cd9)
- Fix NULL window when reloading game. (see 51762c3)
- Fix render of empty meshes. (see 09e36e0)
- Fix unitialized AABB in RAS_MeshObject. (see 3012023)
- Fix memory leak created by DNA_sdna_current_init. (see 446a559)
- Fix submodules urls. (see 460aef6)
- Fix crash when calling Texture_init with material without texture. (see 5bc53ec)
- Fix mist in blenderplayer. (see 88314cb)
- Fix conflicting no environment flag and show bounding box flag. (see 32b345c)
- Fix mouse, keyboard and joystick python proxy. (see b439be7)
- Fix crash of material textures without textures. (see 2614d55)
- Fix NDOF input event issues. (see 2d335a1)
- Fix non fixed frame rate time issues. (see 485e6de)
- Fix keyboard sensor release key delay. (see 5db8fc4)