LOD level of details from bge or with python code?

it is not that bad…to ‘roll your own’
just create a list of objects you want to control during the first frame…
like if len(myList) < 1: …then build a list with property[x]… maybe ‘lod’…

then just constantly index the list and check it’s distance from the camera…

then set visibility, replace mesh, a property, dynaics…whatever on or off accordingly…

the drawback is indexing chronologically …but you can also do two indexes one even, one odd…or whatever…be creative…

if you loop through and check ALL those objects every frame it will get slow…for sure.

but testing a few at a time is no hassle, plus you can set a lot more things this way as stated above…

I would not use this for grass…it would take too long and to index through all the grass and would be very apparent…but for trees and rocks it should be ok…
to be clear Daedalus is correct…built in lod ‘switching’ is faster…but it also has limits.

the right tool for the right job…the method I explain above is probably the simplest bare bones solution for some one newer to coding, but it is straight forward and has little cost.

GTA 5 use LOD open world need use!

first, yes, open world and just about any other game needs to use LOD.

second,…does it matter if GTA V does it?..no…(if your friends jumped off a bridge…)

gta5 used beleive in trees in light suport lamps and others objects i see with my eyes

yes does matter gta5 accept per many peoples like game with LOD

GTA V is a big game in open world, and it wouldn’t work without a LOD system of some sort.

I feel like it was a good example.

it would be nice if there where an easy way to generate 3D Impostors.

you tell objects? manually not decimate method to all objects.need create manually cost time yes many work yes but i think when finished will have a very good performance is a easy LOD look video 211 houses with 360000 triangles and not reduce any one FPS

My comment was more of a joke…just based on how he worded it…I meant him no offense :wink:

1 Like

i know you know a lot about python that is good
but in open world need use level of detail to grass trees rocks and other objects and i think example 1 object with many faces(600+) or many same objects with 20 or 50 faces level of detail help in performance and performance is fundamental to work FPS.
What i think know all out of view camera is not rendered?bge have this internal C++ code?

hi there. Level of detail work good with grass but with tree cant see any diference.My original tree have 685 faces LOD1 i reduce to 375 faces and LOD2 to 180 faces.If i work with near distance got same frame but if i remove near and work with always add object only reduce around 20FPS to 30FPS performance.I use 4 trees of same object
Any sugestion?may be increase distance between trees?
thanks

in object properties


this should set the mesh detail level

my system that rolls through X objs per frame - set invisible / remove physics using suspend Physics() (upbge only)

adds to the built in system.

margin = 2
VisDist = 75
physicsThreshold = 55
logicThreshold = 33
for x in range(int(len(own.scene.objects)*.1)):
    object = own.scene.objects[own['index']] 
    own['index']+=1
    if own['index']>len(own.scene.objects)-1:
        own['index']]=0
    D =  own.getDistanceTo(object)
    if D < physicsThreshold and 'Physics' not in object:
        object.resumePhysics()
        object 'Physics' = True
    elif D > physicsThreshold + margin and 'Physics' in object:
        del object['Physics']
        object.suspendPhysics()
    if  D < VisDist and 'Vis' not in object:
        object.visible = True
        object['Vis']=True
   elif D > VistDist+margin and 'Vis' in object:
       object.visible = False
       del object['Vis']
   if D < LogicDist and 'Logic' not in object:
        object['Logic']=True
        object['State']=1
   elif D > LogicDist + margin and 'Logic' in object:
        del object['Logic']
        object['State'] = 2

i use restoredynamics and suspendynamics in bge

suspendPhysics() completely removes it from the physics calculations, static, etc even.

but you code will work on bge 2.76?

bge 2.76 is nice and stable but so is upbge 2.1

I almost never crash and when I do it’s my fault.

Use this with care, check if obj has a physics id before you suspend the dynamics else you get into trouble. (the reason why i commented that function out in my lod)

Really, 2.76 crashes as soon as you have 2 blenders open for 5 seconds lol. At least i can have 2 open in 2.79 but it all depends on what you need, in order to call it stable for yourself/myself.

bge 2.79 craches when you disable shadows in render properties for me this is bad.cause this i back for 2.76.

Here this guy turned out with LOD - built-in. This is the fastest solution.

i know that but with we need use more thecknics