Thousands of particles

Adding grass was a nice check for my FX system. I was experiencing huge slowdown while dealing with 10,000’s of billboards (grass, bushes, rain, clouds..). After a deeper study I found that it was a quite strange CPU bottleneck inside OGRE system!?

Ogre::BillboardSet->getBillboard()->getPosition() is an official/obvious slow method. Reading Ogre source code :

OgreBillboard.h
00077 public:
00078 // Note the intentional public access to main internal variables used at runtime
00079 // Forcing access via get/set would be too costly for 000’s of billboards
00080 Vector3 mPosition;

Seems nice at first sight. But mPosition access is not really much faster, not enough actually! I added some caching system to avoid accessing those datas. And CPU cost drop down to almost nothing. Eventually I’ve lost 100-200 Kb of Ram but… who cares? 😉

Botanical time is back!

Still working on my Colony management class. Not really difficult, only really long to write 🙂 So I took a little break and decided to add now some classic billboard vegetation, using my FX class. I’ve got the exact same problem than for my trees… I need to add some smart space distribution. But I’m now quite regular with that! To be continued… now it’s time for Jamon, cerveza y Queso!!