DirectXMesh Update

The February 2018 release of DirectXMesh is available on GitHub. I wanted to call attention to this release in particular because I discovered an important and long-standing bug in the library that is now fixed.

First, the good news: I have implemented a vertex welding algorithm similar to the legacy function D3DXWeldVertices, and I've added support for Tom Forsyth's Linear-speed Vertex Cache Optimisation algorithm as an alternative to the Hugh Hoppe Transparent Vertex Cache Optimization algorithm that was originally ported from the deprecated D3DX9 library. The meshconvert tool was updated with a new -oplru switch to use the Forsyth algorithm, and the DirectX SDK Samples Content Exporter now supports an -optimization switch to control the algorithm selection as well (see the wiki for details).

To support vertex welding (which results in a number of 'unused' vertices), I also added a new helper function CompactVB. In the course of that work I realized that FinalizeVB, FinalizeVB, and FinalizeVBAndPointReps were all applying the vertex remap backwards. The original D3DX9 codebase used both kinds of vertex maps: oldLoc = vertexRemap[newLoc] and newLoc = vertexRemap[oldLoc]. The D3DX9 library and DirectXMesh are intended to expose only the first version maps to the client code (which is the most useful for copying around related attributes), but internally there are a number of places you need to use the inverse. It turns out I was returning the correct vertex remaps from OptimizeVertices, but then applied them incorrectly with my remap functions--but they were consistent so it still rendered correctly. Unfortunately this means it was always making the vertex buffer less efficient. Ooops. My bad. I've improved my test suite and the documentation here as well as fixing the remap functions.

Wavefront OBJ: In the December 2017 release I fixed the WaveFrontReader.h helper to support 'relative' indices which were missing from the original sample implementation I used to create the header, and in February 2018 I made a few more robustness improvements. The February 2018 versions of meshconvert and the uvatlas tool now use this improved version.

NuGet: The DirectXMesh library is now available on NuGet as well. I provide a Win32 desktop package suitable for use with VS 2015 Update 3 or VS 2017, as well as a UWP version.

Related: DirectXMeshDirectXTex and DirectXMesh now support Direct3D 12

Comments (0)

Skip to main content