0
我得到了表面法線和光線位置的點積。奇怪的是點產品大於1.這就是問題編號1.從點積到浮點的映射強度RGB 0-> 1
第二個問題是我想映射強度從0-> 1到Float RGB從0-> 1 這裏是我的代碼
if (the_object->polys[curr_poly].shading == 1)
{
// compute the dot product between the light source vector
// and normal vector to surface
dp = Dot_Product_3D((vector_3d_ptr)&normal,
(vector_3d_ptr)&light_source);
// test if light ray is reflecting off surface
if (dp > 0)
{
// now cos 0 = (u.v)/|u||v| or
intensity = ambient_light + (dp/(the_object->polys[curr_poly].normal_length));
float r = the_object->polys[curr_poly].color.R*intensity;
float g = the_object->polys[curr_poly].color.G*intensity;
float b = the_object->polys[curr_poly].color.B*intensity;
Color color = Color(r, g, b, 1);
}
RGB值在0> 1的範圍內,例如RGB(1,0,0)全部是紅色 –
請問您能解釋一下通過將強度映射到顏色是什麼意思嗎?根據強度調整顏色?反射投射在物體上的照明? – Gmodjackass
是的,這就是我的意思。我正在使用軟件光柵器進行平面着色,所以我有光矢量並且面部正常,並且我正在計算點產品以調製模型顏色 –