setTexture DiffuseMap way faster than setColor Diffuse?

I’m using JME3 “3.0+” on a Macbook air.

For some reason when I change:

Material mat_brick = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
mat_brick.setTexture("DiffuseMap", assetManager.loadTexture("Textures/Untitled.png"));
block_geom.setMaterial(mat_brick);

to

Material mat_brick = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
mat_brick.setColor("Diffuse", new ColorRGBA(1f,1f,1f,1f));
block_geom.setMaterial(mat_brick);

My FPS drops from 100+ fps to ~30 fps.

Shouldn’t color be faster than a map? Why is it so much slower?

What’s the complete code?
There can be 1000 reasons, but without the complete code that’s hard to say.

~~

Put together a simple Java test case. When that doesn’t show the issue then you can trace back and figure out what’s really different.

If anything, setting the color should be faster than setting a texture.

Okay took me awhile to get around to this but here it is:

You’ll need a texture in the classpath: Textures/planter.png and then you can press “Z” and “X” to switch on/off. Currently for me it goes from a stable 60 fps to about 29 fps.

More details:

  1. Only happens when I have a directional light with a shadow map
  2. Only happens when I have two objects
  3. Only happens when 1 object is DiffuseMap and the other is Diffuse (color)

Really weird bug, because it shouldn’t make a difference, especially with a shadow map.

Mhh there is a lot of texture switches … (textures uploaded to the GPU). Probably due to the ShadowRenderer.
Gonna look into it.

In the mean time you can use the DirectionalShadowFilter with a FilterPostProcessor. It doesn’t exhibit the issue and you should have the same visual result.

Making an issue in the tracker for this: Issue #247