Sign in to follow this  
howie_007

Question about shader lighting and specular maps

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
[quote name='howie_007' timestamp='1307804362' post='4822098']
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?
[/quote]

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 [/size][/color][color=#1C2837][size=2]specular maps. If I'm using [/size][/color][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?[/size][/color]

Share this post


Link to post
Share on other sites
The difference is:
[font="Courier New"]float specMask = /*[b]either [/b]sample a texture, [b]or [/b]read a shader uniform*/[/font]
[font="Courier New"]float specPower = /*[b]either [/b]sample a texture, [b]or [/b]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
[quote name='howie_007' timestamp='1307807201' post='4822109']
What I'm asking about is the [color="#1C2837"][size="2"]specular lighting calculations added to a shader that doesn't use [/size][/color][color="#1C2837"][size="2"]specular maps.[/size][/color]
[/quote]
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".

[quote name='howie_007' timestamp='1307807201' post='4822109']
[color="#1C2837"][size="2"]If I'm using [/size][/color][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?[/size][/color]
[/quote]
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this