Voxel Rendering on Zune

This month’s sample is an attempt to voxel rendering on Zune.

Unfortunately, the results are not as good as I would have hoped, both from a quality and performance point of view. I tried optimizing the code by using some fixed point number computations, but there was no gain in performance (strangely), so I switched back to floating point.

Feel free to use the code in whatever way you wish.


The controls are:


  • Left Analog GamePad Stick to turn and move forward / backward
  • A GamePad Button to move upwards on the Y axis
  • B GamePad Button to move downwards on the Y Axis


  • Touch pad to turn and move forward / backward
  • Click touchpad to move upwards
  • Click Play/Pause to move downwards

You can grab the source code here: voxeltest.zip.

  • Pingback: Catalin Zima - XNA and HLSL blog » June Sample online: Voxels on Zune

  • CDarksight

    Hey nice sample Catalin Zima, it opened my eyes to other rendering techniques.

    But, as you said performance wise this isnt very good. So I did some messing around with your code and managed to get a drop on the CPU ( On My comp) from 52% to a average of 40%. I did it by changing are your while loops to if statements as well as making the Vertical Retracing sync with the refresh rate, which I also changed to be a fixed time.I’ve also changed the SpriteBatch.Begin(SpriteBlendMode.None)’s as well.
    I’ve also updated it to the 3.0 Beta of XNA. Hope you don’t mind. You can see the changes I’ve made as well as download the sample by going to the adress as described at the bottom of this post.Full Credit goes to you of course for making it. Now I wasnt able to improve the quality 🙁 but at least i’ve managed to make it use less CPU. I did not test this on the Zune, because I don’t have one, but it should work the same.But On the PC I tested this with a resolution of 1280×720 and it runs just as well.


  • http://www.catalinzima.com Catalin Zima

    Of course I don’t mind people taking my samples and making them better 🙂 I encourage it.

    Quality can be improved in several ways, for example by using bilinear filtering on texture fetches, and other things.
    However, I gave up improving on quality because the performance was unsatisfying. One of the most important improvements would be to convert all that floating points math into integer math (by using fixed point representation, for example), but I wasn’t successful with that.

    Thanks for the sample. I’ll take a look at it, and see how it goes on the Zune, but it will have to wait until the DBP deadline passes 🙂

  • CDarksight

    Aight cool then, thanks.

  • http://www.awkwardgames.wordpress.com Tayron

    awesome tutorial! think I’m gonna scale this up a bit for a bigger project. just a suggestion. try not to use gamepad input. some people don’t have xbox gamepads, and it’s kinda annoying…again, awesome:)