Batching?

Is there any way to make a batch manager in BGE?

I know blender already has some kind of batch manager, else I would only be able to render 250 objects with my current graphic card as it only supports 250 geometries.

If I can’t make a batch manager is there some kind of way to merge two meshes into one at real time?

  1. No, there’s no way to merge two meshes into one in real-time in Blender currently. I believe Mahalin was working on such a function, but I haven’t heard anything about it in awhile.

  2. What graphics card do you have? I don’t think any card measures the amount of geometries it can render in hard-coded numbers like that - as far as I know, usually the number of millions of triangles per second a card can render is the statistic that’s used.

I think he abandoned his work with that, due to some culling issues, and the fact that patches are not reviewed fast enough (I think that is why he went with making his own engine)

I think his Git is still open on what he did though.

Another idea,
if they are going to be static forever and not move and are generated 1 time,
generate using bpy then join then start bge?

The problem I encountered was it required a lot of modifications and introduced other issues like with physics and culling. In the end, it wasn’t really viable without major changes.

It’d be more convenient if the BGE’s VBO mode was enabled. With OpenGL core, you could just create a static VBO with all the geometry/meshes you want to batch together. That’d be the fastest method than reuploading the data every frame as with display lists etc. Then you only have to bind that VBO and only need to do a single draw call.

Removing an object would involve something like creating a new VBO and copying over the old data. Keep in mind, this all happens on the GPU side of things since VBOs are stored on the GPU RAM.

Always(one time)-------python


own['batchList']=[]
for items in scene.objects:
    if 'batch' in item:
        own['batchList']+=item

And if you add then do the vbo thing?

If you add or remove a batch item, append the list?

Is enabling VBO a hard thing or ?

Can you feed it data using OpenGL in game? With a shader or something?

Um, it’s a little more complicated than that since it’s more low-level. Look into the BGE’s rasterizer source code (RAS_StorageVBO.cpp) to get an idea. AFAIK, VBOs were disabled due to performance reasons since the drivers could optimize display lists better…

In my own work I attempted using openGL to draw the batch, there was just no way to tell it that the new mesh needed to be part of BGE, making a subclass caused unexpected crashes.

Does any one know a way past this, or a patch to use geometry shaders that is know to work?

Malhalin if you have any of your old blend files on merging meshes I would be grateful if I can have a look at them.

SolarLune you are correct it’s not measured by hard values 250 Geoms of one polygon drops my frame rate to 40 in openGL, 64 with DirectX 10.
I take 250 as a safe value even if I could reach 300-400.
It also doesn’t matter if the mesh used in a geom is one triangle or ten thousand it drops the same amount.