Blender Git Commit Log

Git Commits -> Revision 42557f9

Revision 42557f9 by Benoit Bolsee (master)
May 7, 2009, 09:13 (GMT)
BGE performance, 3rd round: culling and rasterizer.

This commit extend the technique of dynamic linked list to the mesh
slots so as to eliminate dumb scan or map lookup. It provides massive
performance improvement in the culling and in the rasterizer when
the majority of objects are static.

Other improvements:
- Compute the opengl matrix only for objects that are visible.
- Simplify hash function for GEN_HasedPtr
- Scan light list instead of general object list to render shadows
- Remove redundant opengl calls to set specularity, shinyness and diffuse
between each mesh slots.
- Cache GPU material to avoid frequent call to GPU_material_from_blender
- Only set once the fixed elements of mesh slot
- Use more inline function

The following table shows the performance increase between 2.48, 1st round
and this round of improvement. The test was done with a scene containing
40000 objects, of which 1000 are in the view frustrum approximately. The
object are simple textured cube to make sure the GPU is not the bottleneck.
As some of the rasterizer processing time has moved under culling, I present
the sum of scenegraph(includes culling)+rasterizer time

Scenegraph+rasterizer(ms) 2.48 1st round 3rd round

All objects static, 323.0 86.0 7.2
all visible, 1000 in
the view frustrum

All objects static, 219.0 49.7 N/A(*)
all invisible.

All objects moving, 323.0 105.6 34.7
all visible, 1000 in
the view frustrum

Scene destruction 40min 40min 4s

(*) : this time is not representative because the frame rate was at 60fps.
In that case, the GPU holds down the GE by frame sync. By design, the
overhead of the rasterizer is 0 when the the objects are invisible.

This table shows a global speed up between 9x and 45x compared to 2.48a
for scenegraph, culling and rasterizer overhead. The speed up goes much
higher when objects are invisible.

An additional 2-4x speed up is possible in the scenegraph by upgrading
the Moto library to use Eigen2 BLAS library instead of C++ classes but
the scenegraph is already so fast that it is not a priority right now.

Next speed up in logic: many things to do there...

Commit Details:

Full Hash: 42557f90bd16771a5c6437dbfb3952527df7fb1a
SVN Revision: 20094
Parent Commit: 779bf43
Lines Changed: +261, -93

34 Modified Paths:

/projectfiles_vc9/gameengine/rasterizer/openglrasterizer/RAS_openglrasterizer.vcproj (+6, -6) (Diff)
/projectfiles_vc9/gameengine/rasterizer/RAS_rasterizer.vcproj (+6, -6) (Diff)
/source/gameengine/Ketsji/BL_BlenderShader.cpp (+12, -20) (Diff)
/source/gameengine/Ketsji/BL_BlenderShader.h (+11, -2) (Diff)
/source/gameengine/Ketsji/KX_BlenderMaterial.cpp (+14, -4) (Diff)
/source/gameengine/Ketsji/KX_BlenderMaterial.h (+1, -0) (Diff)
/source/gameengine/Ketsji/KX_GameObject.cpp (+45, -6) (Diff)
/source/gameengine/Ketsji/KX_GameObject.h (+1, -0) (Diff)
/source/gameengine/Ketsji/KX_KetsjiEngine.cpp (+12, -16) (Diff)
/source/gameengine/Ketsji/KX_Light.cpp (+4, -1) (Diff)
/source/gameengine/Ketsji/KX_PolygonMaterial.cpp (+10, -5) (Diff)
/source/gameengine/Ketsji/KX_PythonInit.cpp (+4, -3) (Diff)
/source/gameengine/Ketsji/KX_Scene.cpp (+2, -0) (Diff)
/source/gameengine/Rasterizer/CMakeLists.txt (+1, -0) (Diff)
/source/gameengine/Rasterizer/Makefile (+1, -0) (Diff)
/source/gameengine/Rasterizer/RAS_BucketManager.cpp (+59, -1) (Diff)
/source/gameengine/Rasterizer/RAS_BucketManager.h (+1, -0) (Diff)
/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp (+3, -0) (Diff)
/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h (+1, -0) (Diff)
/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp (+6, -6) (Diff)
/source/gameengine/Rasterizer/RAS_MaterialBucket.h (+22, -3) (Diff)
/source/gameengine/Rasterizer/RAS_MeshObject.cpp (+6, -2) (Diff)
/source/gameengine/Rasterizer/RAS_MeshObject.h (+1, -1) (Diff)
/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt (+1, -0) (Diff)
/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile (+1, -0) (Diff)
/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp (+1, -1) (Diff)
/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript (+1, -1) (Diff)
/source/gameengine/Rasterizer/SConscript (+1, -1) (Diff)
/source/gameengine/SceneGraph/SG_DList.h (+4, -0) (Diff)
/source/gameengine/SceneGraph/SG_QList.h (+4, -0) (Diff)
/source/gameengine/SceneGraph/SG_Spatial.cpp (+5, -2) (Diff)
/source/gameengine/SceneGraph/SG_Spatial.h (+7, -1) (Diff)
/source/gameengine/VideoTexture/ImageRender.cpp (+0, -3) (Diff)
/source/kernel/gen_system/GEN_HashedPtr.cpp (+7, -2) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021