Showing posts with label Performance. Show all posts
Showing posts with label Performance. Show all posts

Monday, 27 September 2010

Triangle-precision ray collision

Bullet collision was previously calculated using the triangle mesh capabilities of BEPU. This wasn't going to work efficiently with all the separate meshes that are going to be used in our levels. With the basics of triangle-picking already implemented in the editor tools it didn't take a lot of time to get a basic prototype up and running. In the image below you can see the new filtering algorithm.

each "group" (1 big sphere, 8 small ones) contain 41k polygons. (click image to read the text)

In a regular scene with a higher amount of objects with lower polygons per mesh that are spread across the scene, the optimization methods will become more efficient. This will be tested once the prototype level is complete.
The main focus of the new filtering system is excluding hidden models before they enter into the per-triangle collision check. This system is added on top of the bounding-sphere filter that was already present in the editor tool.


Overkill? 150 million triangles both rendered and tested against the bullet ray. This clearly wasn't going to run smoothly (roughly 0.1 fps)

Video:
(use 720p and fullscreen to read the filtering info in the topleft corner)

Monday, 1 March 2010

Engine Update: Particles, Performance & Profiling

Since my last update over a week ago, a lot of progress has been made. First steps for Full-Screen post processing (HDR, Bloom, Gaussian) DPSF Particle system is integrated and works perfectly with Sunburn out-of-the-box. Progress has been made with the level & content management classes, loading/saving works great and a new method .CombineScenePart() is currently WIP to combine scenes or scene parts into a single level.

Other features like the CameraManager is coming along nicely and should be ready very soon. The manager allows you or the engine to add/remove and set a certain camera type and modify its properties. Dynamic actors have been updated, they now return to their original position when returning to EditMode (original being the last assigned position by either Xml or the Editor). Moving the dynamic objects while in PlayMode does not affect the EditMode position of that object.

Finally got some time to work with CLR Profiler. I wasn't sure how to use this little tool to my advantage, but after some hours of fiddling with the engine code and running it through the profiler I got the hang of it. Some silly code errors were altered/removed (Like an old and unused Matrix-array being called every draw-call for my game objects, the Matrix-array had no actual purpose it was merely a left-over from a previous XNA draw method. As a final optimization I had a better look at the xml files that were created when serializing my level data. The demo scene (screen in previous post) required 43.000 lines of xml data (The demo scene had about 350 objects) worth a total of 900 KB. It took me less than 15 minutes to get this down to 7.000 lines without losing any necessary data (A easy way was serializing only the Euler rotation property (of type Vector3) instead of a complete rotation Matrix (Thanks to Sean James)) The final Xml file only requires 150KB of disk space. The overall memory allocation have been decreased, it may be a bit early for memory optimizations, but it was good practice for later stages of development...

Unfortunately I have no new video/screenshots right now. I'll try to get some interesting footage later this week!