Copyentity and LOD System

Started by Zeotrope, May 23, 2018, 05:07:43

Previous topic - Next topic

Zeotrope

I have an ongoing project (FPS) requiring a LOD system for items placed on a terrain (trees / rocks etc)

My code (not on this computer) loads in, for instance, a tree model and then uses copyentity to duplicate
itself and get placed around the terrain via coords read from a text file. Once loaded, I have 32K objects to deal with within the main loop.

In short, I would like to begin with a basic (2 tier) system in which to display a Level Of Detail for my trees; a low and a high poly
model based on the distance from the camera.

I want to avoid loading a new model in the game loop so I guess I would need to do it at load time (ie: loadmesh("tree_1_low.3ds") : loadmesh("tree_1_high.3ds") and somehow refer to the correct model at the applicable time.

Would I use FreeEntity in a routine as I get close to a lowpoly tree to allow it to become a high poly version of itself ?
Any thoughts on a good way to approach this ?


RemiD

For a landscape with many trees / bushes / plants / grass, my past experiments led me to a system in which you would use a combination of the texels of a colormap (for far away grasses), flat textured meshes ("impostors") for far away trees / bushes / plants, low details 3d textured meshes for medium range trees / bushes, and high details textured 3d meshes for near trees / bushes / plants

of course you would need to load each textured mesh once... and then use a copy...

also don't hesitate to use less unique meshes, but rotate them around the Y axis (Yaw) between -180 and +180, to add the appearance of more difference

the alternative would be to split your terrain in sectors, and merge all surfaces (one for each shape) in a sector in one mesh one surface...

Kronos

You could use EntityAutoFade and let Blitz3D do the work for you. Place Lod1 and Lod2 entities in same location set the autofade so that at a certain distance one fades out while the other fades in. It will increase the number of objects but you don't have to worry about freeing and re-creating entities etc. A bit inefficient.

There are a couple of other options you could consider
a) Use some kind of scene management, eg simple cell partition system as you don't want to be polling 32k objects every cycle. Break your scene into imaginary squares, place a pivot in the centre of each square, link objects that fall within that square to the pivot. You can then control visibility of all objects in the square by the pivot. So if your scene is 10x10 squares thats only 100 checks you have to make instead of 32,000 or whatever.
b) Rather than use copyentity use copymesh and then addmesh to combine instances of the same mesh together into a bigger mesh. This will reduce the number of objects you have to work with and improve rendering speed. It works well for trees and grass etc.
c) a combination of a) and b)





Kronos



Heres a short video of something I did back in the day using addmesh and autofade. No scene management as such and no lodding. The whole scene is made up of 32 x 32 meshes or similar for the trees and grass.

Borislav

#4
Quote from: Kronos on May 30, 2018, 20:28:45


Heres a short video of something I did back in the day using addmesh and autofade. No scene management as such and no lodding. The whole scene is made up of 32 x 32 meshes or similar for the trees and grass.
That's nice!
But what is autofade, there is no documentation about that :).

MagosDomina

EntityAutoFade entity,near#,far# 

Its in the docs. :)

Zeotrope

Quote from: Kronos on May 30, 2018, 20:11:26
You could use EntityAutoFade and let Blitz3D do the work for you. Place Lod1 and Lod2 entities in same location set the autofade so that at a certain distance one fades out while the other fades in. It will increase the number of objects but you don't have to worry about freeing and re-creating entities etc. A bit inefficient.


Lod1 and Lod2 in the same position could be an interesting solution.

Freeentity seems to crash Blitz. Will try again and post my results.

Thanks all for the suggestions. Will try all approaches but I would prefer to work with my current array of copyentity objects....32K of them. Only some need to have different LODs. ( Trees / Rocks )


Borislav

Quote from: MagosDomina on June 01, 2018, 01:34:36
EntityAutoFade entity,near#,far# 

Its in the docs. :)
Oh!
That's really nice!
He said autofade so I searched up A-Z for A and didn't get anything.