Introduction to Maya - Rendering in Arnold
This course will look at the fundamentals of rendering in Arnold. We'll go through the different light types available, cameras, shaders, Arnold's render settings and finally how to split an image into render passes (AOV's), before we then reassemble it i
# 1 09-11-2003 , 12:54 AM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695

Displacement based on an expression?

Does anyone know if it's possible to use an expression to control a displacement? Basically I'm trying to create a sine wave displacement, but I cannot use the Sine or Wave deformers because the displacment has to wrap around a sphere and those deformers only work linearly.

I started doing a displacment based on a ramp and got something that looks like the image below. Notice though that my waves are a bit too linear, and not round enough. So I thought I'd write a sine wave, but I can't seem to get it to work. My expression was

int $height = 10
int $freq = 4;

multiplyDivide1.input1Y = $height * sin( $freq * time );

While the object over time does move in a sine wave like function, it did not create waves like what I want.
Anyone have any thoughts on this one?

Attached Thumbnails
# 2 12-11-2003 , 07:18 PM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
Did I stump you all?

# 3 17-11-2003 , 02:01 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
why dont you vary the frequency and the height variables (using noise or whatever) to adjust the linearity of the waves...? seems the most logical thing to do.... user added image


Technical Director - Framestore

Currently working on: Your Highness

IMDB
# 4 17-11-2003 , 11:08 PM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
not sure I understand what you're saying?

# 5 01-12-2003 , 09:00 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
use some sort of a varying value to adjust the height of the waves so that you dont end up with all the waves at the same height. Isn't that what you wanted to do?


Technical Director - Framestore

Currently working on: Your Highness

IMDB
# 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
# 7 03-12-2003 , 09:00 AM
Registered User
Join Date: Sep 2002
Posts: 19
Actually if you don't need an exact sine function you could do also using simple ramp for the sine with 3 entry black, white, black and set interpolation to smooth.

On the 2d placement, set V repeat to 5.

The rest could be the same, maybe you want to add more entry to the envelope so it has some variance to the envelope value maybe a U and V wave will have some interesting effect too.

Maybe I'm too lazy to setup ramp with so many entries, that's why I'm so useless.

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads