To Node or not to Node

  Just a few questions about 3d models … first off should every model have its own node?? for example if I were to build a city with lets say 10 buildings … should each building be attached to its own node ??? or should there be one (city)node …  and attached all the models to that one node. Also I've noticed that if I attach the model as a node to the rootNode and add a controller like this …



addController(new Controller() {

  private static final long serialVersionUID = 1L;

      public void update(float time) {

        process();

    }

});



even with the process method totally empty I get a few hundred fps increase … if the controller is removed the fps decreases … anyone have any insight on this?? I ask this because it doesn't work when the controller is attached to a Spatial only a Node.



  Second … what would be the best format to use … most of my models will be static with little or no animation. I've mostly used the 3ds format but with jme I seem to be having some memory problems with this particular format … larger models with many different textures seem to be giving me an out of buffer memory error.



Any suggestions before I get to much further with my project??

well there are definately benefits in performance you can gain by dividing these 10 buildings into their own nodes.



If you set the bounds on them, then they will not take up memory if they arent being drawn on the screen. If you have all 10 of these builds in 1 model, then it loads the entire model into memory, which is less efficient.



so, whatever you want to do.

ok seems like the way to go is put every thing on its own node when ever possible. But what about the terrain, I've noticed that even when the terrain is on its own node the entire terrain seems to be drawn at all times weather I can see the whole thing or not … I know this because I have the fpsNode displaying fps and total mesh vert and tri counts. If a look at a model the count goes up by the given count in the model and then goes down when the model is out of view … but the count for the terrain seems to never change … shouldn't it be constantly changing depending on how much of the terrain I am looking at?? I do have bounds set for the terrain and its on its own Node.

phmenard said:

Second ... what would be the best format to use ... most of my models will be static with little or no animation. I've mostly used the 3ds format but with jme I seem to be having some memory problems with this particular format ... larger models with many different textures seem to be giving me an out of buffer memory error.

It is best, when you convert your models into the jme format, so your program doesn't have to do this any time you load them.

phmenard said:

ok seems like the way to go is put every thing on its own node when ever possible. But what about the terrain, I've noticed that even when the terrain is on its own node the entire terrain seems to be drawn at all times weather I can see the whole thing or not ... I know this because I have the fpsNode displaying fps and total mesh vert and tri counts. If a look at a model the count goes up by the given count in the model and then goes down when the model is out of view ... but the count for the terrain seems to never change ... shouldn't it be constantly changing depending on how much of the terrain I am looking at?? I do have bounds set for the terrain and its on its own Node.

When you have meshes that share render states it could make sense to merge them into one mesh. Modern graphics cards can render a lot of triangles, before you even feel a performance impact. The number of batches/draw-calls is more important. So the best way is probably to use rough frustum culling of nodes, and then have around 100-300 nodes drawn.

phmenard said:

ok seems like the way to go is put every thing on its own node when ever possible. But what about the terrain, I've noticed that even when the terrain is on its own node the entire terrain seems to be drawn at all times weather I can see the whole thing or not ... I know this because I have the fpsNode displaying fps and total mesh vert and tri counts. If a look at a model the count goes up by the given count in the model and then goes down when the model is out of view ... but the count for the terrain seems to never change ... shouldn't it be constantly changing depending on how much of the terrain I am looking at?? I do have bounds set for the terrain and its on its own Node.


Are you using terrain-pages or a single terrain-block? When you use a terrain-block there will be no culling. But when you use terrain-pages (they consist of many terrain-blocks), parts of them will be culled.

ahhh ok … I am using a terrain block … so what your saying is I should move to terrain pages to boost performance??

When you want to use the view-frustum-culling of the engine for the terrain, you should switch to terrain-pages, yes.

I took your advice and rewrote my terrain class to use TerrainPages instead … wow what a huge difference … the fps jumped by 400 fps … nice!!! thanks. One problem … there is always one … lol, now my model isn't sitting on the terrain … I'm using the getHeight method of the TerrainPage … doesn't this methode do the same as it did in TerrainBlock??? why is my model under the terrain now??

FYI, here's an interesting screen shot that shows the instantaneous status of all local terrain blocks in the MiniMap widget.



  • grayed = block not loaded/instantiated

  • z = block loaded/instantiated but not attached to scene

  • o = frustum-culled
  • [li]x = intersects frustum (such blocks are not culled)