Trees with lod, less objects is better or it does not matter?

Hello,

Atm i try to get some knowledge about a simple lod system and setting it up with trees.

Ok, i have made a tree:


As you can see it is made out of 28 objects (1 object is lamp)
I have given every object a lod property with a set distance in it (50 for leaves, 60, 70 and 80 for branches and 100 for the feet).

I also made a verry simple lod system:

from bge import logic

def lod():
    
    cont            = logic.getCurrentController()
    scene_objects   = logic.getCurrentScene().objects
    own             = cont.owner


    for obj in scene_objects:
    
        if 'lod' in obj:
        
            distance = own.getDistanceTo(obj)
        
            if distance > obj['lod']:
                
                #maak ontzichtbaar en stop physics
                obj.visible = False
                obj.suspendDynamics()
            
            else:
                
                #maak zichtbaar en re-activeer physics
                obj.visible = True
                obj.restoreDynamics()
               
lod()

It works great, now i am wondering… is this a good setup?
Or can i better combine all the leaves and the 3 branches so we get like 3 objects to work with?

I thought that it gives better graphics this way, and the back of the tree (when out of range) will be removed so it will be easier to calculate?

Can someone tell me a good method for this?

Thank you.

One tree made of 28 separate objects is going to slaughter your performance, if you plan on adding more trees. Best to do it with the 3 separate objects.
LoD doesn’t have to be super layered. Look at the old Spyro games. They only had like, 4 levels of detail per entity. Same with the original F-Zero game.

One tree made of 28 separate objects is going to slaughter your performance, if you plan on adding more trees. Best to do it with the 3 separate objects.

you’re absolute right, thought maybe it was easier to calculate.

I had some time and made a test with 1000 trees, 28 objects a tree is a huge performance hit xD got 4 fps out of it.
then with 3 objects a tree, same senario, steady at 60 fps.

it’s solved for me.

Why aren’t you using the LoD function in the object settings? I would imagine this runs faster as you don’t have to run an extra script, although I could be wrong.

Why aren’t you using the LoD function in the object settings?

This uses other meshes to change the origional, i am not going to use more meshes, i just play with the ones i have.
Then the best way is to turn them invisible and turn dynamics off. and with script u can set a delay, so it doesnt run every tick.