Problem:

There are some major inconsistancies concerning how .ase model files are loaded and parsed in Radiant and Q3Map2. The issues are:

  1. GtkRadiant 1.4.0 and 1.5.0 don't work the same way.
  2. Editor images may differ than the shader name, but we are currently forced to assume that they are the same.

In 3ds MAX, I loaded up the bitmap (textures/obsidian_steampunk/brass_dirty.tga) in the material editor and assigned it to the model. Then I exported to .ase. Here is a select portion of the .ase file showing the material list:

*MATERIAL_LIST {
	*MATERIAL_COUNT 1
	*MATERIAL 0 {
		*MATERIAL_NAME "models/obsidian_steampunk/brass_dirty"
		*MATERIAL_CLASS "Standard"
		*MATERIAL_AMBIENT 0.5882	0.5882	0.5882
		*MATERIAL_DIFFUSE 0.5882	0.5882	0.5882
		*MATERIAL_SPECULAR 0.9000	0.9000	0.9000
		*MATERIAL_SHINE 0.1000
		*MATERIAL_SHINESTRENGTH 0.0000
		*MATERIAL_TRANSPARENCY 0.0000
		*MATERIAL_WIRESIZE 1.0000
		*MATERIAL_SHADING Blinn
		*MATERIAL_XP_FALLOFF 0.0000
		*MATERIAL_SELFILLUM 0.0000
		*MATERIAL_FALLOFF In
		*MATERIAL_XP_TYPE Filter
		*MAP_DIFFUSE {
			*MAP_NAME "map #1"
			*MAP_CLASS "Bitmap"
			*MAP_SUBNO 1
			*MAP_AMOUNT 1.0000
			*BITMAP "D:\GameDev\Quake3\blastburn\textures\obsidian_steampunk\brass_dirty.tga"
			*MAP_TYPE Screen
			*UVW_U_OFFSET 0.0000
			*UVW_V_OFFSET 0.0000
			*UVW_U_TILING 1.0000
			*UVW_V_TILING 1.0000
			*UVW_ANGLE 0.0000
			*UVW_BLUR 1.0000
			*UVW_BLUR_OFFSET 0.0000
			*UVW_NOUSE_AMT 1.0000
			*UVW_NOISE_SIZE 1.0000
			*UVW_NOISE_LEVEL 1
			*UVW_NOISE_PHASE 0.0000
			*BITMAP_FILTER Pyramidal
		}
	}
}

I have two versions of the shader, one for use on brushes and one for models. Both shaders point to the same bitmap files, but the shader names are different.

// FOR USE ON LIGHTMAPPED BRUSHES
textures/obsidian_steampunk/brass_dirty
{
	q3map_bounceScale 2
	{
		map textures/obsidian_steampunk/envmap/brass.tga
		tcGen environment
	}
	{
		map textures/obsidian_steampunk/brass_dirty.tga
		blendFunc blend
	}
	{
		map $lightmap
		blendFunc filter
		rgbGen identity
	}
}

// FOR USE ON VERTEX LIT MODELS
models/obsidian_steampunk/brass_dirty
{
	{
		map textures/obsidian_steampunk/envmap/brass.tga
		tcGen environment
		rgbGen vertex
	}
	{
		map textures/obsidian_steampunk/brass_dirty.tga
		blendFunc blend
		rgbGen vertex
	}
}

Problem #1 starts with the inconsistancy between how GtkRadiant 1.4.0 and GtkRadiant 1.5.0 loads textures in .ase models. GtkRadiant 1.4.0 looks at the "*MATERIAL_NAME" entry and uses that to interpret the location of the bitmap, in this case, "models/obsidian_steampunk/brass_dirty". GtkRadiant 1.5.0 looks at the "*BITMAP" entry, in our example, "D:\GameDev\Quake3\blastburn\textures\obsidian_steampunk\brass_dirty.tga". In that regard, to get the model to display properly in both versions of Radiant, "*MATERIAL_NAME" must resemble "*BITMAP".

To confuse things even more, we have problem #2 in such situations as this where the bitmap name and desired shader are not the same. Currently, Q3Map2 parses the "*BITMAP" line of the .ase and interprets it as the shader "textures/obsidian_steampunk/brass_dirty", which is the right texture, but not the intended shader.

This makes things incredibly difficult for the modeler/shader-writer/level-designer who is trying to maintain both consistancy of the file format and trying to get the right textures to load in each editor and in-game.

Recommendations

Ideally, a solution shouldn't be too difficult. We can let GtkRadiant 1.4.0 parse the "*MATERIAL_NAME" value while GtkRadiant 1.5.0 parses the "*BITMAP" value, both of which can be changed to point to the same image file. But note the unused "*MAP_NAME" entry? We can use this to as the default value for Q3Map2. So when Q3Map2 parses an .ase, it will first look at "*MAP_NAME" for the shader, if nothing is found it will check "*MATERIAL_NAME", and if either values are missing or incorrect, it will look at the "*BITMAP" entry and use the raw bitmap instead of a shader.