|
![](/i/fill.gif) |
Tim Nikias v2.0 <tim### [at] gmx de> wrote:
> So, question remains: how to fetch the rgb from an image
> (better yet: from a pigment)?
The HF_*() macros in shapes.inc do pretty much what you are trying
to achieve (ie. they create a mesh which is the heightfield created
using the given function).
Anyways, to get the rgb values of a pigment, you need to create a
pigment function. A pigment function returns a color (instead of a float
like regular float functions do), and naturally you can access the
components of this color with the dot operators (.red, .green, .blue,
.filter and .transmit, or if you prefer, .x, .y and .z).
As a pigment can contain an image map, you can make a pigment function
conaining an image map and thus get the colors of the pixels of the image
(of course there's no way of knowing the resolution of the image map other
than hard-coding it into your code according to the size of the image you
are using).
--
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}// - Warp -
Post a reply to this message
|
![](/i/fill.gif) |