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? šŸ˜‰

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s