|
![](/i/fill.gif) |
"Kay-Ju" <k.j### [at] gmx de> 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.
Post a reply to this message
|
![](/i/fill.gif) |