I've been playing with loading and displaying Source Engine models (TF2, specifically) and have had mild success, but there are some aspects of it that are eluding me still. I've been primarily looking at http://developer.valvesoftware.com/wiki/MDL and online forks of the SDK headers like http://hlssmod.net/he_code/public/studio.h to understand the formats, but I've found the headers to be helpful, but lacking some crucial implementation details. The Developer Community pages do talk implementation, but much of it is speculation and I've already identified several points where it is wrong, so I'm struggling to locate some better resources.

I've got the whole .VVD file parsing now (as in: I can get the correct verts for a given LOD, verified by rendering a pointcloud.) The specific issue I'm looking at now is in the .dx90.VTX file. Drilling down into the Mesh Strip Groups, it seems like I can render the first strip group just fine (I have the Heavy's chest, arms, and legs rendering) but subsequent meshes are a mess of random triangles. It feels to me as if there should be a per-mesh offset into the .VVDs vertexes somewhere within the .VTXs structure, but I can't locate one. Maybe there's something in the .MDL, which I haven't started looking into yet, but it feels very odd to me to have such closely related data in separate files.

I know that's probably all gibberish to anyone that's not intimately familiar with the Source model formats. Really what I could use more than anything else is some reference code from another app that is loading these files. Are there any open-source exporters/viewers out there?

  • \$\begingroup\$ Did you figure it out yet? I'm still struggling with reading those VTX files, I pretty much mapped its structure, I can read the vertives correctly and group them by meshes & strips, but I have to "guess" their offsets & ranges because I don't know how they calculate them based on the file structure (the indexes for each submesh always start from 0, so they're obviously relative to something). Some of the meshes seem to be odd, "out of sequence", so to speak, when I calculate their offset based on the total number of vertices from all preceding meshes. \$\endgroup\$
    – SasQ
    Aug 16, 2021 at 0:09

1 Answer 1


You could use the source code for DuctTape as a reference. Be aware it's GPL licensed.

  • \$\begingroup\$ Beautiful! I'm glad you pointed out this project to me! Looks like it could be useful outside of my current needs as well. And thanks for the heads up about the license, but I don't think that will be an issue. I'm not going to be able to use their code directly, but regardless I'll be open-sourcing my code when I'm done. \$\endgroup\$
    – Toji
    Aug 22, 2011 at 23:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .