Excess textures unnecessarily slowing down game

Hey everyone, just started playing around with jme3 a week ago and so far I love it! I’m making a simple third-person shooter set in space, think starfox with EVE online. So far it’s very primitive, I just have planets of various size that fly around a central star at random speeds and paths (you can also select a planet and will automatically fly there). The problem is that the game seems to be unnecessarily slowing down with the more Materials I have loaded. The pictures below show a galaxy with 200 planets, each with their own Material instance.



The first screen is at 92 fps whereas it usually runs around 300 fps when I have <50 planets. The first screen also has around 29k triangles but I highly doubt that’s the problem seeing as I have gotten good performance when rendering more triangles with less Materials loaded.



I know I can use a single material for each planet but I want each planet to have it’s own color/texture, is there a way to do this and cut down on my Materials at the same time?



Also I have a couple of other related questions:

-Is Material essentially a wrapper for shaders?

-What do the M, F, and S stand for in the statistics view?

-What are Uniforms in the stats view?



tl;dr: I have too many materials loaded which are slowing down my game, how do I fix this?











Thanks alot for your help, I really appreciate it!

Unnecessary copies of textures have been fixed in the latest svn version, shaders are reused, the other material data is neglectible.

-Is Material essentially a wrapper for shaders?

Yes

-What do the M, F, and S stand for in the statistics view?

Memory, Frame and Switches.

Memory is how many of said object are currently in OpenGL memory, Frame is how many of said object were used in the last frame, and Switches is how many times OpenGL state switched for said object.

The Memory and Frame indicates unique objects, so if you have many models that use one texture it should say 1.

-What are Uniforms in the stats view?

How many uniforms were set for the last frame.