|
![](/i/fill.gif) |
I'd like to use density functions in the media of a transparent-surfaced
cylinder, to depict patterns of standing waves in a cylindrical cavity. How
do you manipulate the values of the density function? The available pattern
modifiers don't seem to do what I need.
For example, look at this transparent cylinder containing a sine_wave
function of a gradient in x, depicted as glowing 3-D patterns in red &
green.
// cylinder containing sinusoidal standing waves
cylinder {
<0.5, 0, 0> <-0.5, 0, 0> 0.2 // cap and end, radius
hollow // must be hollow to accomodate interior
texture {Container_T} // texture transparent to see interior
interior { // interior
media { // media
intervals 1
samples 1,1
emission 1 // emission 1 (glowing)
density { // density function
gradient x // gradient in x direction
frequency 4 // spatial frequency (4 cycles)
sine_wave // gradient function sine_wave
color_map { // color map
[0 color red 1] // density 0 maps to red
[1 color green 1] // density 1 maps to green
}
}
}
}
}
That works OK, and makes a pattern like a 4th harmonic standing wave in a
flute. But can you modify that pattern with mathematical manipulations, for
example to subtract 0.5 from each point in the density function, then
multiply by two, so as to shift it from the range 0 to 1 into the range -1
to +1?
Or can you take each point in the density map, and raise its value to some
exponential i.e. p[x,y,z] = exp(p[x,y,z], expVal)?
Or take the square root of each value i.e. p[x,y,z] = sqrt(p[x,y,z])?
Or are density functions necessarily limited to the range 0 to 1?
Slehar
Post a reply to this message
|
![](/i/fill.gif) |