View Single Post
# 6 03-12-2003 , 08:51 AM
Registered User
Join Date: Sep 2002
Posts: 19

$height * sin( $freq * time )

I don't think "time" is appropriate in this case, as you said your object will be displaced with same amount of value in time, you won't get wave kind displacement.

I got an idea.

Basically I'm using the place2dTexture to drive the sine function.
I create 2 ramp texture, one is for the sine and the other one for envelope.

sine_ramp:
only a single entry, color white. Expression is hooked up in alphaGain.
Expression is:

sine_ramp.alphaGain = sin(place2dTexture1.vCoord * 10.0 * 3.14);

The 3.14 value, my teacher said is approximately a PI constant. So in this case the total wave it's about 5 complete sine wave (1 cycle should be 2 * PI).

envelope_ramp:
3 entry, loc 0, 0.5, 1.0 : color black, white, black : interpolation smooth.
Outalpha from sine_ramp is mapped to alphaGain of envelope_ramp.
The usage of this envelope is to do ease in and ease out of sine_ramp.

Outalpha from this envelope_ramp is mapped to displacement of displacementShader, and as usual displacement from displacementShader is connected to the ShadingGroup displacement.

Create a simple NURBS plane (3 x 3) and apply the shader to it.
Render it and see whether you like it or not. You could adjust the color value in envelope_ramp to reduce the amplitude.

For animation, I think you need to tweak a bit the expression to introduce "time" back in expression. Maybe if you do

sine_ramp.alphaGain = sin((place2dTexture1.vCoord + (time/50)) * 10.0 * 3.14);

you will get some animation of the wave.

This is just an idea, I don't know how it will work in your case.

Attached Thumbnails