Programmatically assign LODs

Hello:

I have two meshes in blender and I want to use them as lods for a single mesh. For example: I have a fully textured house that has 1,000 vertices and I also have the same house with 200 vertices. How do I programmatically assign the LODs to my geometry in blender?

I know that you can generate the LOD inside blender by right clicking and creating the LODs. But this method doesn’t always create a perfect LOD, and I need to get pretty good LODs. Don’t get me wrong, this feature is great but you know sometimes I prefer pre-made meshes.

Right now I’m looking at the class GeometryBatchFactory, but I don’t know how to do anything with it.

Please mention the TestBatchLod.java or TestLodStress.java sample codes if you need to, in order to answer this question.

Lods are not sub models, they are a different way to connect vertices in a mesh so that the overall rendered vertices number is smaller.
You can’t use the built in LOD system for what you want to do.

You have to load both of the model and switch (ad/remove from the scene graph) them according to the distance

Theoretically assuming you have the same or mostly smae vertices, you could merge both vertexbuffers, and then create a indexbuffer for each original model, that selectes the vertexes that model initially used.

I always thought about doing such tool myself, but havnt found the right time for this yet.

@Empire Phoenix said: Theoretically assuming you have the same or mostly smae vertices, you could merge both vertexbuffers, and then create a indexbuffer for each original model, that selectes the vertexes that model initially used.

I always thought about doing such tool myself, but havnt found the right time for this yet.


oh yeah completely merge the models…didn’t think about that…It could work

The pro would be to get real lods if a modeler did them.
Eg a ladder (on a building or similar) is the perfect example, a algorithm can only reduce the polygons, a modeler can just add a large quad with a ladder texture for distance views.

Merging both would increase the memory useage for only one lod but if both are used usually many vertices can poentially be shared between lods.