POV-Ray : Newsgroups : povray.advanced-users : Getting the rgb from a position? : Re: Getting the rgb from a position? Server Time
29 Jul 2024 02:30:33 EDT (-0400)
  Re: Getting the rgb from a position?  
From: Tim Nikias v2 0
Date: 11 Mar 2003 06:29:14
Message: <3e6dc88a@news.povray.org>
You're right about the HF_Square macro returning what I
want to do with the "standard" heightfield-macro, nontheless,
I need the macros to output the data I need for my other
macros, so I'll script that macro myself (also, I'm THAT kind
of POVer :-).

Additionally, I want to script some macros which will
interpolate among adjacent samples to generate heightfields
with a higher resolution than the image-map supplied for it,
this may be done by either letting the User specify the original
image-resolution, or by just sampling in-between nodes.

As a last macro, I plan to have one sample the image for
different colored pixels, and interpolate among these, in order
to fully avoid the plateaus. I'll then have to make some macros
which could generate plateaus, e.g. by specifying a certain
"clipping height" + range, thus clipping y-values in a certain
magnitude to be clipped to another certain y-value. Combining
this with another image-map (to define where the plateau should
be), and I get a nice heightfield with plateaus where I want them,
and smooth angles everywhere else...

Well, thanks about the info on how to get the rgb, as you can see,
thats pretty essential for the macros to function properly.

Regards,
Tim

--
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights
Email: Tim### [at] gmxde

> > 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

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