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.
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
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
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
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.