POV-Ray : Newsgroups : povray.general : scaling a PATTERN: using SCALE vs.FREQUENCY : Re: scaling a PATTERN: using SCALE vs.FREQUENCY Server Time
1 Jun 2024 11:03:02 EDT (-0400)
  Re: scaling a PATTERN: using SCALE vs.FREQUENCY  
From: Zeger Knaepen
Date: 19 Oct 2005 03:39:02
Message: <4355f816$1@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> wrote in message 
news:web.4355dc106294c8e4f62422910@news.povray.org...
> Larry Hudson <org### [at] yahoocom> wrote:
> 
> > The color_map is an entirely different thing from the coordinate 
axes.
> > It's merely a one-dimensional *DEFINITION* of the color data.  You 
seem
> > to be trying to 'force' this color definition dirctly onto the
> > coordinate dimensions, but it's really a totally different thing.
> 
> Yes, I see that, both conceptually and from the POV definition.  But 
it's
> the PATTERN that turns this one-dimensional "thing" into actual 3D
> spatial colors, no?  It seems to me that a "color_map without a 
pattern" is
> like a race horse without legs... simply a concept. That is, for any 
real
> usefulness, 3D pattern and color_map are inextricably interwoven 
(which is
> how I usually think of them.) That being the case, in what axis or 
axes can
> I expect  to see the visual results of FREQUENCY at work on the 
color_map?
> I guess that's my basic question AND conceptual difficulty.  I suppose 
the
> answer depends on the pattern specified(?)
> 
> SCALE, by contrast, seems to have a very straightforward, clear and
> understandable effect on the color_map and pattern simultaneously.
> >
> > Scaling, however, IS directly related to the coordinate dimensions, 
and
> > as Alain pointed out, the scaling can be different along all three 
axes.
> 
> Didn't mean to lead everyone down a wrong path.
> In my use of SCALE, I'm simply substituting it for FREQUENCY (in the 
same
> location in the code), without any extra <x,y,z> modifiers.  Straight
> scaling of all axes equally, in other words.

A pattern is just a function that returns values between 0 and 1 for 
every 3D point.  The actual color of this point is determined by looking 
up the value returned by the function in the color_map.

For example, take a pattern that has the following function: abs(sin(x))
The result is more or less a gradient along the x-axis, with values 
going from 0 to 1 and back to 0 along x=0 and x=pi

Now take for example the following color_map:

color_map {
    [0 red 1]
    [.5 green 1]
    [1 blue 1]
}

Where the function returns a value of 0, the resulting pigment will be 
red, and where the function returns 1, the pigment will be blue.  A 
function-value of 0.5 will result in a green part in the pigment.  And 
of course everything interpolated in between.

Now... the scale modifier modifies the pattern itself, the function that 
is.  So adding scale .5 will be the same as changing the function into 
abs(sin(x/.5)).  The result will be smaller bands along the x-axis: the 
pattern will return a value of 0 at x=0, a value of 1 at x=pi/4 and 
again a value of 0 at x=pi/2.

The frequency-modifier however can be seen as to modify the color_map, 
the lookup-table so to speak.
For example: adding frequency 0.5 will have the same effect as only 
using the first half of the color_map as the whole color_map, resulting 
in the following color_map:

color_map {
    [0 red 1]
    [1 green 1]
}

And the result will be a gradient-like pigment along the x-axis with 
colors interpolated between red at x=0 to green at x=pi/2 and again 
back to red at x=0

So: scale changes the size of the pattern (or the function), and 
frequency changes the, well, the frequency of the colors used in the 
color_map (the "lookup-table")

clearer? :)

cu!
-- 
#macro G(b,e)b+(e-b)*C/50#end#macro _(b,e,k,l)#local C=0;#while(C<50)
sphere{G(b,e)+3*z.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1;
#end#end _(y-x,y,x,x+y)_(y,-x-y,x+y,y)_(-x-y,-y,y,y+z)_(-y,y,y+z,x+y)
_(0x+y.5+y/2x)_(0x-y.5+y/2x)            // ZK http://www.povplace.com


Post a reply to this message

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