Phong Tutorial


FBOTheLiuetenant
08-14-2006, 11:30 AM
S@bre requested I help out the community with a phong tutorial. I'd appreciate any help from the other people who have been able to make phong work well ahem Something Wicked. I just thought this would be a good idea since the other thread werent as simple in there explanation as they could have been.

Introduction:
Basically there are three things you need to Phong to work well
1. The skin itself
2. A normal map
3. An exp file

Most of you will have number 1 and/or number 2. If you dont know how to make a normal I could explain that too. However the exp file is how the renderer knows where to highlight using phong. (Anyone who is more technically knowledgable can step in at any moment)

A. To create the exp file in Photoshop
To create the exp in photoshop just open up photoshop, and open the skin file you want to create an exp for. Once you have that open you will need to blacken out the Blue and Red channels so there is only the Green. I've read in other threads you need to invert the Alpha channel? But honestly my phongs have worked without doing that. Save the file as a .VMT with the name of whatever the skin is for, example v_garand_exp, and you got that part down.

Note you must have Jeds VMT plugin to save your work as a VMT

B. Editing the VTF

"VertexLitGeneric"
{
"$baseTexture" "models\weapons\v_models\garand/v_garand"
"$bumpmap" "models\weapons\v_models\garand\v_garand_normal"
"$normalmapalphaenvmapmask" 1
"$phong" "1"

// "$phongexponent" "15"
"$phongboost" "1"
"$phongfresnelranges" "[0.1 0.21 0.51]"
// "$halflambert" "1"
"$phongexponenttexture" "models\weapons\v_models\garand\V_garand_exp"
"$phongalbedotint" "1"
}

This is an example of my VTF file for the garand I phonged. I changed the fresnel ranges from the standard 1 3 6 to lower values to have a more subtle effect. They work much in the same way the envmaptint line works the numbers corrispond to the R G B values. phongexponent is the ammount of sharpness or smoothness the phong will have, the lower the number the sharper it will be. I have noticed that higher numbers like 15-20something work nicely. Once you have this done your phong is comeplete

Trp. Jed
08-14-2006, 01:13 PM
We've already got a Phong tutorial in the tutorials section. Also, theres a lot of errors in what you wrote, especially with regard to the colour of the exponent channel.

It's all covered here:

http://www.dayofdefeat.com/forums/showthread.php?s=&postid=958366#post958366
http://www.dayofdefeat.com/forums/showthread.php?s=&threadid=66731

Sabre
08-14-2006, 02:12 PM
Question: Does phong/rim lighting work with the style of alpha mapping used by Wile E Coyote?

Day of Defeat Forum Archive created by Neil Jedrzejewski.

This in an partial archive of the old Day of Defeat forums orignally hosted by Valve Software LLC.
Material has been archived for the purpose of creating a knowledge base from messages posted between 2003 and 2008.