I know the following will cause some questions like "is this really necessary" and so on, but I won't discuss these kind of questions if they won't be useful for solving the problem/question
I made a particlesystem which emitts geometry, to display this geometry I'm using entity/scenenode. The problem which now occurs is that the framerate drops when many scenenodes are in the scene. when just using billboards it would run much faster and this problem wouldn't occur, but the goal is to use geometry and not billboards. So my question is what is the best way to display many scenenodes?
as long as only 5000 to 10000 particles are in the system it runs on my machine @ about 10-20fps (other machines which are much mor epowerful as mine have similiar fps) and cpu/graphics card are bored. this isn't really the amount which is wanted for a particle affect. there should be much more possible (it would be nice to reach up to 100k particles with this fps).
I know the instancong sample and also the pagedgeometry project. But both are based on or are using staticgeometry. My first thought is that this would not be useful for my purpose because the particles are moving and the staticgeometry has to be build up every frame again. anyway I'm trying this approach at the moment because it's not the most efficient way but maybe it's more efficient then just using scenenodes/entitys. at the moment i have crashing troubles with this approach. Since i'm not really believing that this approach would have a positive affect on the fps I would like to know if there is a way for displaying many scenenodes really efficient and fast.
as said the only way i found is staticgeometry, but this is created for static objects as the name already says. and i don't have static objects
Edit: Summary of the problems and solutions:
The better way is to use instancedgeometry. Follow these steps to get it working:
hoppelmoppel wrote:1) create the entity
2) use setupInstancedMaterialToEntity and buildInstancedMaterial from the examples source
3) create the geometry: mSceneMgr->createInstancedGeometry("GrassArea");
4) set the dimension: (10, 10, 10) seems to be pretty small. Use much bigger values like (5000, 5000, 5000). I used the same size my area has. Although I believe this is not so important because the bounding box is expanded by adding elements.
5) add the 80 (that's the magic number which represents the upper bound of objects in one batch) entities: mInstancedGeometry->addEntity(pEntity, Position) -> note: Afaik the position isn't used. I believe it's a code bug. In the example code the position is set afterwards.
6) adept the position of all instanced objects
addBatchInstance creates a copy of the last created batch (the initial batch is also one). You only need to use it if you want to create more than 80 instanced objects. After creating a new batch you have to adept the position of the objects. If you don't want to show an exact multiple of 80 objects I would suggest to reuse the last valid position and scaling for the other objects.
Aftert hat only one object per batch was displayed... solution:
Jabberwocky wrote:I haven't carefully read through all your recent posts, but did see that certain meshes were working with instanced geometry, and others weren't.
So the 3 possibilities:
1- problem with your mesh (most likely)
2- problem with your material
3- problem with the skeleton (least likely, you probably aren't using a skeleton).
To test 2:
Try using your mesh, but with the razor's material.
If it doesn't work, you should be able to elimitate (2).
So next look at the meshes.
- Download the MeshMagick.exe tool, if you don't have it already (search the forums).
- type: MeshMagick.exe info razor.mesh
- type MeshMagick.exe info your_non_working_model.mesh
- compare the output, and look for differences.
For example maybe one mesh is using "shared verticies" (this will be identified by the MeshMagick output), and the other isn't.
Or maybe one has multiple sub-meshes, and the other doesn't.
Or maybe one uses 16-bit indicies, and the other doesn't
Or maybe there are differences in the vertex buffer layout.
Then, systematically try to change your mesh so it's like the razor.mesh, until you get a mesh that works, by exporting it with different options. And you should be able to work out what's wrong by the process of elimination.
In my case it was a problem with my mesh. I used blender for creation. the old ogre-exporter for blender did not export the right "format" so I used the exporter for blender 2.5+. Last problem was to get a vertex buffer layout including texcoords:
LiMuBei wrote:Did you unwrap your model in Blender? You must do that, otherwise the mesh won't have texcoords. Simply select all vertices in edit mode and press 'U', then unwrap with the method of your choice. You should then get uv coords in your export.