Page 1 of 1

HLSL shader question

Posted: Mon Mar 12, 2007 7:33 pm
by Luben
Hi. I'm trying to make a per-pixel lighting shader.

Code: Select all

float3 Diffuse=c_Diffuse*saturate(dot(Light, Normal));
float3 Specular=pow( saturate(dot(Half, Normal)) , SpecularPower) * c_Specular;

Return.xyz=c_LightColor * ( saturate(c_Ambient+Diffuse)*Color + Specular ) + c_Emmisive;
Return.w=1;
My problem is, where should i get the c_{Diffuse, Specular, Ambient, Emmisive} color values from?

Posted: Mon Mar 12, 2007 11:02 pm
by TheC
You need to set them in the OnSetConstants callback. Check out the Shaders example for that.