POV-Ray : Newsgroups : povray.general : scaling a PATTERN: using SCALE vs.FREQUENCY Server Time
29 Nov 2024 13:50:43 EST (-0500)
  scaling a PATTERN: using SCALE vs.FREQUENCY (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Kenneth
Subject: scaling a PATTERN: using SCALE vs.FREQUENCY
Date: 18 Oct 2005 16:45:00
Message: <web.43555e39142797ad399425f30@news.povray.org>
I've discovered some odd anomolies when trying to scale several of POV's
built-in PATTERNS (when used in a PIGMENT block).  Not a bug, really, just
undocumented(?) behavior.

There are visual differences between scaling a pattern using the recommended
FREQUENCY modifier vs. the more generic SCALE modifier.   The FREQUENCY
modifier seems to actually alter the pattern itself, whereas SCALE does
not.  I.e., SCALE preserves the visual pattern and simply makes it larger
or smaller, as would be expected. FREQUENCY, however, creates a kind of
subtle "banding" in addition to scaling (the banding looking similar to a
perturbed WOOD pattern.)

The patterns that show this are GRANITE, AGATE and BOZO (which leads me to
believe that this anomoly only shows itself in patterns which use "noise"
as a generator, and/or TURBULENCE.)

I realize there may be reasons for this behavior, perhaps in how the
patterns are generated.  But practically speaking, I prefer to use SCALE to
alter their size, as the pattern appearance is preserved.

However.... this is not a cure-all for the problem in general.  SCALE does
not seem to work at all on the RADIAL pattern, wheras FREQUENCY does.  And
conversely, FREQUENCY doesn't work on the CELLS pattern, while SCALE does!

Perhaps a few caveats could be inserted in POV's discussion of FREQUENCY, to
alert users to this behavior?

Ken


Post a reply to this message

From: Alain
Subject: Re: scaling a PATTERN: using SCALE vs.FREQUENCY
Date: 18 Oct 2005 17:13:01
Message: <4355655d$1@news.povray.org>
Kenneth nous apporta ses lumieres en ce 2005-10-18 16:43:
> I've discovered some odd anomolies when trying to scale several of POV's
> built-in PATTERNS (when used in a PIGMENT block).  Not a bug, really, just
> undocumented(?) behavior.
> 
> There are visual differences between scaling a pattern using the recommended
> FREQUENCY modifier vs. the more generic SCALE modifier.   The FREQUENCY
> modifier seems to actually alter the pattern itself, whereas SCALE does
> not.  I.e., SCALE preserves the visual pattern and simply makes it larger
> or smaller, as would be expected. FREQUENCY, however, creates a kind of
> subtle "banding" in addition to scaling (the banding looking similar to a
> perturbed WOOD pattern.)
> 
> The patterns that show this are GRANITE, AGATE and BOZO (which leads me to
> believe that this anomoly only shows itself in patterns which use "noise"
> as a generator, and/or TURBULENCE.)
> 
> I realize there may be reasons for this behavior, perhaps in how the
> patterns are generated.  But practically speaking, I prefer to use SCALE to
> alter their size, as the pattern appearance is preserved.
> 
> However.... this is not a cure-all for the problem in general.  SCALE does
> not seem to work at all on the RADIAL pattern, wheras FREQUENCY does.  And
> conversely, FREQUENCY doesn't work on the CELLS pattern, while SCALE does!
> 
> Perhaps a few caveats could be inserted in POV's discussion of FREQUENCY, to
> alert users to this behavior?
> 
> Ken
> 
> 
> 
Scale alters the size of the pattern. It can have different values for all 3 axis.
Frequency alters the COLOR_MAP used, making it repeat itself several times as the
pattern's value 
goes from 0 to 1.

-- 
Alain
-------------------------------------------------
Jehovah's Witnesses #3: Shit has been prophesied and is imminent; only the righteous
shall survive 
its happening.


Post a reply to this message

From: Kenneth
Subject: Re: scaling a PATTERN: using SCALE vs.FREQUENCY
Date: 18 Oct 2005 17:40:00
Message: <web.43556aca6294c8e4399425f30@news.povray.org>
Alain <ele### [at] netscapenet> wrote:


> Scale alters the size of the pattern. It can have different values for all 3 axis.
> Frequency alters the COLOR_MAP used, making it repeat itself several times as the
pattern's value
> goes from 0 to 1.
>
> --
> Alain

Not sure if I'm understanding the difference; do you mean that FREQUENCY
only alters the color_map along one or two axes, wheras SCALE alters
everything in 3?

Ken


Post a reply to this message

From: Slime
Subject: Re: scaling a PATTERN: using SCALE vs.FREQUENCY
Date: 18 Oct 2005 17:42:08
Message: <43556c30$1@news.povray.org>
> There are visual differences between scaling a pattern using the
recommended
> FREQUENCY modifier vs. the more generic SCALE modifier.

Well, they do different things. Scale makes everything uniformly bigger.
Frequency just changes how fast it changes from 0 to 1 at any given point.
This has the same result on some patterns (such as gradient), but that's
mostly a coincidence.

> However.... this is not a cure-all for the problem in general.  SCALE does
> not seem to work at all on the RADIAL pattern, wheras FREQUENCY does.

Actually, scaling the radial pattern does work, but has no visible effect.
For instance, if you scale a pattern by 2 to make it twice as big, then the
value of the pattern at, say, <1,1,1> is now moved to <2,2,2> (twice as far
away from the origin). But in the radial pattern, the values at these two
spots are already the same, since they are at the same angle around the
y-axis! So nothing changes.

>  And
> conversely, FREQUENCY doesn't work on the CELLS pattern, while SCALE does!

I think the cells pattern has different behavior than most patterns, and
clips its values to [0,1] rather than wrapping them back around. That could
explain this.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Kenneth
Subject: Re: scaling a PATTERN: using SCALE vs.FREQUENCY
Date: 18 Oct 2005 21:55:01
Message: <web.4355a6016294c8e41916c7ec0@news.povray.org>
"Slime" <fak### [at] emailaddress> wrote:
>
> Actually, scaling the radial pattern does work, but has no visible effect.
> For instance, if you scale a pattern by 2 to make it twice as big, then the
> value of the pattern at, say, <1,1,1> is now moved to <2,2,2> (twice as far
> away from the origin). But in the radial pattern, the values at these two
> spots are already the same, since they are at the same angle around the
> y-axis! So nothing changes.
>

Ah, yes.  A moment's thought reveals this to be obvious.  OOPS!   :-)


Alain <electro.punk [at] netscapenet> wrote:

      > Scale alters the size of the pattern. It can have different values
      > for all 3 axis.
      > Frequency alters the COLOR_MAP used, making it repeat itself several
      > times as the pattern's value goes from 0 to 1.
      >
      > --
      > Alain

     > ... and Kenneth wrote...
     > Not sure if I'm understanding the difference; do you mean that
     > FREQUENCY
     > only alters the color_map along one or two axes, wheras SCALE alters
     > everything in 3?

Uh, my brain is working better now! (I think.)  Of course, SCALE alters
everything along all axes equally. Wheras FREQUENCY simply sets the number
of times the set of colors in the color_map is repeated over a "unit
square," and along only one axis (??). Which IS mentioned in the docs. So
I'm
assuming that since scale works along 3 axes and frequency along only 1 (?),
the "banding" I'm seeing is a result of  this "spatial" difference?  Having
a bit of a hard time visualizing this, and how the final pattern turns out
differently.

The points raised here make me wonder if, in fact, the use of FREQUENCY
should be suggested for only a few special cases, with SCALE being the main
scaling suggestion instead. (At least for patterns that it has a visible
effect on!) All told, FREQUENCY introduces "changes" that SCALE doesn't.

Ken


Post a reply to this message

From: Larry Hudson
Subject: Re: scaling a PATTERN: using SCALE vs.FREQUENCY
Date: 18 Oct 2005 22:52:06
Message: <4355b4d6$1@news.povray.org>
Kenneth wrote:
> Uh, my brain is working better now! (I think.)  Of course, SCALE alters
> everything along all axes equally. Wheras FREQUENCY simply sets the number
> of times the set of colors in the color_map is repeated over a "unit
> square," and along only one axis (??). Which IS mentioned in the docs. So
> I'm
> assuming that since scale works along 3 axes and frequency along only 1 (?),
> the "banding" I'm seeing is a result of  this "spatial" difference?  Having
> a bit of a hard time visualizing this, and how the final pattern turns out
> differently.

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.

Scaling, however, IS directly related to the coordinate dimensions, and 
as Alain pointed out, the scaling can be different along all three axes.

      -=- Larry -=-


Post a reply to this message

From: Kenneth
Subject: Re: scaling a PATTERN: using SCALE vs.FREQUENCY
Date: 19 Oct 2005 01:55:00
Message: <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.

Ken


Post a reply to this message

From: Slime
Subject: Re: scaling a PATTERN: using SCALE vs.FREQUENCY
Date: 19 Oct 2005 03:19:40
Message: <4355f38c$1@news.povray.org>
> 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(?)

If you haven't yet, try the following:

Render an animation of the following scene:

camera {
location y*7
look_at 0 // look down at plane
}
plane {
y,0
texture {
pigment {bozo color_map{[0 rgb 0][1 rgb 1]} frequency .1 + 10*clock}
finish {ambient 1 diffuse 0} // no light sources necessary
}
}

With +kfi0 +kff30 . Watch how the changing frequency alters the pattern.
Specifically, how the "bands" get smaller and smaller, but the pattern
itself doesn't *move* anywhere. Maybe this will help you understand the
effect it has.

What is essentially happening is the value of the pattern is being
multiplied by the frequency value you supply. Then, if the value is bigger
than 1, it is wrapped back around. (So the actual value is x - floor(x).)
There is no spatial movement involved.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Zeger Knaepen
Subject: Re: scaling a PATTERN: using SCALE vs.FREQUENCY
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

From: Kenneth
Subject: Re: scaling a PATTERN: using SCALE vs.FREQUENCY
Date: 20 Oct 2005 22:45:00
Message: <web.435854ad6294c8e46a521a540@news.povray.org>
"Slime" <fak### [at] emailaddress> wrote:

> If you haven't yet, try the following:
>
> Render an animation of the following scene:
>

Thanks, that will be a VERY good way for me to actually see what is going
on.  Haven't tried it yet (I've been busy absorbing all the info posted so
far), but will do so. I can already visualize  what you're describing.

Ken


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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