Release notes version 0.50 - UPBGE/upbge GitHub Wiki

GPU skinning
There is an experimental implementation of GPU skinning.
A) Deformation limitations:
-
In 0.50 it will only support 1 Armature with 1 child mesh.
-
Deformation may differ a bit from CPU skinning version:
a) Preserve Volume option is not bundled in 0.50.
b) Bone envelope is not supported in 0.50.
c) Influences (weights) are limited to 4 per vertex (CPU version has not weights limit): In practice it is not noticeable in most cases.
B) Implementation technique and limitations:
- The GPU skinning implementation was done with the help of AI. In most engines, GPU skinning is using vertex shaders. Here, we are getting positions and normals VBO (vertex buffer objects) from the render cache and deforming those with compute shaders.
- Tangents VBO (when you have a normal map in the shader mainly), are not updated during GPU skinning for now. In practice, it can lead to small differences with CPU pipeline.
- When adding new armature + child during bge runtime, each copy will have its own mesh (then its own deformation). GPU skinning implementation doesn't work when "UPBGE dupli base" option is checked.
This initial implementation was only integrated in bge pipeline and doesn't work when playing timeline in viewport (bge runtime only)
Fast AddObject
A new option is added in Object properties tab named (in UI): UPBGE dupli base.
It is a mechanism inspired from Blender DupliObject mechanism. It has been implemented with the help of AI.
Until now (in 0.3+ versions), all KX_GameObject had a single Object, and when you were adding a KX_GameObject (using logic nodes, kx_scene.addObject(...) or edit object actuator, a partial copy of the Object was done, and fully integrated with Blender depsgraph. It had the advantage to provide some unique properties/data to each replica, but it was a bit slow and was possibly causing stutters when adding the new Object. Also, the more you had Objects in the scene, the more dependencies calculations were heavy (Many real Objects in the Scene can slow down bge runtime).
When you mark an Object as an "UPBGE dupli base" (you need to hide it with the eye in outliner), all "copies/duplis" made from this Object will refer to this same Object base. These "copies/duplis" are not integrated with the depsgraph. The "copies/duplis" directly inherit their transformation from old (and fast) bge SceneGraph, they are added to a kindof dupli_list which will directly be passed to the render pipeline. It has the advantage of being very fast (similar speed than in old bge), but these "lightweight" copies have less "unique properties/data" than real Object copies.
Warning: Always take care to have a consistent state (same options checked) for Parent and all children (both in outliner and Object tab)
2D filters changes
To be abled to run 2D filters both in OpenGL and Vulkan backends, 2D filtyers code has been adapted to follow blender ShaderCreateInfo system.
Builtin variables:
- uniform sampler2D bgl_RenderedTexture
- uniform sampler2D bgl_DepthTexture
These varibles don't need anymore to be "Declared" at the beginning of the 2D filter code (you don't need to write anymore uniform sampler2D bgl_RenderedTexture; for example, but you can use it directly in the shader code)
Builtin attributes:
- in vec4 bgl_TexCoord
- out vec4 fragColor
These attributes don't need anymore to be "Declared" at the beginning of the 2D filter code and can be used directly in shader code.
Builtin Data packed in an Uniform Buffer Object:
Following data has been packed into an ubo ("Uniform Buffer Object"):
- float bgl_RenderedTextureWidth
- float bgl_RenderedTextureHeight
- vec2 bgl_TextureCoordinateOffset[9]
It doesn't need anymore to be "Declared" at the beginning of the 2D filter code and can be used directly in shader code.
As it is packed into an ubo, you can access it like that:
- g_data.width (float)
- g_data.height (float)
- g_data.coo_offset[i] (vec4 - Note: the real offsets are in g_data.coo_offset[i].xy; it has been packed into a vec4 for ubo struct padding reasons)
The reason why these builtin uniforms have been packed into an ubo is that push_constant (uniform) size in bytes is limited to 128 bytes. To leave more room (space in bytes) for custom uniforms, these uniforms have been passed to the shader with an ubo.
The 2D filters GLSL parser has normally been adapted to support old syntax.
Simple 2D filters example with new syntax:
//myFilter.glsl
void main()
{
vec4 blue = vec4(0.0, 0.0, 1.0, 1.0);
fragColor = texture(bgl_RenderedTexture, bgl_TexCoord.xy) * blue;
}
VideoTexture
VideoTexture module (bge.texture) was disabled in 0.44 version because it contained OpenGL code which was not compatible with multiple backed (OpenGL + Vulkan).
It has been adapted to work both on OpenGL and Vulkan but has not been fully restored.
bge.texture modules contains a lot of (not well known) code to work with a CPU buffer containing an array of pixels. But to get this CPU buffer, it was needing to do a copy of GPU result to have the result available on GPU. As it has a performances cost, as this code was almost not used and not well known, and as the integration with bpy offer similar possibilities, this copy from GPU to CPU is not done anymore in 0.5.0 version. It makes a lot of code deprecated (documentation has not been updated yet). For example, FilterBlueScreen() to apply some filtering options to the CPU buffer and send it back to the GPU won't work anymore.
In the same time, you can now access color texture from chosen source as a bpy.types.GPUTexture:
For example:
import bge, bpy
from bge import texture
from array import array
scene = bge.logic.getCurrentScene()
rcam = scene.objects["render_cam"]
rplane = scene.objects["render_plane"]
matId = 0
texId = 0
bge.tex = texture.Texture(rplane, matId, texId)
bge.tex.source = texture.ImageRender(scene, rcam)
WIDTH = 512
HEIGHT = 512
bge.tex.source.capsize = [WIDTH, HEIGHT]
def floats_from_buffer(buf):
mv = memoryview(buf)
a = array('f')
a.frombytes(mv.tobytes())
return a # array('f')
def refresh():
bge.tex.refresh(True)
colortex = bge.tex.gpuTexture #bpy.types.GPUTexture
if colortex is not None:
cpu_color_buf = floats_from_buffer(colortex.read())
print(cpu_color_buf.tolist())
Physics changes
SoftBodies code has been reworked a bit to fix few transform issues and provide an unique shape for replicas.
RAS_MeshObject is using tris for RAS_Polygons (Code was updated to not use anymore old tesselation model, and to fit last Blender practices). In practice, it should not change much on user side (Actually it just brings back 0.2.5 behaviour regarding "polygons management").
BGE Fh spring (bge force fields != blender force fields) code has been reworked a bit to apply force along normal when possible. If you have a Plane with a TriangleMesh shape (needed to know normal direction) with Fh nor option enabled, the force applied to the objects (with bge force fields enabled) falling on this Plane will take into account Plane normal.
Steering Pathfollowing Actuator
Added path direction smoothing with lerp blending for steering act. It has been implemented smooth transitions between path changes using SLERP interpolation with configurable blend time for steering actuator (path following behaviour). 0.15 seconds by default, 0 seconds is the old behaviour.
Sound Actuator
Added sound buffer option to Logic Bricks Sound Actuator. It basically adds an optional preload with RAM caching to avoid repeated decoding on play (off by default). It improves playing with repetitive small/medium sound files and it ensures replicas rebuffer correctly, proper freeing, and Python attribute to toggle preload behavior.
Logic Nodes and uplogic python module
- added Project Management tab. This tab allows you to quickly create a folder structure with infrastructure to create a new game.
- added Move Widget node:
- added Toggle Tree Property node:
- Raycast node was re-implemented. It is now found under "Logic -> Raycast"
- Fixed Curve Interpolation node
- Fixed Tween Value node
- Fixed 2D Filters for nodes
- Fixed an issue in the console that resulted in an error at runtime (
'ConsoleLayout' object has no attribute 'input')
And much more ....
Besides all these UPBGE 0.50 specific features, there are also the features introduced in Blender between Blender 4.4.1 and Blender 5.0.1. Check here: https://www.blender.org/download/releases/
Enjoy it!!