opengl - Computing a pixel's specular value? -


i've been looking around internet formula computing's diffuse value of given pixel in raytracer (where ray intersection has occurred of course).

the examples found involve multiplying colours other colours. nvidia's formula follows:

diffuse = kd x lightcolor x max(n · l, 0) 

where:

- kd material's diffuse color - lightcolor color of incoming diffuse light - n normalized surface normal - l normalized vector toward light source - p point being shaded 

the formula doesn't seem hard me, when trying program find kd x lightcolour multiplication of 2 rgb values. confusing me as, unless it's case of multiplying both r, g , b values together, there's no way multiply values this.

similarly, specular formula requires rgb value raised power equivalent shininess factor of material, again multiplication of 3-component data type itself.

this me getting confused maths, if clear it'd appreciated.

kd x lightcolour component-wise multiplication:

        d       a*d [ b ] x [ e ] = [ b*e ]   c       f       c*f 

in formula specular illumination (assuming talking phong or blinn-phong illumination model), there no power operation on vectors.

specular = ks x lightcolor x (r · v)^a 

the result of r · v float, power applied single number.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -