|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hello
Is it possible to customize "wave_form" in color patterns ?
Thanks
--
Kurtz le pirate
Compagnie de la Banquise
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
kurtz le pirate <kur### [at] gmailcom> wrote:
> Hello
>
> Is it possible to customize "wave_form" in color patterns ?
> Thanks
Well, ... yes, but as far as I know, you can only do it in the TOK / Bald Eagle
over-complicated "write the whole thing yourself from scratch" method.
You know that you can use a function to define a pigment pattern,
pigment {function {}}
and that you can have POV-Ray convert any inbuilt pigment pattern into a
function.
function {pigment {}}
So what you do, is you take your pattern, convert it into a function, and then
use a user-defined function to modulate that 0-1 range according to the
wave_type that you implement in your function.
#declare f_Pattern = function {pigment {}}
#declare f_Wave = function {my_wave_type}
#declare WavePattern = function {f_Pattern * f_Wave}
Then you make a texture using the "average" pattern, and use the product of your
pattern function and wave function to control the rgbft values in the average
texture.
#declare WaveModifiedPigment =
texture {
pigment {
average
pigment_map {
[
function { WavePattern (x, y, z).red }
color_map {
[ 0 red 0 ]
[ 1 red 5 ]
}
... etc
}
Depending upon your exact needs, you _might_ need to create a special cumulative
distribution function (cdf) using a spline, and then employ importance sampling
by writing a probability density function (pdf) to return your color_map value
from the cdf for any given pattern value. And THAt will be your actual f_Wave
function that you use in the average texture.
Hope that "helps".
- Bill
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 08/11/2023 12:58, Bald Eagle wrote:
> kurtz le pirate <kur### [at] gmailcom> wrote:
>> Hello
>>
>> Is it possible to customize "wave_form" in color patterns ?
>> Thanks
>
>
> Well, ... yes, but as far as I know, you can only do it in the TOK / Bald Eagle
> over-complicated "write the whole thing yourself from scratch" method.
>
> You know that you can use a function to define a pigment pattern,
> pigment {function {}}
> and that you can have POV-Ray convert any inbuilt pigment pattern into a
> function.
> function {pigment {}}
>
> So what you do, is you take your pattern, convert it into a function, and then
> use a user-defined function to modulate that 0-1 range according to the
> wave_type that you implement in your function.
>
> #declare f_Pattern = function {pigment {}}
> #declare f_Wave = function {my_wave_type}
> #declare WavePattern = function {f_Pattern * f_Wave}
>
> Then you make a texture using the "average" pattern, and use the product of your
> pattern function and wave function to control the rgbft values in the average
> texture.
>
> #declare WaveModifiedPigment =
> texture {
> pigment {
> average
> pigment_map {
> [
> function { WavePattern (x, y, z).red }
> color_map {
> [ 0 red 0 ]
> [ 1 red 5 ]
> }
> ... etc
> }
>
> Depending upon your exact needs, you _might_ need to create a special cumulative
> distribution function (cdf) using a spline, and then employ importance sampling
> by writing a probability density function (pdf) to return your color_map value
> from the cdf for any given pattern value. And THAt will be your actual f_Wave
> function that you use in the average texture.
>
> Hope that "helps".
>
> - Bill
>
Always there to help ;)
I've already found one method :
pigment {
user_defined {
function { f_sinc (x)*2 } // only red
}
...
} // end of pigment
This is a partial answer to what I wanted to do, but this method can't
be combined (at least not yet) with existing patterns.
The ideal solution (for me) would be :
pigment {
onion
color_map { ... }
myWaveTypeFn // for the wave
}
myWaveTypeFn same as standard cubic_wave, poly_wave, ...
Your (and TOK) suggestion with :
pigment { average pigment_map { [ function ...
is very good and well know.
I use it to color the plane and TOK does the same.
See previous messages about domain coloring and complex numbers.
I'll keep searching ...
--
Kurtz le pirate
Compagnie de la Banquise
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 11/8/23 10:27, kurtz le pirate wrote:
> The ideal solution (for me) would be :
> pigment {
> onion
> color_map { ... }
> myWaveTypeFn // for the wave
> }
>
> myWaveTypeFn same as standard cubic_wave, poly_wave, ...
I confess I'm, unsure what you are trying to do.
The code below works today, FWIW.
Aside: One of the changes yuqk made was so that poly_wave always chains
after the other wave modifiers. Meaning you can use, for example,
'triangle_wave poly_wave 2' and the code runs both modifiers with
poly_wave always being executed last.
Bill P.
// Sample scene. 'povray onion.pov +w800 +h800 +p +mv3.8'
global_settings { assumed_gamma 1.0 }
#declare VarOrthoMult =
3.0/max(image_width/image_height,image_height/image_width);
#declare Camera01z = camera {
orthographic
location <0,0,-2>
direction z
right VarOrthoMult*x*max(1,image_width/image_height)
up VarOrthoMult*y*max(1,image_height/image_width)
}
#declare FnOnion = function { pattern { onion triangle_wave } }
#declare Fn = function {
FnOnion(x,y,z) * 6.0 // = 'frequency 6'
}
plane { -z 0
pigment {
function { Fn(x,y,z) }
poly_wave 2
// I'm using the default color map, but you can chain
// the functions as deep as you want and each chain
// could be a color channel in a user_defined pigment.
}
finish { emission 1 }
}
camera { Camera01z }
// If you want to see linear values in the preview display
// over gamma corrected ones, add display_gamma=1.0 to the
// command line.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
kurtz le pirate <kur### [at] gmailcom> wrote:
> The ideal solution (for me) would be :
> pigment {
> onion
> color_map { ... }
> myWaveTypeFn // for the wave
> }
>
> myWaveTypeFn same as standard cubic_wave, poly_wave, ...
I think this might work:
Take onion, and make it
#declare Onion = function {pigment {onion}}
Now define a user-defined wave function to apply to the domain of the original
pigment function
#declare Wave = function {sin (Onion (x, y, z)*tau)}
pigment {
Onion
color_map { ... }
// and now the wave function is already built into the pigment pattern
}
You just need to use the 0-1 values returned by your pigment pattern as the
input for your wave function.
If you're going to be using a pigment pattern that POV-Ray assigns an in-built
color_map to, then you need to override that in your original pigment function
with a user-defined color map going from black (1) to white (1).
#declare Onion = function {pigment {onion} color_map {[0 rgb 0] [1 rgb 1]}}
- BW
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 11/8/23 16:44, Bald Eagle wrote:
> #declare Onion = function {pigment {onion} color_map {[0 rgb 0] [1 rgb 1]}}
FWIW. A better option, when all you want is a pattern's scalar value for
a function is:
#declare Onion = function {pattern {onion}}
It avoids the conversion to grey - and, of course, no worries about the
default color map.
---
Aside: I saw your other posts on select() and yuqk/v4 ideas, but it'll
be a bit before I can even read through them. I'm still working through
tuple / batch assignment issues. Once I manage that bit,
'local'/'global' pseudo dictionary and 'optional' issues will pop off
the debug stack.
Busy with real life later today too.
Bill P.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|