Using the specular component in a shader

Started by
1 comment, last by stanlo 17 years, 1 month ago
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.
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?
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.

This topic is closed to new replies.

Advertisement