Jump to content
  • Advertisement
Sign in to follow this  
Programmer101

Using the specular component in a shader

This topic is 4109 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

Hi everyone! How do you compute the final color in the pixel shader with the specular component? I have diffuse and ambient just fine but I'm unsure on how to use the specular component. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
You'll need to be a little more detailed.

Do you just want to pass the vertex specular value along to the vertex shader, then to a pixel shader?
Are you using fixed function lighting/vertex processing and a pixel shader?
Are you using a vertex shader that does lighting and wanting to pass the specular to a pixel shader?
Which shader model are you using (SM3 is a bit different)?
Are you doing all per-pixel lighting?
Are you wondering how to calculate specular?
Do you have all the computation done and you're just not sure what to do with the result?

Share this post


Link to post
Share on other sites
You just do: color = ambient + diffuse + specular?
If you're using the phong illumination model, compute (R*V)^m if R*V > 0 for the specular coefficient.

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!