Loading model from blender vertex count and wireframe

Hi,



First of all as my first post, I would like to say that I’m impressed with this game engine, the IDE and the multitude of features that it supports and I hope that this will be a good choice for creating an android game.



I imported a model from blender with a texture applied. The model imported fine and looks right in the scene composer. When I run the game with this model, I see that there are almost twice as many vertices as triangles. Also the model is shown with it’s wireframe as well(maybe that is why there are almost twice as many vertices). I tried removing the wireframe, but that didn’t work. Also I read this in the jMonkey help:



“Be mindful of the result model vertices amount. The best results are achieved when the model is smooth and has no texture. Then the vertex amount is equal to the vertex amount in blender. If the model is not smooth or has a generated texture applied then the amount of vertices is 3 times larger than mesh’s triangles amount. If a 2d texture is applied with UV mapping then the vertex count will vary depending on how much the UV map is fragmented.”



I have the model set as “shade smooth” and the texture is UV mapped. I have also tried with no texture and still get twice the vertices.



Is there something I’m missing in removing these extra vertices and making sure the wireframe does not show up, because having twice as many vertices is inefficient, especially since my target platform is the android?

You don’t happen to have physics debugging enabled? I’m thinking maybe you also see the blue wireframe collision mesh.

another possibility is that maybe ur taking into account the frames stats which also have vertices on the guiNode etc. Create an empty jME app, note down the values. Then in you app load ur model and substract those empty values.

Thanks for the reply jmaasing and wezrule.



I did have physics debugging enabled for some reason and didn’t know I had it on because I had blue surfaces for testing. When I removed it and used a model with no textures the triangle and vertex count seem right. I added a texture and the vertex went to about the same as the triangle count as it said it would in the help page. It seems that the page was written a while ago and so there might be some way to avoid this now. So is there some way to avoid increasing vertex count when textures are added?

Are you actually having performance problems? Like in you have measured it carefully on several computers and know for absolute sure that the vertex count is the problem?

If not, don’t worry about it. You are diving into details that in 99,999999999% of the cases are totally irrelevant. Modern GPUs can consume massive amounts of vertex data without flinching.



Focus on making a fun game, good application, whatever, using robust coding practices. Then deal with optimizations like this if it actually is a problem.

1 Like

No, I haven’t actually had any noticeable performance problems, but that’s because it was on PC, but my goal is to use textured models in android. I haven’t tested if there is a performance loss on the android, but I will when I get a chance. I was assuming that having twice the vertex data would be bad especially for a platform with lower system resources such as the android. If the problem was something that was solvable and should be solved, I wanted to fix it so that I wouldn’t have to worry about it later and thus possibly make it more complicated than it really is when I try to fix it later.



So my question is does jME really draw these extra vertices, or is it just data on vertices that is stored. If it is data that is just stored and not drawn, then I probably would not need to worry about it(at least for now).

@hindupower said:
No, I haven't actually had any noticeable performance problems, but that's because it was on PC, but my goal is to use textured models in android. I haven't tested if there is a performance loss on the android, but I will when I get a chance. I was assuming that having twice the vertex data would be bad especially for a platform with lower system resources such as the android. If the problem was something that was solvable and should be solved, I wanted to fix it so that I wouldn't have to worry about it later and thus possibly make it more complicated than it really is when I try to fix it later.

So my question is does jME really draw these extra vertices, or is it just data on vertices that is stored. If it is data that is just stored and not drawn, then I probably would not need to worry about it(at least for now).


Vertexes are drawn. If there are multiples it was because they had to be split to properly support the attributes for the vertex, ie: it needed different normals, texture coordinates, vertex colors, etc... or there is more than one material so the mesh gets split or whatever.

I'm not sure if the blender importer handles all of these cases properly 100% of the time though.

I presume the shader and object count are still what you'd expect?

Yes, the shader and object count seem right. So the SDK creates extra vertices for UV coordinates, materials and such and thus I cannot avoid increasing vertex count?

@hindupower said:
Yes, the shader and object count seem right. So the SDK creates extra vertices for UV coordinates, materials and such and thus I cannot avoid increasing vertex count?


If one triangle shares a vertex _location_ with another triangle but each triangle has _different_ UVs or _different_ normals then of course more than one vertex is needed to properly render the shape.

I guess when the blender loader gets the shape every triangle has its own vertexes or something and then it tries to see what it can share.