LOD Methods.....

Blitz3D Forums/Blitz3D Beginners Area/LOD Methods.....

Zeotrope(Posted 2009) [#1]
Hi All....

I have run into a Frame Rate issue with my tree cover.

What I need to know and understand is how a LOD system works. Currently I am using 'entityautofade' which I would like to replace with a LOD routine.

Should sprites / quads be used as distant trees...and when you approach flick them to full models (3ds)?

Or....do I use lower poly trees at distance instead of quads / sprites?

How does Farcry do it? Loop through each tree (all the time) and calculate distances and apply the corrent LOD?

Anyone care to shed some light and discuss your approach? I'd really like to keep my tree count as is but need to know how.


Naughty Alien(Posted 2009) [#2]
..how i do things is simply create small cubes on the edge of the bounding box of each entity, and convert them in to physics bodies(they are invisible) and simply do raypicking(physx, not B3D) and simply check is picking happen or not and based on that turn on/off corresponding entity on scene, eg. trees or whatever..thats how i manage to run smoothly 250K-270K polys level with no problems at all..


Zeotrope(Posted 2009) [#3]
Ok....sounds interesting. However, I dont use physx nor do I plan to at this stage. But thanks for the imput. As I said, sounds interesting.


Jerome Squalor(Posted 2009) [#4]
im not completely sure, but my guess would be to have all the levels of detail for the tree and have certain ones hidden depending on their distance from the player. the only issue i can think of this causing is the lag from checking the distance of every single tree.

hope that helps! :)


H. T. U.(Posted 2009) [#5]
There's an example of a LOD mesh in the samples.


Zeotrope(Posted 2009) [#6]
Thats what I thought...(LAG)....not from the command "Entitydistance" itself, but from the loop where each and every tree / object is checked for distance.

If I have 3 tree models representing Near Dist / Medium Dist / Far Dist....I could pop them in accordinly; but cant think of any other way to do this apart from looping through each tree.

Entityautofade does this automatically when you set this before the main loop. I am not sure what Blitz does behind the scenes (probably loops as well)

Will need to come up with a solution.....!


SLotman(Posted 2009) [#7]
Instead of testing each tree every time, group them into areas, and test the areas. then replace every tree in that area for a low poly model or a sprite, and you should see a speed improvement.

Also, don't test it every frame. test it like every 2 or 3 frames, or on a fixed time interval.


Zeotrope(Posted 2009) [#8]
@ SLotman: Yeah.....actually a good idea to limit the amount of distance calls. Perhaps it can be called each 100 cycles if I am on foot....and each 50 cycles when I am in a vehicle.

If I use a sprite for the low detail version, wont it approximate a different shape? I mean.....my 3d trees are bent banana palms etc.....yet a sprite would lean 1 way only.


Matty(Posted 2009) [#9]
Or update every frame, but only a few with the full cycle requiring more than a single frame to loop through all of them.


jfk EO-11110(Posted 2009) [#10]
I'd suggest to use entity position sorting. A 2-dimensional array has the entity handles stored. Their array index indicates the distance to the player/camera. So when you do a "for x/y" trough all of them, you will know from the current x and y value when you have to show the sprite version or the 3D version, and best of all, PositionEntity will also sort your alphas btw. The drawback is you will need to handle a lot of entities, can't collapse things much to save surface count. Then again, if the sprites are used in a smart way this may look like real dense vegetation.


Zeotrope(Posted 2009) [#11]
Thanks fot all the ideas guys....will try and come up with a solution based on this feedback.