|
|
In article <3a09fccd$1@news.povray.org>, "Daniel Schwen"
<sch### [at] geocitiescom> wrote:
> That leaves me with one problem. The functionvalues are taken modulo
> 1, but with several interfering waves I might get 'overexposures' on
> my 'photographic plate' which I don't want to warp back in intensity,
> but keep white.
> if(pattern>1) pattern=1
> if(pattern<0) pattern=0
If you just want to limit the pattern to the range of 0 to 1, you can do
that within the function:
max(0, min(1, YourFunction(x,y,z)))
This will clamp the function values to the range [0, 1], and avoid the
repeating effect. I like to declare it as a separate function:
#declare Clamp = function {max(y, min(z, x))}
When you use "Clamp(Value, Min, Max)" in your function after declaring
this, the function will return Value constrained to the range between
Min and Max.
> Would it be hard to implement a keyword like 'no_modulo' for the
> pigments?
What exactly would it do? Would it clamp the values instead of repeating
the range [0, 1]?
Another thing that might help: just divide your function by a large
enough number that it can't go outside that range. This will "darken"
the areas without constructive interference, though...which might be
what you want.
Oh, and be aware that the "Onion" function I gave will return negative
values...you might want to use "cos(...)*0.5 + 0.5" or "sqr(cos(...))"
instead of just "cos(...)". Again, this might be something you want to
have...otherwise, there won't be any destructive interference.
I would suggest you keep the existing function(with negative values
intact), divide the result of the function by the number of waveforms
used(or the total of their amplitudes), and clamp it to the [0, 1]
range.(it should already be <1 after those steps, but could still go <0)
--
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/
<><
Post a reply to this message
|
|