Transparent texture problem

Hi all

I am trying to make a TF2 hat with a transparent texture, however, although the alpha map works, in the sense that the bits I want to be transparent, are, it does not seem to display correctly in HLMV or in TF2 itself.

Below is a screenshot of the hat in HLMV. It is relatively simple - a UFO with a beam coming down.

The parts that are transparent are as follows: the beam, becoming more transparent nearer the bottom, and also with striped transparency throughout (fairly obvious from the image). Also the blue ‘dome’ at the top is semi transparent (mid grey on the alpha channel of the .vtf).

The problem is that the beam, for some bizarre reason shows through the rest of the hat, despite for example the UFO being completely non-transparent (white on the alpha channel).

A similar issue can be seen when viewing from below:

As you can see, the little green man that is inside the dome can be seen through the rest of the UFO. Interestingly this problem can be somewhat alleviated by making this little green man semi-transparent himself. This however, seems a bit of a fudge, as really the occlusion should work correctly.

I include for reference my .vmt and .qc code:


$cd "C:\Users\Magic\Desktop\ufohat\output"
$modelname "player\items\scout\milkhat.mdl"
$model "Body" "ufohat.smd"
$cdmaterials "\models\player\items\scout\"
$hboxset "default"
$hbox 0 "bip_head" -4.436  -8.926  -6.394  4.336  0.000  5.105
// Model uses material "models/player/items/scout/milkhat.vmt"
$surfaceprop "cloth"
$sequence idle "ufohat" loop fps 30.00
$collisionmodel "ufohat.smd" {

	$mass 5.0
	$inertia 1.00
	$damping 0.00
	$rotdamping 0.00


	"$baseTexture" "models\player\items\scout/ufohat"

	"$bumpmap" "models\effects\flat_normal" 
	"$detail" "effects/tiledfire/fireLayeredSlowTiled512.vtf"	
	"$detailscale" "5"
	"$detailblendfactor" .01
	"$detailblendmode" 6
	"$yellow" "0"

	"$translucent" "1"
	"$phong" "0"
	"$phongexponent" "25"
	"$phongboost" "1"
	"$lightwarptexture" "models/player/pyro/pyro_lightwarp"
	"$phongfresnelranges"	"[.25 1 4]"
	"$basemapalphaphongmask" "1"

	"$rimlight" "1"
	"$rimlightexponent" "4"
	"$rimlightboost" ".65"
	// Cloaking
	"$cloakPassEnabled" "1"
			"animatedtexturevar" "$detail"
			"animatedtextureframenumvar" "$detailframe"
			"animatedtextureframerate" 30
			"resultVar" "$detailblendfactor"
			"resultVar" "$yellow"
			"srcVar1"  "$yellow"
			"resultVar" "$color2"


As a sidenote, when trying to get the transparency to work, I found I had to set “$phong” to “0” to do so.

Any help with this issue (or indeed any other general advice/suggestions) is greatly appreciated.


Try using “$alphatest” “1” instead of “$translucent” “1”
The latter can be quite fussy when it comes to actually working right

Thanks for the suggestion one free man. I actually circumvented the problem by using separate .vmt’s and .vtf’s for transparent/non-transparent parts.

I will take a look at how it behaves with translucent as well though for future reference.

Finished article for anyone interested:


compile with $opaque or $mostlyopaque in the qc

it helps with most z-order issues.