Phong: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
Line 12: Line 12:


==Exponent Map==
==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.  However if you do not use a normal map alpha channel already you can save space by creating a simple exp map:  A common technique would be to copy the main texture vtf to a new image, desaturate the image and then proceed to mask out areas with black for no shine, and darken those that need more subtle shine.  When finished 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.
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==
==External Links==

Revision as of 18:31, 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 where phong is applied on a texture, white = phong, black = none, unneeded if a normal map alpha channel is used.
  • "$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.