Hi All, A number of people have seen significant performance degradation with the recent 3D cloud enhancements.
The rather simple patch below reduces the number of sprites that are drawn for clouds in the distance, which should help. Unfortunately it seems the performance hit is very GPU-specific, so I would be very interested to hear what (if any) performance improvements people see with it. If it seems to help, and people aren't too bothered by the graphics impact, I'll develop it into a more controllable version. Comments are welcome as always, -Stuart Index: simgear/scene/sky/CloudShaderGeometry.cxx =================================================================== RCS file: /var/cvs/SimGear-0.3/source/simgear/scene/sky/CloudShaderGeometry.cxx,v retrieving revision 1.12 diff -u -p -r1.12 CloudShaderGeometry.cxx --- simgear/scene/sky/CloudShaderGeometry.cxx 2 Oct 2009 05:44:25 -0000 1.12 +++ simgear/scene/sky/CloudShaderGeometry.cxx 14 Oct 2009 21:22:48 -0000 @@ -103,11 +103,19 @@ void CloudShaderGeometry::drawImplementa const Extensions* extensions = getExtensions(state.getContextID(),true); - for(SortData::SortItemList::const_iterator itr = sortData.spriteIdx->begin(), - end = sortData.spriteIdx->end(); - itr != end; - ++itr) { - const CloudSprite& t = _cloudsprites[itr->idx]; + // Find the depth of the center of the cloud, and only draw a proportion + // of the cloud sprites based on it, to improve performance + Vec4f projPos = Vec4f(toOsg(_cloudsprites[0].position), 1.0f) * state.getModelViewMatrix(); + + float depth = projPos.z(); + unsigned int firstSprite = 0; + + if (depth < -5000.0f) { + firstSprite = sortData.spriteIdx->size() * (depth + 5000.0f) / (-15000.0f); + } + + for(unsigned i = firstSprite; i < sortData.spriteIdx->size(); i++) { + const CloudSprite& t = _cloudsprites[sortData.spriteIdx->at(i).idx]; GLfloat ua1[3] = { (GLfloat) t.texture_index_x/varieties_x, (GLfloat) t.texture_index_y/varieties_y, (GLfloat) t.width }; ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel