Does the fog affect the performance heavily?

Started by kiffa, April 07, 2013, 03:47:29 PM

Previous topic - Next topic

kiffa

In my racing game, if i disable fogging, FPS = 50 - 54,  if i enable, FPS = 38 - 44. I don't know if i use it in a wrong way. Codes:

world.setFogging(World.FOGGING_ENABLED);
world.setFogParameters(3000, 3500, 155, 155, 155);

EgonOlsen

Which OpenGL mode are you using (1.x or 2.0)?

kiffa

2.0

04-08 14:34:15.520: D/Woo3d(26573): GL vendor:NVIDIA Corporation
04-08 14:34:15.520: D/Woo3d(26573): GL version:OpenGL ES 2.0
04-08 14:34:15.530: D/Woo3d(26573): GL renderer:NVIDIA Tegra
04-08 14:34:15.530: D/Woo3d(26573): GLSL version:OpenGL ES GLSL 1.00

EgonOlsen

Fog in OpenGL ES 2.0 is slower than in 1.1 because it has to be done in the fragment shader. Depending on the device that you are using, the performance impact might be normal. However, the set of default shaders is limited and not all of them support fog. So it might happen that you get an optimized shader without fog, but a more generic (=slower) one with fog. Can you tell me how many texture layers and lights affect the fogged objects?

kiffa

Quote from: EgonOlsen on April 08, 2013, 10:17:55 AM
Can you tell me how many texture layers and lights affect the fogged objects?

Only one texture layer, and only ambientLight.

EgonOlsen

Well, that's pretty basic. In that case, there's nothing you can do. The performance impact comes from the additional complexity of the shader. Tegra2 isn't very good when it comes to shaders anyway, so that might be a reason. It might have less of an impact on more powerful chips.