Maya Training

Introduction to Hard Surface Modeling

Maya Training

Interiors and Furniture Vol 1 & 2 - Modeling & Cloth

Maya Training

Shading, Lighting and Rendering the Bedroom in MR

Maya Training

Robot volume one - Modeling with animation in mind

Maya Training

Spach-Alspaugh House the complete courseware

Maya Training

Burt The Cartoon Dinosaur Vol 01 - Modeling

New Maya Training

Robot Volume 02 - Hybrid Rigging
You are here > Home > SimplyMaya Community Forums
Loading

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!

Old 09-11-2003, 12:54 AM   #1
Dann
Registered User
 
Dann's Avatar
 
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
Thanks: 0
Thanked 2 Times in 2 Posts
Question 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
 
Dann is offline   Reply With Quote
Old 12-11-2003, 07:18 PM   #2
Dann
Registered User
 
Dann's Avatar
 
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Did I stump you all?
Dann is offline   Reply With Quote
Old 17-11-2003, 02:01 PM   #3
Alan
Moderator
 
Alan's Avatar
 
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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....
__________________
Technical Director - Framestore

Currently working on: Your Highness

IMDB
Alan is offline   Reply With Quote
Old 17-11-2003, 11:08 PM   #4
Dann
Registered User
 
Dann's Avatar
 
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
Thanks: 0
Thanked 2 Times in 2 Posts
Default

not sure I understand what you're saying?
Dann is offline   Reply With Quote
Old 01-12-2003, 09:00 PM   #5
Alan
Moderator
 
Alan's Avatar
 
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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
Alan is offline   Reply With Quote
Old 03-12-2003, 08:51 AM   #6
misterdi
Registered User
 
Join Date: Sep 2002
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

$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
 
misterdi is offline   Reply With Quote
Old 03-12-2003, 09:00 AM   #7
misterdi
Registered User
 
Join Date: Sep 2002
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
misterdi is offline   Reply With Quote

A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2015 SimplyMaya - vBulletin® Copyright © 2000-2015, Jelsoft Enterprises Ltd.