Jump to content
  • Advertisement
Sign in to follow this  
howie_007

Question about shader lighting and specular maps

This topic is 2570 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have simple shader lighting working. Just point and directional lighting to the diffuse(color) texture. I've seen some example of adding specular lighting to the light calculations.

The question is, if I use specular texture maps, then I don't need to add specular lighting calculations to the lights seeing that they effect the diffuse(color) texture. Would that be correct?

Share this post


Link to post
Share on other sites
Advertisement

I have simple shader lighting working. Just point and directional lighting to the diffuse(color) texture. I've seen some example of adding specular lighting to the light calculations.

The question is, if I use specular texture maps, then I don't need to add specular lighting calculations to the lights seeing that they effect the diffuse(color) texture. Would that be correct?


Specular maps handle the amount of specular reflection across the surface, just as normal maps provide a high resolution normal across the surface. But this value still needs to be used in the specular light calculations to be of any use.

Share this post


Link to post
Share on other sites
What I'm asking about is the [color=#1C2837][size=2]specular lighting calculations added to a shader that doesn't use [color=#1C2837][size=2]specular maps. If I'm using [color=#1C2837][size=2]specular maps, I'll be using different code based on using the map but I don't need both. Would that be correct?

Share this post


Link to post
Share on other sites
The difference is:
[font="Courier New"]float specMask = /*either sample a texture, or read a shader uniform*/[/font]
[font="Courier New"]float specPower = /*either sample a texture, or read a shader uniform*/[/font]

The common part is:
[font="Courier New"]/*use the above variables to calculate specular lighting*/[/font]

Share this post


Link to post
Share on other sites

What I'm asking about is the [color="#1C2837"]specular lighting calculations added to a shader that doesn't use [color="#1C2837"]specular maps.

the answer is not only 1.
i guess you expect "yes" thou.
you can use the map value to your diffuse only.in this case you dont need specular calculations.
Or you can use the map value to your specular calculation. in this case off course you add the specular calculation code in your shader code.(this is normal usage)

in conclusion, the answer is 90% "no".


[color="#1C2837"]If I'm using [color="#1C2837"]specular maps, I'll be using different code based on using the map but I don't need both. Would that be correct?

even if your just use the texture only as a diffuse term,your still add the small code like this,
finalcolor= diffuse term + specular term. (spec term from texel)

so, its impossible to achieve a specular lighting without adding the code.

the map is just a 1 of the "parameter" for calculations, not "everything".

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!