|
|
Hi folks
I'd like to make a simple scene with the Cook & Torrance model for light
reflection instead or the common Phong model. I thought it could be easy,
but after many hours I realized it was at least not as simple as I thought.
I started using a pigment function to implement the diffuse lighting in
a sphere:
#declare fun = function { (max(0, (sx*(x-px) + sy*(y-py) + sz*(z-pz)
)/rd + amb)*0.5 }
where <px, py, pz> is the sphere center (so <x-px, y-py, z-pz> is the sphere
normal), and <sx, sy, sz> is the normalized light vector. rd is the sphere
radius and amb is the amount of ambient lighting.
Then the sphere object is declared as
sphere { <px, py, pz> rd
texture {
pigment { function { fun(x, y, z) }
color_map { [0.0 rgb <0,0.0,0.0>*2]
[1.0 rgb colr*2] }
}
finish { ambient 1 diffuse 0 }
}
}
where colr is the rgb color of the sphere. The diffuse lighting works fine,
but it is almost impossible to stablish a color map to represent all the
colors needed by the specular reflection.
So, I realized I need a way to color the pixel in position (x, y, z), or, in
other words, I need a function like this one:
texture {
pigment { color { function { fun_color(x, y, z) }
}
finish { ambient 1 diffuse 0 }
}
but, of course, POV doesn't recognize this sintaxe.
Suggestions?
Val
Post a reply to this message
|
|