POV-Ray : Newsgroups : povray.unofficial.patches : Silly idea ? : Re: Silly idea ? Server Time
5 Jul 2024 14:25:44 EDT (-0400)
  Re: Silly idea ?  
From: Christopher James Huff
Date: 20 Sep 2002 12:31:24
Message: <chrishuff-843834.12292420092002@netplex.aussie.org>
In article <3D8### [at] freefr>, Le Forgeron <jgr### [at] freefr> 
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] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.