High texture count

The characters are made using a for-loop.
I only wonder why I have > 1000 Textures instead of re-using the texture over and over?

The Problem with this is: I have low fps but the GPU load is also nearly 0 as most of the time passes by loading textures into the gpu memory.

Pretty sure those are texture switches you are seeing and not actual textures.

…most likely cause is maybe you have them all in the transparent bucket and they use multiple textures.

You were right, that solved the issue with the high Texture and Shader count. Thanks :smile:

Unfortunately the GPU Load is still pretty low and the fps aswell. Is there something I could do about the uniform count?
Or is there something at all I could do about that? (Despite reducing the poly/tri/vert count).

I cant use a BatchGeometry when I have multiple textures (like different NPCs) and especially when animating them, I guess?

I don’r really know anything about your scene.

Are those guys animated? How many of them are there? Hardware or software skinning?

Too many unanswered questions.

They are animated, It is there Idle Pose.
Those are 50, because lateron I want to have different characters walking the streets and such so this was a stress-test.

I don’t know what you mean with Hardware/Software Skinning, though. I simply imported some Blender/MakeHuman Models.

You have over 1.3m vertices in that scene already. You said you have there 50 character. Thus, if i have to guess one is made of 20000 vertices or so. I would certainly reduce the vertex count for each character. (eg.: i’d use decimate modfier in blender)

I suggest lowering the object count, batch stuff. If you have a low gpu usage it can be a sign that you are cpu limited, and having a high object count is unfortunatly limiting the cpu.

Depending on your target platform, i would not consider 1.3mio vertices a problem.

Hey,
I thought about reducing the vertice count but I want to keep that level of detail (i.e. don’t have it look PS2-ish).
I came up with the idea of deleting that part of the mesh that is covered by clothes but that way I cant switch clothing (having her wear a bikini)

My target platform would be PC’s with at least a ~ 4-5 years old GPU.
IIRC I had a cpu load of 1% and the RAM also had some ressources free. I did not change the Xmx or something however. It’s JMP default.

My platform is currently:

CPU: 4x 2.83 GHz (Q9660? Intel.)
8 GB DDR2 RAM
ATI Radeon HD6870 (1.5GB Memory)

The thing is, without that many NPCS the GPU load was atleast 50%, now it’s next to nothing.
But: I did not see the CPU coming up either, hence the idea that the bus is overloaded.

What would you consider the vertice/tri max for such a system? (As I also don’t have any consuming postFX, GUI Elements, Shadows, etc).

Try to reduce objects count, for example hide NPC’s that are not seen by the camera, don’t allow to show too many of them at one place. It just work this way, at every frame CPU need to do some work with all the objects. The more objects on scene, the more work to do. All that work should be done in 1/60 second, because you need at least 60fps for smooth gameplay.
If you think that you have problem with the bus, just try to remove textures. And if you have textures in png/jpg format, try to use something more ‘OpenGL friendly’, like dds. Probably, in the case that everything is ok, it would only reduce the initial loading time, but if you messed up something you should see the difference.

They are all in 4096x4096 resolution .jpg/png which I know is bad, but I wanted to have cool graphics :stuck_out_tongue:

I don’t get why dds’ing should only reduce the loading time. I thought dds is some GPU memory friendly but compressed image whereas jpg’s get stored on a per-pixel-base?
Or rather: what could be wrong that dds makes it faster? (Maybe because the files are mip-mapped and save memory?)

But: my assets.jar has 180MiB. Even uncompressed that should be less than the GPUs 1.5GB Memory.
On the other hand I know that there are only several (10?) GL_TEXTURE0 … GL_TEXTUREN

Dds is readable by GPU in its compressed form, while jpg and png are not. Compressed jpg needs to be uncompressed and saved in memory as a raster, it needs 24bits per pixel. Same with png, but there you’ll have 32bits per pixel (8 extra bits are alpha channel).

Reduce the textures resolution to the absolute minimum. Don’t tell me that you need to have 4096x4096 for NPC.
Again, reduce the NPCs count. There is a bottleneck somewhere, try to find it.

I now checked it: The 4096x4096 are only the ones I use for walls (too high anyway).
The MakeHuman one’s are either 2048 or 1024.

I am now giving DDS a try and we will see what happens. Could I manually set a “Highest MipMap” to see which resolution I’d possibly go for? (Without the need to redo the texture everytime).

PS: If I reduce them to 10 NPCs I get reasonable 25 FPS.

Edit: I am ashamed. I only measured the CPU load whilst the Game didn’t have Focus.
I now used the profiler to change some bad designed Controls. Whilst programming them I didn’t see their impact, but it sums up.

Beside that, you don’t see the cpu overhead from the driver. If you want to profile in depth you have to use api trace or a similar tool that allows tracing the gl calls.

But as a general rule of performance bottleneck:
Object count hits way!!! more then vertex count.

Buffer updates are also not that cheap as it might seem. GeometryBatchFactory > SimpleBatchNode > BatchNode

I didn’t read all of the advices you’ve been given, but reducing the triangle count can definitely help.
But IMO here the bottleneck is animating the 50 characters on the CPU (would explain why your GPU idles.)

And that’s what you need to dig into. Sofware skinning will update the animations of your characters on the CPU by updating the mesh’s position buffer on every frame. It can strees the CPU pretty fast if you have a lot of characters.
Hardware skinning will send the transforms of each vertex to the GPU and the transformation will take place in the vertex shader.

Here it can help a lot in your scene so it worth the try.
to enable hardware skinning on a model :

model.getControl(SkeletonControl.class).setHardwareSkinningPreferred(true);

This will enable hardware skinning if your hardware supports it.

I am sorry for the confusion guys,
I made the mistake to post some related Information into my other thread (even though it would belong here).

Conclusion: I currently have a high “overhead” of the animation .reset() (which recursively loops through the bones) even though I am not using the animation. (1500 FPS vs 80 FPS).

This should be doable just as Hardware Skinning is, if I am right? (But I guess JME is not doing it because even with Hardware Skinning on, I have the CPU Load).

Is there a way to do this? (To cancel resets on culled characters)?
And is there another thing like Hardware Skinning as it improved the situation very well?

I now have 25 FPS whilst drawing them and 40 FPS without (so the sole CPU-Update time). (33% GPU Stress, 40% CPU usage)

Edit: with object count you mean the Geometry count? I only wonder how as I can’t batch Animated objects I guess. And the characters wont look the same

Your screenshots show an object count of ~600, which seem to be a lot for that scene, because of that i tought that could be an issue.

But if you can trace your issue to the animations, than thats the place where you should start.

as soon as you have a SkeletonControl it updates the mesh on each frame even if you are in the rest pose.

Either you didn’t do it as it should (I mean activating it), either your hardware doesn’t support it (but it should pop a warning in the console), either you have something else that is causing the strain on the CPU.
With Hardware skinning enabled you won’t have the reset called.

See TestHardwareSkinning in the git repo.

Try to write your own AnimControl, copy all the code and try to do some things in your way.
If it is impossible or too hard then you can make your own control, remove animcontrol and skeletoncontrol from spatial and keep them inside your control, call them only when you need.

I don’t know if these solutions are clean but in the nearest future I’ll do something similar for my own game.

Oh okay, so I need to look further in that.

My Hardware is openGL 4.x (GLSL 1.5) compatible and it Shows in console that is enabled (or atleast prefered).

I might be missing out some skeletons, I need to look into that.

Btw: multiple skeletons per char are senceless overhead aswell?

Edit: I double checked it, I have a SceneGraphVIsitor on the Spatial and for every SkeletonControl it finds, it uses .setHardwareSkinningPreferred(true); but still I get reset and updateWorldvectors calls

Edit: Mai 03, 2015 10:19:58 PM com.jme3.animation.SkeletonControl controlRender
Information: Hardware skinning engaged for Feter_Pramton:tongue01 (Node)

Engaged means “supported by Hardware”?

@nehon:
I just took a look into SkeletonControls’ Source-Code.
My problem is that I have multiple SkeletonControls which seems to be wrong?

Can I manually add a SkeletonControl on the Main-Node? SourceCode says it would automatically scan and attach the targets, but I don’t know what Skeleton to supply.

I don’t know If i could use one random Skeleton of my SubMeshes or if I’d have to “join” them somehow?