PDA

View Full Version : Point sprites and fog a... deadly combination?



Dcower
02-18-2005, 01:35 PM
For whatever reason, fog and point sprites don't mix. Even one extremely small point sprite shown while fog is enabled will slow my app down considerably. Without fog, everything runs nice and smooth.

I'm using the "Hybrid Graphics OpenGL ES 1.1 implementations" for "x86 PCs running Win2000/XP."

gautam
02-20-2005, 09:47 PM
Maybe you should use attenuation maps for fogs. Fog calculations can be quite expensive.

jasin
02-21-2005, 05:50 AM
Hi,

The fact that the application slows down considerably when enabling fog has probably more to do with the internal shader cache than the actual cost of the fog computations.

You see, our implementation has a runtime compiler for the pixel pipeline and a cache to store a certain amount of pixel pipeline programs generated by the compiler. Altering the state affecting the pixel pipeline causes a recompilation unless a program with the same relevant state is already found in the cache. If all the required programs do not fit in the cache, one might get recompilations each frame.

We're planning to upgrade the pipeline cache to be auto-growable. Hopefully the next release will contain this optimization. In the meantime, and in general too, make sure you do the following tricks:

- Ensure you're not doing any unnecessary state changes, especially ones that affect the pixel pipeline. These might cause a recompilation and fill up the cache.
- Sort your rendering calls according to the state if you can. This way you'll minimize the amount of state changes, which in turn will reduce the time spent in the compiler.

Hope this helps.
Jasin

PS. You might want to check out our community forums at http://forum.hybrid.fi . We'll post notifications of our new releases there - and lots of other stuff as well!