Page 1 of 1

[Solved] displaying many SceneNodes

Posted: Wed Feb 08, 2012 5:11 pm
by Onsokumaru
Hi,

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.

Re: displaying many SceneNodes

Posted: Fri Feb 10, 2012 8:27 am
by hoppelmoppel
Take a look at the InstancedGeometry technique or the new instancing system in 1.8. They are way more flexible than StaticGeometry at the expense of performance :)

Re: displaying many SceneNodes

Posted: Sat Feb 11, 2012 4:05 pm
by Onsokumaru
hey, thanks for your hint.
I tried the instancedGeometry Object but it isn't working much better and I don't know where the problem exactly is ;) Maybe I'm just doing some nooby mistakes :)
Ogre 1.8. is not an option for me because it's my master's thesis and would like to finish my programming this week ;)

Here is what I'm doing exactly (I think could would not be helpfull since it is shattered over 2 or 3 cpp files and there are always small codesnippets of one or two lines... doing nothing special):

I'm setting up the static/instaced geometry object with the scenemanager, dimensions and origin. when I update the particle system I'll call reset or destroy (doesn't matter which) of the geometry object. when the update is finished the build-method is called. At the particle I'm just adding the entity with it's position and orientation to the geometry object.

So here is what happens with the staticgeometry object:
after about 5 iterations (=updates) it will crash at the build-call (happens in debugmode at more than 250 particles, in release at <100)

and here's what happens with instancedgeometry object:
It crashes at the renderoneframe call of the rootobject when the geometry object contains more than 250 objects. When I'm running it in debugmode I'll get an assertion in connection with vectors. I tried using "addbatchinstance" but then it's crashing immediately.
again I looked into the instancing example and I think that I'm using the objet in the same way, except "addbatchinstance".

Re: displaying many SceneNodes

Posted: Sun Feb 12, 2012 10:54 am
by hoppelmoppel
If this is your master thesis .. this is a very though deadline .. I dunno how long you are working on your theses, but understanding and using the instanced geometry correctly costed me weeks.

Back to topic:
This happens if you aren't reading the InstancedGeometry documentation carefully. I think you are using it totally wrong. You should never destroy the instanced geometry, you should adapt it (add/delete objects).

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.

Further readings: http://www.ogre3d.org/forums/viewtopic.php?f=2&t=67093

Re: displaying many SceneNodes

Posted: Sun Feb 12, 2012 11:27 am
by Jabberwocky
I haven't profiled this stuff, but I think the many SceneNodes framerate problem is:
1- Ogre's per-frame traversals through of the scene graph (in which case you're CPU bound)
2- Having too high of batch count, as each separate entity you've got attached to a SceneNode counts as it's own batch. Batch count is largely a limitation of your video card.

There isn't any easy solution to these problems, that's just how Ogre (and likely most other graphics engines) work.
If 1. is your bottleneck, you could consider writing your own SceneManager (ogre is designed for this), and start trying to make optimizations for your use case.
If 2. is your bottleneck, and all your emitted particle meshes must move independently of one another, I'm not aware of anything other than instancing which might help.

Re: displaying many SceneNodes

Posted: Mon Feb 13, 2012 7:33 pm
by Onsokumaru
@hoppelmoppel

I'm working already 4 months on it and the particle effect isn't the core of it, but it's killing the fps ;) So I'm now trying to optimize it a bit so it runs stable somewhere beyond 15fps. If I can't realize this it's no problem for the theses, it just would be nice for applying with this prototype :)

Your steps are usefull and I'll have a look on it tomorrow. I'd like to adapt the geometry but I didn't find a way to delete an object...

@jabberwocky

so this two kinds of bottlenecks I tested and looked after it, but since neither the cpu nor the video card reached their limit I thought that it must be something with the graphics card because it doesn't seem plausible to me that the gpu activity is @ 0% when having some thousands of objects on the screen. So I thought this problem is conneted with the way data come to the video card (I've read somewhere in the forum that every scenenodechange means a write to the video card (that's for sure not effective)... don't know how much about this is true) so I tried to change with the handling of the geometry and use static/instanced geometry. And yes... the "original" particle system has easily a batchcount beyond 10.000 or 20.000 (the scene itself has only something around 30 batches). I think when I'm getting the instanced geometry working and the batchcount is low it would run much faster :)

Re: displaying many SceneNodes

Posted: Tue Feb 14, 2012 2:58 am
by Jabberwocky
- edit: Whoops! I actually responded to the wrong thread here, sorry for the confusion! -

Re: displaying many SceneNodes

Posted: Tue Feb 14, 2012 8:16 pm
by Onsokumaru
It works now with one "little" problem: I won't see all my particles. If I had to guess I would say I see just about 80 particles... At the beginning is everything fine and the particles are moving smooth, but with time they starts to flicker and jump around. I would say this is caused by my code for accessing and updating the objects. The problem is that just in some frames but not every frame the same particles are rendered/showed/visible... especially when particles get removed from the particlesystem and so the order of the particlelist gets changed.
I'm sure when _all_ particles would get displayed everything would look right. I'm not sure if I'm doing the positioning right. As I understand I'm positioning the InstancedGeometry around (0,0,0) (having dimensions from (-6000,-1000,-6000) to (6000,1000,6000)) and when using global correct positions the particles should be positioned in the right way. So If I have the position (100,200,100) or (-100,200,-100) it would be positioned there and not somewhere else caused by some kind of "local space".
If you have a idea what is going wrong or I'm doing wrong please tell me :) tried all day long to get it displayed right... now I don't have anymore ideas to try...
Here is my code (now nearly complete encapsulated in the particlesystem class) and it's not the best... will be looking better when working correct ;)

Code: Select all

private: void setupGeometry()
	{
		this->mSnowflakeGeometry = Ogre::Root::getSingleton().getSceneManager("MainScene")->createInstancedGeometry("SnowParticlesystem");
		this->mSnowflakeGeometry->setBatchInstanceDimensions(Ogre::Vector3(12000.0, 2000, 12000.0));
		this->mSnowflakeGeometry->setOrigin(Ogre::Vector3::ZERO);
	}
update of the particlesystem:

Code: Select all

public: void _update(Ogre::Real timeElapsed)
{
	// Only update if attached to a node
	if (!this->mParentNode)
		return;

	this->_triggerAffectors(timeElapsed);

	if(mIsEmitting)
	{
		// Emit new particles
		this->_triggerEmitters(timeElapsed);
	}

	//removing particles which are stored for remove
	for(std::list<IParticle*>::iterator i = this->mRemovedParticles.begin(); i != this->mRemovedParticles.end(); i++)
	{
		this->mParticles.remove(*i);
	}
	this->mRemovedParticles.clear();

	//just do somethin when particles exist
	if(this->mParticles.size() > 0)
	{
		//first time of using -> create the first batch and setup the material
		if(this->mSnowflakeGeometry->getObjectCount() == 0)
		{
			Ogre::Entity* ent = Ogre::Root::getSingleton().getSceneManager("MainScene")->createEntity("Snowflake.mesh");
			//this the same code as in the instancing sample, just a little bit adjusted to my code
			Ogre::SubEntity* se = ent->getSubEntity(0);
			Ogre::String materialName= se->getMaterialName() + "\Instanced";
			Ogre::MaterialPtr originalMaterial = Ogre::MaterialManager::getSingleton ().getByName (se->getMaterialName());
			Ogre::MaterialPtr  instancedMaterial = Ogre::MaterialManager::getSingleton().getByName(materialName);

			if(instancedMaterial.isNull())
			{
				instancedMaterial = originalMaterial->clone(materialName);
				instancedMaterial->load();
				Ogre::Technique::PassIterator pIt = instancedMaterial->getBestTechnique ()->getPassIterator();
				while (pIt.hasMoreElements())
				{
					Ogre::Pass * const p = pIt.getNext();
					p->setVertexProgram("Instancing", false);
					p->setShadowCasterVertexProgram("InstancingShadowCaster");
				}
			}
			instancedMaterial->load();
			se->setMaterialName(materialName);

			//finally add the first 80 entitys
			for(int i = 0; i < 80; i++)
				this->mSnowflakeGeometry->addEntity(ent, Ogre::Vector3::ZERO);

			this->mInstancedObjects = 80;
			this->mSnowflakeGeometry->build();
		}

		//create new batchinstances when needed
		while(this->mInstancedObjects < this->mParticles.size())
		{
			this->mSnowflakeGeometry->addBatchInstance();
			this->mInstancedObjects += 80;
		}

		//go through particle liste and instanced objects to set the positions/orientations/scales
		Ogre::InstancedGeometry::BatchInstanceIterator regIt = this->mSnowflakeGeometry->getBatchInstanceIterator();
		this->mParticleIterator = this->mParticles.begin();

		while(regIt.hasMoreElements())
		{
			Ogre::InstancedGeometry::BatchInstance *r = regIt.getNext();
			Ogre::InstancedGeometry::BatchInstance::InstancedObjectIterator bit = r->getObjectIterator();

			while(bit.hasMoreElements())
			{
				Ogre::InstancedGeometry::InstancedObject* obj = bit.getNext();

				((IParticle*)*this->mParticleIterator)->setProperties(obj);

				if(this->mParticleIterator != (--this->mParticles.end()))
					this->mParticleIterator++;
			}
		}
	}
}
update of InstancedObject in the particle:

Code: Select all

public: void setProperties(Ogre::InstancedGeometry::InstancedObject* pObject)
{
	pObject->setPosition(this->mPosition);
	pObject->rotate(this->mOrientation);
	pObject->setScale(this->mScale);
}
Edit:
Everything else is working fine... I'm having now a batchcount far below 1000 and the fps are very good at staying over 10fps at "high" particlecount (50000-60000), also all existing paritcles are touched -> the batchinstances are created. :)

Re: displaying many SceneNodes

Posted: Thu Feb 16, 2012 12:53 pm
by hoppelmoppel
For me your post is a little bit confusing :) Please explain again the current problem.

1) I dunno how you are removing your particles. The problem with the current implementation of the InstancedGeometry is, that there is no direct way to remove InstancedObjects or batches.
2) The second problem with the InstancedGeometry is, that there is nothing such like a region .. where the frustrum culling prevents the computing of invisible objects. A batch is completely rendered if only a small part is visible.

So, my solution to access these problems is composed of two parts:
1) I've split the area up in quadratic regions, based on the world size. The InstancedGeometry covers the whole world. And the batches are spread over the regions. This worked for me, because I had no spatial moving of objects, only in the height. I assume this doesn't work for a particle system.

2) If you want to remove batches, you need to subclass the InstancedGeometry class to access the necessary objects and to write your own removing methods. So it should be easy to delete a complete batch. Deleting particular InstancedObjects is more tricky. Basically you can't reduce the InstancedObject count of one batch. What you can do is to reuse the scale, orientation and position of an other InstancedObject. So you are overlapping two ore more InstancedObjects. But be aware .. you need to keep track of the free slots, and maybe fill them later, before you are creating a new batch. Unless it's a waste of memory and performance. One solution is shift an object from the last batch (e.g. of the region) to the free slot. If all slots of a batch are free now, you can delete it.

Yes, the position of the InstancedObjects is related to the world space. If you aren't sure what happens, reduce the particle cound and show the bounding box of the batches. So you can track them easier.

Your updating system seems to be synchron to the frame rendering. Maybe you should consider to do this somehow in a parallel way. This is also tricky, threading must be enabled, and afail you need to reuse the scene manager mutex to protect it from parallel access. But it should be faster though. I mean .. if you are changing thousands of particels during the rendering of one frame .. it will stuck. You could also do the updating over several frames.

BR

Re: displaying many SceneNodes

Posted: Thu Feb 16, 2012 1:21 pm
by Onsokumaru
the current problem is just that not every Particle will be displayed... at the beginning everything looks fine but there are just some particles even when I'm at a count of 1000 particles. there should be a crowd of particles to see ;) Later I'll get flickering of particles everywhere which tells me the particles all exist (I also checked if all particles will be touched), but don't get displayed.. for whatever reason. (I'm speaking here about particlecount up to 10.000-20.000 in an area with a radius of 1.000 units around the camera position).

What I meant with the removal of particles is the following:

I'm NOT removing particles from instancedgeometry, I'm removing particles from my particle list (as you can see in my source).
When I'm iterating through the instancedobjects I'm also iterating through my particlelist. That's the point where I said I'll have changes, because in this way I can't ensure that a instancedobject will represent the same particle forever (or at least for the particles lifetime) and thats causing, in combination with not showing every particle, the flickering. Maybe that's more clear ;)
If the last particle is reached all remaining instanced objects get the position/orientation/scale of the last particle :)
With this way I'll never reduce the instanced geometry.

you're right I see no way that soluton 1) would work for a particle system.

To 2):
I'm keeping track on how many slots I created and just wenn my particle list gets bigger than this value new BatchInstances will be created. As said I'm doing the overlapping of the "unused" objects. Removing of Batches will not be necessary since the actual implementation is so configured that sometime a peak is reached and the particlecount will be stable around this peak (in worst case the peak is the particlequota).

Updating is synchron to frame rendering and I know that threading would give a better performance. That's an optimization approach which will be mentioned but I won't implement. I'm more stuff when just the particle system so I had to look where are my priorities and so I decided to show what could be possible, what can be realized and deliver an approach for implementing this. It's not very efficient what I have but it works and optimization of this stuff will give at least enough material for one more thesis or something like this ;)

Re: displaying many SceneNodes

Posted: Thu Feb 16, 2012 1:45 pm
by hoppelmoppel
I am sry, but I don't know what's causing the flickering. Does it happen when the camera is steady? Are you moving the cam? Does it also happen when you spread the particle over a bigger area? Maybe you could consider to spread them over a bigger area, with a bigger scale and a further camera.

Re: displaying many SceneNodes

Posted: Thu Feb 16, 2012 4:00 pm
by Onsokumaru
it happens when camera is steady, when camera is moving, area doesn't matter also doesn't scale of objects.
Here are two shots of my both versions (the old one with nodes and the new one with instanced geometry) with inital camera position and no changes... software was running just some seconds. It should look like in the scenenodes version.

instanced geometry @ 2500 particles
Image

nodes @ 2000 particles
Image

The flickering always happens when I remove particles in a frame and it gets worse when I remove more particles. I'm sure that's the reason for flickering.

Here is a example: I'm building up a particlelist and manipulate the instancedobjects with the information of my particles stored in this list. The I begin to remove particles because they reached the terrain. The order of instancedobjects does not change, but the order of the particlelist -> which means that the same instanced object gets information not related to the particle before. Maybe I shouldn't call it flickering but jumping around?
In fact when I remove the 4th particle, 4th instanced object gets for this frame now information of the 5th particle, 5th object of 6th particle and so on. This changes happen more often when particles are removed more often. When just the first 80 objects are rendered sometime the order of the particle list is a total different when at the beginning and total differend objects are rendered.

Short: I suppose that all particles exist and only some are rendered. When particles get removed and the order of the particlelist changes where is also a change in which particles get rendered. But all Objects should be rendered! :)

So the actual problem is that not all instanced objects are rendered. Maybe are just the 80 of the first batch rendered? As you can see there are not enough particles visible. Maybe I have overseen a option which has to be configured/set?

Re: displaying many SceneNodes

Posted: Thu Feb 16, 2012 6:51 pm
by hoppelmoppel
What do you want to approach? Is it somethink like a shower of meteors?

It seems pretty weird to me what you are doing. You say if one of the instanced objects is freed all other objects are shifted one position forward. What happens with the last slot of the batch? What if all particles of the batch have hit the ground?
Anyway, I think there are too many shifting operations. Why aren't you shifting only the last object of the batch to the free slot? Is the order within the batch importand?

Basically .. if you are having trouble with the InstancedGeometry .. debug it. Print out the position of the objects .. or step through them within the debuger.

Re: displaying many SceneNodes

Posted: Thu Feb 16, 2012 7:10 pm
by Onsokumaru
I see that you absolutely don't get my explanations what maybe is my fault and my "talent" to explain stuff... :/

What I want to approach is a physics based snowfall with 3D snowflakes and some stuff connected to this.

No instanced object is "freed". I'm just saying that If a particle gets removed all following instanced objects possibly get information of other still existing particles and have a big location-jump, so if there are particles rmeoved and the positions get changed drastically I'll have this "flickering" because the rendered particles becomes now rendered somewhere absolutely else. This is correct for me but it causes this flickering when not all particles are rendered. I'm not really complaining about the flickering, but about that not every entity I'll put into the instanced geometry and then it's clones (or what they actual become) in the other instanced batches will not be rendered. The instanced geometry itself will not be touched in size, except increasing it with new instances. So where is nothing with the last slot of a batch... it's always occupied by a entity. The worst thing that could happen is that I'll have 80 or more entitys at the same position with same orientation with same scale.

I don't do particle stuff with the instanced geometry because I see it as a container for many objects. So what I'm doing is to calculate with my particlesystem in my classes all the positions and stuff and then just applying them to all the objects in this "container"/instancedgeometry. There is now shifting in the instancedgeometry, just updating of positions, scales and orientations.

There is no problem with the positions, they'll calculated in the same way as in the node version. There are no changes in the calculation only in the representation. Don't think that debugging will help me in this case when objects just don't get rendered.

Re: displaying many SceneNodes

Posted: Thu Feb 16, 2012 8:18 pm
by hoppelmoppel
Well, if you are reusing the instanced objects it's fine :) Don't get me wrong .. but you should debug the positions of the instanced objects though. Unless you are 100% sure that your code is true, add some traces with every instanced object update. It's more likely that you did something wrong, than with the InstancedGeometry itself.

What you can also do, is to replace your mesh with an other one, e.g. one from the instancing sample in the sdk.

Re: displaying many SceneNodes

Posted: Sun Feb 19, 2012 7:11 pm
by Onsokumaru
After some investigation I'm back and I won't give up ;)

I think it's something stupid. I've done several tests but nothing helped. As a last attempt I tried the razor mesh from the sample... first without and after that with material... it works. What the heck? How special a mesh has to be or which requirements have to be fulfilled to work for instanced geometry?

I don't think that it will help or be interesting for this since I now think that it is the mesh but...
anyway here are the other things I tried before:

Positions:
I checked that and I saw that I get in some special cases infinity positions ect. I have this bug also in older Versions so the calculation still is the same... anyway I did a workaround so that this won't happen and it made no difference to the problem. So that wasn't it.

Batching:
I just created the first Batch (that where I'm adding the entitys). Result: only the first object will be displayed.. if the paritcle dies the object gets the position of the next existing particle in the list. So it's working correct, but as I suspected not all particles are displayed. So if I enable batchinstance adding I always will only see the first object of every batch. I doesn't matter if I'm cloning the entity or not (I thought the instancedgeometry will this do automatically for me... if not it changes nothing which way i choose for adding)
I also tried that I'll create new instancedgeometries instead of adding new instances. Not very surprising that I got the same results.

So I hope when I've found this problem now someone has helpful hints for me ;)
Information to my mesh:
72 vertices
created in blender 2.5 (no double sided normals, cloned all triangles and inversed the normals so that they'll be visible from everyside, meshexporter is not able to export double sided normals), just some tris mixed up together in "sphereshape"
exportet in blender 2.49 since there's no working exporter for 2.5+ (Ok I didn't check for the last 6 month if something happened in this direction)

I remember now that I'm gettin a warning about my mesh because it's to old format and I should use the mesh upgrade tool. maybe that's it... I'll try tomorrow or the next days to upgrade the mesh (hope I get this working xD ). If this is the problem... people if didn't happen so until now... make a new good blenderexporter or finish it (I know that where was some coding about this) so it gets posted on the ogresite.. at the moment I don't see there something new.

Re: displaying many SceneNodes

Posted: Sun Feb 19, 2012 7:28 pm
by Jabberwocky
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.

Re: displaying many SceneNodes

Posted: Sun Feb 19, 2012 7:37 pm
by Onsokumaru
Thanks for your hints. I'll try this out and give feedback :)

Re: displaying many SceneNodes

Posted: Mon Feb 20, 2012 12:59 pm
by hoppelmoppel
Onsokumaru wrote: Batching:
I just created the first Batch (that where I'm adding the entitys). Result: only the first object will be displayed.. if the paritcle dies the object gets the position of the next existing particle in the list. So it's working correct, but as I suspected not all particles are displayed. So if I enable batchinstance adding I always will only see the first object of every batch. I doesn't matter if I'm cloning the entity or not (I thought the instancedgeometry will this do automatically for me... if not it changes nothing which way i choose for adding)
Again: Check the positions of the instanced objects within the initial batch.
hoppelmoppel wrote: 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

Re: displaying many SceneNodes

Posted: Thu Feb 23, 2012 5:57 pm
by Onsokumaru
So I've checked the meshes and there were differences. I've tried to remove them all with the new blender 2.5 exporter and had success with the most of them. There's still one difference in the vertex buffer layout and its not working:

working mesh:
Buffer layout: p(f3)n(f3)u(f2)

my mesh:
Buffer layout: p(f3)n(f3)

So I suppose that u(f2) is texture coordinate with two floats, but I don't know how to get an export which creates this (tried to add a texture in blender, didn't help). I also tried to change the export options but it made no difference to this point. Everything else is the same type of values. The material wasn't it too and I don't use skeletons.

@hoppelmoppel

Believe me... I checked the positions againd and again and again... since they're all looking good (except the ones with infinity which I've fixed) there is nothing wrong with the positions. They're also working with the razor-mesh and there it is visible that the positions are right! I'm thankful for your help and hints. They helped me to get this stuff working up to this point but I wish you would read the postings of me a little bit more carefully and maybe have a look on the source I've posted some postings ago, because much of this stuff I answered or explained to you in the last postings are obvious if you'd look into the source. Concrete in your last posting you would have seen that I'm following step 5 & 6 of your guide (this is obvious by code and also by my last explanations... since I'm updating positions every frame)! It's not lazyness and also not that I want someone to do my work that I poste source or anything like this... it's to provide more information to get the situation clearer.

Re: displaying many SceneNodes

Posted: Fri Feb 24, 2012 3:31 pm
by hoppelmoppel
Onsokumaru wrote: I think it's something stupid. I've done several tests but nothing helped. As a last attempt I tried the razor mesh from the sample... first without and after that with material... it works. What the heck? How special a mesh has to be or which requirements have to be fulfilled to work for instanced geometry?
I'm sorry and you are right. I didn't read your post carefully enough.

Are you talking about this (instanced geometry)?
Note:
Warning: this class only works with indexed triangle lists at the moment, do not pass it triangle strips, fans or lines / points, or unindexed geometry.
Dunno, how to export a model properly with blender .. always used existing ones.

Re: displaying many SceneNodes

Posted: Sat Feb 25, 2012 4:54 pm
by Onsokumaru
I got it working... I have now my mesh with the needed vertex buffer layout and now I see all particles. There are still bugs but they're related to my code so I suppose that this problem is solved. I'll put a summary in the initial posting of this thread. Thanks!