|
![](/i/fill.gif) |
In article <3D8### [at] free fr>, Le Forgeron <jgr### [at] free fr>
wrote:
> Two days ago, I get an idea: what if the colour of the point was
> directly computed from the 3D vector... well in fact, what if the colour
> was just the 3D vector. It does not make too much interest with a
> position vector, but I was then thinking about either the ray direction
> or the normal (it can be made available, that's not the problem here).
That is possible now. For the position, it is very easy, though it only
works over a finite range. You don't even need functions, just use an
average of three gradient pigments, one along each axis:
pigment {average
pigment_map {
[1 pigment {gradient x color_map {[0 rgb 0][1 red 3]}}]
[1 pigment {gradient y color_map {[0 rgb 0][1 green 3]}}]
[1 pigment {gradient z color_map {[0 rgb 0][1 blue 3]}}]
}
}
Scale to contain the desired area and adjust the color values if you
want them to go outside the [0, 1] range. (They go up to 3 because
averaging will drop them to 1/3 of their original value, so use
3*desired final value. We need an "add" or "sum" pattern. "multiply" or
"product" would be useful too. Or just vector functions.)
Put this in a pigment function if you want a vector function, this is
the only way I know of to work around the lack of custom vector
functions.
> Illustrating with only the normal, I was just thinking first of
> color.x = abs(normal.x)
> color.y = abs(normal.y)
> color.z = abs(normal.z)
A little different, but still possible. Use the slope pattern instead of
gradient.
Ray direction is more of a problem...you could use the intersection
point - camera position, but that won't work for secondary rays like
reflections or refracted images. That is something that will need
patching to fully support.
--
Christopher James Huff <cja### [at] earthlink net>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tag povray org
http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |