Achieving TF2 model shading for custom models?

JoshuaC

L420: High Member
Sep 2, 2008
444
164
I didn't see a modeling section, so if this is in the wrong area could a mod please move this to the correct one? Thanks!

I'm getting into modeling my own props, and I'm wondering how exactly would I go about achieving the shading the player models have. I've searched the valve wiki but have found nothing on the subject.
 

Zeewier

L9: Fashionable Member
Sep 20, 2008
619
262
shading is "hidden" inside the vmf files. I think you know the progress on finding those since you got some material reskins in watchtower.

It's probably the phong shading and the rim lightning ;)
 

JoshuaC

L420: High Member
Sep 2, 2008
444
164
shading is "hidden" inside the vmf files. I think you know the progress on finding those since you got some material reskins in watchtower.

It's probably the phong shading and the rim lightning ;)

I only changed the rock texture to fit the alpine theme in watchtower.

What I'm looking for isn't achieved by phong or rim lighting. What I'm looking for is the lighting shading on the models. It's unique to the TF2 models somehow and I'm not sure how to do it.
 

Altaco

L420: High Member
Jul 3, 2008
484
120
Here's the relevant part of the vmt for the heavy weapons guy, everything that has to do with shading:
---------------------------------------------

"$basetexture" "models\player\medic\medic_red"
"$bumpmap" "models\player\medic\medic_normal"
"$detail" "effects/tiledfire/fireLayeredSlowTiled512.vtf"
"$detailscale" "5"
"$detailblendfactor" 0.01
"$detailblendmode" 6

"$yellow" "0"
"$one" "1"

"$phong" "1"
"$phongexponent" "20"
"$phongboost" ".3"
"$lightwarptexture" "models/player/pyro/pyro_lightwarp"
"$phongfresnelranges" "[.3 1 8]"
"$halflambert" "0"

// Rim lighting parameters
"$rimlight" "1" // To enable rim lighting (requires phong)
"$rimlightexponent" "4" // Exponent for phong component of rim lighting
"$rimlightboost" "2" // Boost for ambient cube component of rim lighting
---------------------------------------------


This also looks like it could be helpful (skip to page 4):
http://www.valvesoftware.com/publications/2007/NPAR07_IllustrativeRenderingInTeamFortress2.pdf

Based on that, it looks like what you want is (d) on that page, that is, using warped diffuse and ambient cube shading. I believe this is a part of the phong lighting. That $lightwarptexture looks like it's what you probably want, opening that up it looks exactly like figure 7 in that pdf file. So it's a combination of the phong shading, half lambertian, and lightwarp settings that create the nice shading they've made. Rimlights are nice too :3.
 

JoshuaC

L420: High Member
Sep 2, 2008
444
164

I don't believe you know what you're talking about. vmf's are map files.

Here's the relevant part of the vmt for the heavy weapons guy, everything that has to do with shading:
---------------------------------------------

"" "modelsplayermedicmedic_red"
"" "modelsplayermedicmedic_normal"
"" "effects/tiledfire/fireLayeredSlowTiled512.vtf"
"" "5"
"" 0.01
"" 6

"" "0"
"" "1"

"" "1"
"" "20"
"" ".3"
"" "models/player/pyro/pyro_lightwarp"
"" "[.3 1 8]"
"" "0"

// Rim lighting parameters
"" "1" // To enable rim lighting (requires phong)
"" "4" // Exponent for phong component of rim lighting
"" "2" // Boost for ambient cube component of rim lighting
---------------------------------------------


This also looks like it could be helpful (skip to page 4):
http://www.valvesoftware.com/publications/2007/NPAR07_IllustrativeRenderingInTeamFortress2.pdf

Based on that, it looks like what you want is (d) on that page, that is, using warped diffuse and ambient cube shading. I believe this is a part of the phong lighting. That looks like it's what you probably want, opening that up it looks exactly like figure 7 in that pdf file. So it's a combination of the phong shading, half lambertian, and lightwarp settings that create the nice shading they've made. Rimlights are nice too :3.

Hmm, I messed around with similar settings for my model but never tried the lightwarp stuff. I'll give it a try.
 

(s2a) yahodahan

L3: Member
Apr 22, 2009
144
18
I could be wrong, but I believe a lot of the work will be done in 3DSMax/etc, via "render to texture". Using things like ambient occlusion, soft almost-toon-shading, etc, you could render out a very nice base texture (without strong directional, of course).

From there, I would move on to the vmt...at which point I would have no idea how to proceed :D

good luck!
 

JoshuaC

L420: High Member
Sep 2, 2008
444
164
I could be wrong, but I believe a lot of the work will be done in 3DSMax/etc, via "render to texture". Using things like ambient occlusion, soft almost-toon-shading, etc, you could render out a very nice base texture (without strong directional, of course).

From there, I would move on to the vmt...at which point I would have no idea how to proceed :D

good luck!

I've already got down how to bake ambient occlusion onto a texture map in XSI.

XSIAOWin.jpg

(The white lines are due to a crappy unwrap on my part)

Now that I'm poking around in the files it definitely seems that the lightwarp is the key to the shading. I'll whip up a fast model to try it.
 

(s2a) yahodahan

L3: Member
Apr 22, 2009
144
18
i'll be following closely :) def something I have wondered about in the past.

To be true, I kinda gave up custom models in Hammer once I realized you couldn't lightmap them, as you can Hammer BSP. boo.

more good luck to ya!