WallWorm Pro VMT Importer

Started by Orvid, January 17, 2015, 06:23:52 PM

Previous topic - Next topic

Orvid

The first thing to understand when using the Pro implementation of the VMT importer is that it does actually parse the VMT files, which the original doesn't do. This means that the Pro version has to deal with a lot of absurdity that makes it into the VMT files that valve produces. If you find a VMT in a Source game that doesn't parse due to a syntax error, then post it here, so that a work around can be hard-coded. We will only do this for the main Source games themselves; we won't (except in special cases, or if you ask nicely) add support for syntax errors that are located in the materials for custom maps produced by users. If that map is then integrated into the game however, we will support it.

The VMT parser in Source itself simply ignores values that fail to parse, but for various reasons, the Pro implementation is not designed that way.

And on a bit of a proud note, the Pro parser parses the combined TF2 and CS:GO materials, totalling 361,492 lines across 26132 VMTs in 3.2 seconds. Unfortunately, the vast majority of the time the VMT importer spends is in creating the actual materials in 3ds Max, which it isn't possible to get much faster than it already is.

So, to give you an idea of the sort of messes that the Pro parser has to deal with, here are a few of the things that has to be handled specially by Pro for some games.


Counter-Strike: Global Offensive:

materials\asphalt\4wb_asphalt_b1.vmt:
$detailscale is officially documented to be a Scale, and makes sense as a Vec2, but this provides a Vec3 value. The Vec2 parsing was modified to ignore the 3rd value if provided.

materials\de_cbble\grass_alt\grass_b_blend.vmt:
This file has an extra closing curly brace at the end. The root node file parser was updated to try to consume all closing curly braces before expecting the EOF.

materials\models\effects\urban_puddle01a.vmt:
$envmapcontrast is documented to be a Normal. A Vec3 value, not enclosed in square brackets is instead provided. The $envmapcontrast parsing was updated to forward this value to $envmaptint instead, which I believe is what was originally intended.

materials\models\props\de_aztec\aztec_door_no_sign.vmt:
$phongexponent is set to "11:26 AM 3/4/20115", which is definitely not the Float that's expected. $phongexponent parsing was updated to specifically ignore this value.

materials\models\props\de_train\hr_t\train_car_a\train_a_numbers.vmt:
$AlphaTestReference is expected to be a Normal value, but instead contains the value "4". Normal parsing was updated to clamp values to within the 0 to 1 range.

materials\models\props_c17\pottery01a_09a.vmt:
$basealphaenvmapmask is expected to be a Bool, but is instead used as a texture reference. Bool parsing was updated to assume that the presence of a value means that the flag is set.

materials\models\props_unique\subwaycardoors.vmt:
$EnvMapTint is expected to be a Vec3, and one is provided, the only problem though is that there are no spaces separating the decimal components. Vec3 parsing was updated to assume that there is a space before each dot in this particular case.

SMF spam blocked by CleanTalk