Springy Grass revisited
Posted: Mon Jan 09, 2006 4:30 pm
I was looking for a good way to animate grass and I came upon this thread http://www.ogre3d.org/phpBB2/viewtopic.php?t=3742 (which is quite old - hence the new topic).
I downloaded the grassdemo.rar file and built the source code only to be dissappointed to see a 15-20 fps speed and no object to move around in the grass. Since this was unacceptable for my purposes, I messed around a bit with the code, added a ball which is movable with the arrow keys, changed the material (which was handled incorrectly in the code btw), randomized the width,height and initial bend of the blades a little... and this is a screenshot of the result:
...as in 10x faster! I still haven't got the material to display 100% correcty but it's much better than before. This screenshot is for 5000 grass blades.
The demo starts animating the whole 5000 blades at the same time (as in wind e.g.) The avg frame rate at this point is around 80fps on my setup. (press 'f' and see what you get for yours) after a few seconds the demo goes into "optimised" mode and animates only the blades that are collided with the sphere, hence >160fps.
Here's the full modified source code and executable for anyone interested (built with OgreSDK 1.0.6)
http://server-5.iti.gr/filippid/GrassOptimized.rar
I downloaded the grassdemo.rar file and built the source code only to be dissappointed to see a 15-20 fps speed and no object to move around in the grass. Since this was unacceptable for my purposes, I messed around a bit with the code, added a ball which is movable with the arrow keys, changed the material (which was handled incorrectly in the code btw), randomized the width,height and initial bend of the blades a little... and this is a screenshot of the result:
...as in 10x faster! I still haven't got the material to display 100% correcty but it's much better than before. This screenshot is for 5000 grass blades.
The demo starts animating the whole 5000 blades at the same time (as in wind e.g.) The avg frame rate at this point is around 80fps on my setup. (press 'f' and see what you get for yours) after a few seconds the demo goes into "optimised" mode and animates only the blades that are collided with the sphere, hence >160fps.
Here's the full modified source code and executable for anyone interested (built with OgreSDK 1.0.6)
http://server-5.iti.gr/filippid/GrassOptimized.rar