|
Please note that This document is no longer up-to-date. (Though it is still valid.)
Please note that a more up-to-date document is available. A paper has been published that
covers the topic in a more comprehensive way. It proposes besides the Damper nodes also the
group of Chaser nodes that are usefull in cases where the Dampers fail.
To the paper: Linear Filters - Animating Objects in a Flexible and Pleasing Way
If you decide to continue reading this document, please keep in mind that now some fields on
the Damper nodes have
changed their name.
|
The ColorDamper node alows to smoothly animate color
value. It can be used to create the effects of a light bulb that when turned on, needs a fraction
of a second to heat up and reach its full brightness. Conversly when turned off, it needs some time
to completely stop emitting light. The length of this second period can be specified separately.
EXTERNPROTO ColorDamper
[
eventIn SFColor set_input
field SFColor initial_input # 0 0 0
eventOut SFColor output_changed
field SFColor initial_output # 0 0 0
eventIn SFColor set_output
exposedField SFFloat tau # 1
exposedField SFFloat negTau # -1
field SFInt32 order # 1
eventOut SFBool isActive
eventOut SFBool isLoaded
]
"Dampers.wrl#ColorDamper"
|
|
|
The ColorDamper internally
converts the input into HSV, does the calculations and converts back to
RGB before outputting the results. This allows to go directly over red
from yellow to violett instead of taking the longer route over green,
magenta and blue.
Explanation of the fields:
Here only the tau and
negTau fields are explained.
For the other fields see the page about all
Damper PROTOs.
It contains a general description of the fields to which there is not much to
add to here.
In general the Damper nodes
have only one tau field that
controls the speed how fast the output follows the input. The
ColorDamper has two of them.
If negTau is -1,
tau determines the time
constant of the filters in all cases.
If negTau
is 0 or positive, tau
sets the time constant if the brightness of the color (V value)
increases and negTau
determines the time constant if the brightness is to decrease.
The Demo:
There are six spheres in the scene.
A Script node sets the
diffuseColor,
emissiveColor and
specularColor of the
left most sphere to random values every approximately 2 seconds.
For each of the other spheres there are three
ColorDamper nodes, one
for each type of color — diffuse- emissive- and specular
color. The Dampers for the first sphere after the left most sphere
have their order field
set to 1, the Dampers for the second sphere after the left most one
have their order field
set to 2, and so on. The tau
field of all ColorDampers
has the same value 0.4 . Each Damper node processes the outputs of the
Script and sends it to
its associated sphere.
This demo shows that with an order
set to 1 the color sent on
output_changed immediately follows
the color sent to set_input.
With an increasing order field
the resulting color changes more smoothely and the delay from the input
to the output increases.
__.-.__ end of document
|