Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

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

share|improve this answer
    
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. –  Toji Aug 22 '11 at 23:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.