Can i use an image_map to create a
3D-particle system?
I.e. i have a field consisting of let's say 32
by 32 small spheres and i want them to be translated
along the y-axis according to the map-color.
Can this be done?
In an easy way?
"Kay-Ju" <k.j### [at] gmxde> wrote in message
news:web.4a448d38b99e86456aaf5a00@news.povray.org...
> Can i use an image_map to create a> 3D-particle system?>> I.e. i have a field consisting of let's say 32> by 32 small spheres and i want them to be translated> along the y-axis according to the map-color.>> Can this be done?> In an easy way?>
You can declare a pigment using the image as an image_map in the pigment
declaration.
You can use two nested loops to work through the grid positions and use the
'eval_pigment' function in POV-Rays 'functions.inc' to tell you what the
color is at that point on the image.
You can then use that color as a height value when adding each sphere to the
scene.
The default image_map is layed on the X-Y plane, so you'll either need to
rotate it or you'll need to pass the X and Z positions into the eval_pigment
function to represent the X and Y coordinates.
By default the image is scaled to 1 unit high and 1 unit wide, so you'll
need to scale it or factor that into the positions you pass into
eval_pigment.
If you want to work with large numbers of spheres (e.g. 1000 by 1000), it's
worth extracting the SDL from the eval_pigment function and placing it
inline in your scene. You'll find it declares a function and you only need
to declare that function once rather than a million times, saving
significant processing time.
Regards,
Chris B.
"Kay-Ju" <k.j### [at] gmxde> wrote:
> I.e. i have a field consisting of let's say 32> by 32 small spheres and i want them to be translated> along the y-axis according to the map-color.>> Can this be done?> In an easy way?
There are multiple ways to do this. I guess the easiest is to #define a pigment
from the image, and use eval_pigment() (defined in functions.inc) in a double
loop to retrieve the color at the respective point in the image (note that the
coordinates should normally range from 0 to 1); you can then use the .red,
..green or .blue component of the returned color vector (or .gray for the
brightness) to compute the desired translation.
"clipka" <nomail@nomail> wrote:
> "Kay-Ju" <k.j### [at] gmxde> wrote:> > I.e. i have a field consisting of let's say 32> > by 32 small spheres and i want them to be translated> > along the y-axis according to the map-color.> >> > Can this be done?> > In an easy way?>> There are multiple ways to do this. I guess the easiest is to #define a pigment> from the image, and use eval_pigment() (defined in functions.inc) in a double> loop to retrieve the color at the respective point in the image (note that the> coordinates should normally range from 0 to 1); you can then use the .red,> ..green or .blue component of the returned color vector (or .gray for the> brightness) to compute the desired translation.
Thank you both.
That is perfectly the information i have been
questing for.
cu
Kay-Ju