Author Topic: Does the fog affect the performance heavily?  (Read 2588 times)

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
Does the fog affect the performance heavily?
« on: April 07, 2013, 03:47:29 pm »
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:

Code: [Select]
world.setFogging(World.FOGGING_ENABLED);
 world.setFogParameters(3000, 3500, 155, 155, 155);

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Does the fog affect the performance heavily?
« Reply #1 on: April 08, 2013, 07:20:06 am »
Which OpenGL mode are you using (1.x or 2.0)?

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
Re: Does the fog affect the performance heavily?
« Reply #2 on: April 08, 2013, 08:42:18 am »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Does the fog affect the performance heavily?
« Reply #3 on: April 08, 2013, 10:17:55 am »
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?

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
Re: Does the fog affect the performance heavily?
« Reply #4 on: April 18, 2013, 05:30:31 am »
Can you tell me how many texture layers and lights affect the fogged objects?

Only one texture layer, and only ambientLight.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Does the fog affect the performance heavily?
« Reply #5 on: April 18, 2013, 08:28:04 am »
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.