DirectXTK October 2012 release

The DirectX Tool Kit has been updated with two new features:

  • Added a ScreenGrab module for easily saving rendertarget contents into .dds or other image formats
  • Extended GeometricPrimitive.h with a new CreateGeoSphere method  (thanks to my colleague Adrian Tsai for contributing this code!)

There are also some minor tweaks and bugfixes:

  • Moved DDSTextureLoader and WICTextureLoader into the DirectX C++ namespace
  • Renamed project files for better consistency
  • Extended WICTextureLoader to support Windows 8 96bpp floating point formats
  • Updated Win32 desktop projects to use Windows Vista (0x0600) rather than Windows 7 (0x0601) APIs
  • Tweaked SpriteBatch.cpp to workaround an ARM NEON compiler codegen bug

So what is this GeoSphere thingie, you may well ask, and why might it be better than a plain old fashioned UV sphere primitive?  Shamelessly plagiarizing an explanation from Adrian:

Generally speaking, geospheres are more efficient than non-geodesic spheres (which are typically generated by using rings of vertices along the latitudes/longitudes of the sphere). In an ideal geosphere each triangle has the same area, which means an even distribution of vertices around the sphere. This means geospheres can give better visual quality at the same vertex count.

My implementation approximates an ideal geosphere by recursively subdividing a starting shape – in this case an octahedron. Almost any regular polyhedron can be used, but octahedrons or icosahedrons typically give best results. Starting with an icosahedron would give slightly more accurate results (i.e. it would produce an output closer to an ideal geosphere) but would make the implementation more complex.

Each successive subdivision increases the number of vertices by a factor of four. Hence the total number of vertices is approximately 4^(N+1), where N is the number of tessellations specified in CreateGeoSphere. A value of 3 or 4 is usually enough to give good results.

Tessellation = 11
276 vertices


Tessellation = 3
277 vertices

image   image

Comments (2)

Cancel reply

  1. KeefJudge says:

    Better living through better algorithms!

  2. Eclectus says:

    Indeed 🙂

Skip to main content