Jump to content

  • Log In with Google      Sign In   
  • Create Account

What are specular maps?


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 pierceblaylock   Members   -  Reputation: 122

Like
0Likes
Like

Posted 06 February 2008 - 09:15 PM

Hi, I'm just wondering what a specular map is exactly? I have some here with their diffuse and normal map texture counterparts. But I don't know what they are exactly. I figure they are used to produce some sort of specular highlight. What is the difference between using a specular map or just doing specular lighting in the shader? Also, what is the concept behind using a specular map in a shader? I have a shader set up to render vertices using a diffuse texture and a normal map for per pixel lighting. Where does the specular map fit into this process? I'm not looking for exact shader code (although I won't turn it down), I'm just after the concept of what I do with the specular map in the shader. Thanks.

#2 MrDaaark   Members   -  Reputation: 3556

Like
0Likes
Like

Posted 06 February 2008 - 09:30 PM

The specular made is used to alter the spec value per texel. People have shiny bald heads, and not so shiny stubble on their chins. A belt buckle has a different spec value then the belt, and the jeans.

#3 spek   Prime Members   -  Reputation: 1174

Like
1Likes
Like

Posted 07 February 2008 - 12:50 AM

When doing lighting, you calculate the diffuse term, and, if the object is "shiny", a specular term as well. The lightspot on a billiard ball is a typical example of specular lighting.

The whole ball is made of the same material. So the reflection is the same on all places. But what if the object is made of multiple materials that have different light reflection behavuar? Vampyre_Dark gave some examples. That belt for example, leather will reflect differently than the metal knobs/buckle on it.
- More/less reflection
- The reflection color (white, blueish, brownish, etc.)
- Shininess (how is the reflection spread out? A small spot, or all over the surface?)

You can encode these values per pixel in a texture. The same principle as a normal map. I ussually take the alpha channel in a normalMap as the reflection intensity factor ( finalSpecular *= normalMapPixel.alpha ). But if you want, you can also take a RGB(A) texture. Where RGB is the specular color/intensity, and alpha the shininess factor for example.

The calculation of the specular light stays the same in the shader. The only difference is that some of the values are variable and come from a texture now:
specularMapPixel = tex2D( specularMap, uv ).rgba;
specularColor.rgb = specularMapPixel.rgb;
shininess = specularMapPixel.a;
specular = pow( dot(reflectVector, lightDir) , shininess ) * specularColor.rgb * lightSpecularColor.rgb;

Greetings,
Rick




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.




PARTNERS