Setting LOD for multiple objects?

Hi, I’m trying to setup a small universe with planets, stars, etc. in the game engine.

I have used a particle system to generate a universe with all the base objects (LOD0) for the planets, stars etc. Each object is used a lot of times.

Now comes the tricky part. How will I be able to assign all the LOD’s for the objects? I’ve got 4 or 5 LOD’s for each object, I have named them LOD1, LOD2, LOD3, etc. But you can only assign LOD’s to one object at a time…

LOD is not an option when you try to make links (CTRL+L). Is there any other way to assign the LOD’s to all instances of the same object?

I’m sorry if this question is already answered, but ‘LOD’ seems to be hard for the forum search engine to find.

LOD is in object menu I think
(for stock LOD)?

another method

make a list of all the objects,

then process a part of the list each frame,

Diff = myposition-targetposition
Diff.magnitude = distance

this way you don’t bog anything down.

if Distance<Distance 1 and Distance<Distance 3 and object['Lod']!=2:

here you go sir

in the part


the 5 = process 5 parts of the list per frame

you can tweak this value

lower = faster but updates with less speed

also, adding objects to the scene with lod, means you will have to add them to the list with a external script.

side note… I used own[‘Max’] but I probably should use
if own[‘index’]>len(own[‘LODList’]):


LODTest.blend (638 KB)

ok, here is a example that adds a object to the scene, and also inserts the object into the LOD list,

I also modified it so if a object is deleted, it is removed from the list without throwing any errors :smiley:

Also, I found that own.getDistanceTo is faster then calculating it yourself :smiley:


LODTestWithAddedObjectExampleAndRemoveTolerance.blend (632 KB)

As far as I remember you can assign LOD objects via naming convention.

I never used that. So I can’t tell how it works.

downloaded right now blender 2.74
yes at moment the unique reference is the name of the object created from the tool LOD
that add a suffix on the object name (not mesh name)

so a mesh object named “Batman”


create 2 new mesh named:

note that to work in bge the modifier decimator must be removed(apply)
on the object created

using the default setup (that generate 2 meshes)
and adding one property “lod” = 0 on the highpoly obj.
is not too hard found the meshes to change, using the suffix in the name.

anyway in future should be “automatized”, never good manage these kind of dependences with python

import bge

LODDISTANCE = [-1.0, 7.0, 50.0]

scene = bge.logic.getCurrentScene()
gdtc = scene.active_camera.getDistanceTo
for obj in scene.objects:
    if "lod" in obj:
        if not "_lod_broken" in obj:
            if not "lods" in obj:
                    lods = {}
                    lods[0] = obj.meshes[0].name
                    lods[1] = obj.scene.objectsInactive[ + "lod1"].meshes[0].name
                    lods[2] = obj.scene.objectsInactive[ + "lod2"].meshes[0].name
                    obj["lods"] = lods
                    obj["_lod_broken"] = True
            dist = gdtc(obj)
            lod = 2 if dist &gt; LODDISTANCE[2] else 1 if dist &gt; LODDISTANCE[1] else 0
            if obj["lod"] != lod:
                    obj["lod"] = lod
                    obj["_lod_broken"] = True