Hardware Instancing with XNA (minecraft style)

Lately I have been really enjoying a game called Minecraft. It’s an indie game made by one guy, I highly recommend it!

I have ported the heightmap generation code in one of my earlier posts to C# and using XNA I have been creating a minecraft style rendering for fun. My first approach was a brute force, render everything test. As you might have guessed, that didn’t turn out so well when rendering a decent sized terrain. The method I am using now is hardware instancing without any kind of occlusion culling at the moment. I am getting a decent frame rate (about 80fps for 20000 models) for the moment and I am going to continue on improving this method. The example that is linked at the bottom of this article shows how to perform hardware, and shader instancing.

Here’s a video of it in action:

Links:

Minecraft

XNA Mesh Instancing

Advertisements

Particle System

Today I was kind of bored so I decided to write a simple particle system in XNA. The helpful tutorials over at http://rbwhitaker.wikidot.com/ helped point me in the right direction. This particle system is very primitive at the moment, a particle emitter follows the mouse around the window. When I get the time (or the motivation) I am going to add a few more features such as different particles (smoke, water, fire, etc.), some different effects like attraction and repulsion and maybe the option to place multiple emitters in the scene.

Although this particle system is in 2D, the concepts are easily translated into 3D. Most games engines include a standard particle system like Ogre3D does, but I wanted to learn how to create one from scratch anyway. The image in this post shows the particles following the mouse around the screen. I can post source code on request, but I would rather upload after I add some more features.

XNA Particle System

Here is a download link for the application for you to play around with (windows only) – Link