Home Technical Talk

Source Specular maps

polycounter lvl 7
Offline / Send Message
Amatobahn polycounter lvl 7
I am having a terrible time/experience trying to get specular maps to display correctly without a result like this: 511de5999638b.jpg

I am using the specular in the Normal map alpha channel and am using the $normalmapalphaenvmask to enable this.

here is my vtf file contents:

"VertexLitGeneric"
{

$model "1"
$basetexturetransform "center 0.5 0.5 scale 1.0 1.0 rotate 0.0 translate 0.0 0.0"
$envmapmasktransform "center 0.5 0.5 scale 1.0 1.0 rotate 0.0 translate 0.0 0.0"
$bumptransform "center 0.5 0.5 scale 1.0 1.0 rotate 0.0 translate 0.0 0.0"
$selfillumtexturetransform "center 0.5 0.5 scale 1.0 1.0 rotate 0.0 translate 0.0 0.0"
$selfillummasktransform "center 0.5 0.5 scale 1.0 1.0 rotate 0.0 translate 0.0 0.0"
$basetexture "custom/Barricade_dDo_d"
$envmap "env_cubemap"
$normalmapalphaenvmapmask "1"
$bumpmap "Map _17/Barricade_dDo_n"
$envmapmask "Map _20/Barricade_dDo_s2"
$selfillum "1"
$selfillumtexture "custom/Barricade_dDo_e2"
$selfillummask "custom/Barricade_dDo_e2"
}

I feel like I am completely over my head at this point :|

cheers.

Replies

  • Farfarer
    normalmapalphaenvmap or anything to do with envmaps is to do with reflection of cubemaps from the map, not the phong spec.

    You might want to check up on the phong stuff at the VDC.
  • tobehfaic
    Offline / Send Message
    tobehfaic polycounter lvl 10
    I'll mirror what was said above, you'll be looking for the $phong function if you want to use a specular map in Source, as opposed to what you're using which is basically creating an envmap, with a specular (hence your model looks like chrome).

    You want to use something like this in your vmt:
    "VertexLitGeneric"
    {
    
    $model "1"
    $basetexturetransform "center 0.5 0.5 scale 1.0 1.0 rotate 0.0 translate 0.0 0.0"
    $envmapmasktransform "center 0.5 0.5 scale 1.0 1.0 rotate 0.0 translate 0.0 0.0"
    $bumptransform "center 0.5 0.5 scale 1.0 1.0 rotate 0.0 translate 0.0 0.0"
    $selfillumtexturetransform "center 0.5 0.5 scale 1.0 1.0 rotate 0.0 translate 0.0 0.0"
    $selfillummasktransform "center 0.5 0.5 scale 1.0 1.0 rotate 0.0 translate 0.0 0.0"
    
    $basetexture "custom/Barricade_dDo_d"
    
    $phong 1
     
    $bumpmap				"Map _17/Barricade_dDo_n"
    $phongexponent			5
    $phongexponenttexture	"Map _20/Barricade_dDo_s2"
    $phongboost				1.0
    $phongfresnelranges		"[0 0.5 1]"
    
    $selfillum "1" 
    $selfillumtexture "custom/Barricade_dDo_e2"
    $selfillummask "custom/Barricade_dDo_e2"
    }
    

    Not sure why you have so many transforms in your vmt but I wouldn't use them unless they have a specific purpose. The above vmt also relies on the fact you're using the EP2 Source Code (TF2, Episode 2, Portal 2 etc) if you want to have an envmap AND phong (specular) together.

    This is all presuming you want an actual specular effect and not a cubemap effect. Poke https://developer.valvesoftware.com/wiki/$phong for a better explanation.
  • respawnrt
    Offline / Send Message
    respawnrt polycounter lvl 8
    Use the spec map into your normal map alpha channel.
    The phongexponent is the gloss map.Play with phongboost value(like a multiplier for spec map) and phong fresnelranges.Also the env reflection will also use the normal map alpha channel with "$normalmapalphaenvmask" "1" but suggest using "envmaptint" to tone it down like very very low.
  • k@rt
    Offline / Send Message
    k@rt polycounter lvl 6
    Also you shouldn't need to have both $envmapmask "Map _20/Barricade_dDo_s2" AND $normalmapalphaenvmapmask "1" as they are the same thing. Your envmapmask will obviously be a separate b&w image (black = non reflective and white=reflective), you can also take this image and put it into the normalmap or basetextures alpha channel (although you must invert it when its in the basetexture - maybe too with the normalmap, I can never remember!).

    The point is however you don't need both of these. Pick one or the other, the same uvw space can't use two different reflection maps at the same time.
Sign In or Register to comment.