Phong: Difference between revisions
Line 7: | Line 7: | ||
* "$phongboost" "X" Increases the overall phong effect by X factor, default seems to be 1<br> | * "$phongboost" "X" Increases the overall phong effect by X factor, default seems to be 1<br> | ||
* "$phongfresnelranges" "[1 3 6]" higher numbers result in more visible highlights, but need clarification on its relation to rgb color, if any<br> | * "$phongfresnelranges" "[1 3 6]" higher numbers result in more visible highlights, but need clarification on its relation to rgb color, if any<br> | ||
* "$phongexponenttexture" "path/filename_exp.vmt" Mask to determine | * "$phongexponenttexture" "path/filename_exp.vmt" Mask to determine phongs brightness effects on a texture, white = phong, black = none. | ||
* "$phongexponent" "0" contrast, (0-1) higher = sharper phong. lower = smoother, Default 0 <br> | * "$phongexponent" "0" contrast, (0-1) higher = sharper phong. lower = smoother, Default 0 <br> | ||
* "$phongalbedotint" "1" unknown, but commonly included<br> | * "$phongalbedotint" "1" unknown, but commonly included<br> |
Revision as of 18:32, 9 December 2006
Phong is a rendering technique introduced to the Source Engine with Half-Life 2: Episode One and looks best on a normal mapped model with some bit of specularity.
VMT Parameters
- "$phong" "1" Enables Phong effect
- "$phongboost" "X" Increases the overall phong effect by X factor, default seems to be 1
- "$phongfresnelranges" "[1 3 6]" higher numbers result in more visible highlights, but need clarification on its relation to rgb color, if any
- "$phongexponenttexture" "path/filename_exp.vmt" Mask to determine phongs brightness effects on a texture, white = phong, black = none.
- "$phongexponent" "0" contrast, (0-1) higher = sharper phong. lower = smoother, Default 0
- "$phongalbedotint" "1" unknown, but commonly included
Exponent Map
The Phong shader automatically uses the normal maps alpha channel if available to determine where to apply the phong effect, just as specular mapping with $normalmapenvmask does. In addition to this an exp map can be used, which gives further control over the phongs properties on the material. All of dod: sources player models have both normal maps w/ alpha channels and exp maps, check them out for a solid reference to get a subtle phong effect.
A common technique for creating an exp map would be to first create the normal maps alpha channel. This is generally began as a desaturated copy of your regular texture. Next you would mask out areas with black for no shine, and darken areas for more subtle reflection. Overall this is going to be darker than your base texture except for metal surfaces, i.e. for a soft shine smooth leather it needs to be nearly black.
When finished with your normal map's alpha, copy that layer to a new document as an image (in photoshop you'd select all on the alpha channel, copy, file-> new, paste). At this point you may darken or lighten areas specifically for phong brightness. Reduce the image size and save as a compressed texture with no alpha. You can afford to reduce the resolution and compress the exp texture: A scaled down 256^2 exp map is sufficient for a 1024^2 texture.
External Links
Since valve has offered no documentation a lot of this information can be credited to user experimentation and tutorials such as http://www.fpsbanana.com/tuts/1921
Hopefully this knowledge will continue to be expanded on, this is a wiki guys!
This article is a stub. You can help by adding to it.