|
|
创建了三个光源:directional point spot
都分别求出了他们对应的颜色,最后想在Output.RGBColor中将各种颜色加在一块得到当前像素的颜色值。
问题1:用单个光源产生的颜色对Output.RGBColor进行赋值时都没问题;
用point directional产生的颜色相加对Output.RGBColor进行赋值时也没问题;
当将spot产生的颜色值与其他的颜色值相加时就出现问题,曾经想过是否会因为三种颜色值相加会超过1.0,于是将spot颜色*0.01,但最后还是有问题。
问题2:怎样调试shader,查看其中的变量值等等,不胜感激 !
float3 spotDiffuseColor = slconeAttenuation * sldisAttenuation * slangAttenuation * g_LightDiffuseColor;
float3 spotSpecularColor = slconeAttenuation * sldisAttenuation * pow(slValue,20) * g_LightSpecular;
float3 pointAndspotColor = pointDiffuseColor + pointSpecularColor + spotDiffuseColor + spotSpecularColor;
Output.RGBColor = float4( g_LightDiffuseColor * max(0,dot(In.vNormal, g_LightDir)) +g_LightSpecular * pow(value,20) + g_LightAmbColor +pointAndspotColor ,1.0f);
return Output;
|
|