need expression for smoothly rotating animation

   14194   15   1
User Avatar
Member
365 posts
Joined: April 2008
Offline
Hi
I am trying to manually set keyframes on my butterfly with four wings.
It doesnt look rotating nicely, kind of rough looking rotation even after many trials.
Can any one help me how to achieve smooth rotation perhaps using expression or whatever. Thanks.

Steve.
User Avatar
Member
120 posts
Joined: July 2009
Offline
aren't these things usually animated by hand? By this I mean drawing path constraints.. actually maybe if you made a cylinder or something and just did a procedure based off the rotation of the cylinder (and attached the wings to it) that could be a way to do it in houdini.
User Avatar
Member
349 posts
Joined: Aug. 2006
Offline
sin() would work nicely. Also if you are using keyframes and want to keep it that way, running the specific channels through a lagCHOP will smooth things out to a certain degree.

Edit: This is for wing animations. If you mean for flight of the actual insect, then using a curve as a path as rdane suggests will be good enough (I re-read your post).

Also look at smooth()


float smooth (float value, float minimum, float maximum)
Taks a value and range and returns a smooth interpolation between 0
and 1.

When <value> is less than <minimum>, the return value is 0. If <value>
is greater than <maximum>, the return value is 1.


EXAMPLES
| smooth ($F, 12, 55)
|
This example will generate an ease-type curve between values 0 and
1, starting at frame 12 and ending at frame 55. Dig it!
User Avatar
Member
861 posts
Joined: Oct. 2008
Offline
Shift-click the Rotate channel. You will see the animation curve and any problems with continuity.
--
Jobless
User Avatar
Member
365 posts
Joined: April 2008
Offline
ragupasta
sin() would work nicely. Also if you are using keyframes and want to keep it that way, running the specific channels through a lagCHOP will smooth things out to a certain degree.

Edit: This is for wing animations. If you mean for flight of the actual insect, then using a curve as a path as rdane suggests will be good enough (I re-read your post).

Also look at smooth()


float smooth (float value, float minimum, float maximum)
Taks a value and range and returns a smooth interpolation between 0
and 1.

When <value> is less than <minimum>, the return value is 0. If <value>
is greater than <maximum>, the return value is 1.


EXAMPLES
| smooth ($F, 12, 55)
|
This example will generate an ease-type curve between values 0 and
1, starting at frame 12 and ending at frame 55. Dig it!


————————————————————————————-

Thank you very much !
But, Can you help me further please ?
Should i put the sin( ) at the rotate para for each bone if i have multiple bones. What value should i fill in ( ) ? I guess starting with $F and degree ?
Thanks again in advance.

Steve
User Avatar
Member
365 posts
Joined: April 2008
Offline
Soothsayer
Shift-click the Rotate channel. You will see the animation curve and any problems with continuity.

—————————————————————————-

You mean on the actual channel (curve)in the channel editor view ?
Thank you very much.

Steve
User Avatar
Member
861 posts
Joined: Oct. 2008
Offline
You could do it this way.

On the main tab I added 2 parameters. They are floats called Frequency and Amplitude.

These channels are then copy-pasted into the rotation in a sin expression sin($F*Frequency)*Amplitude.

You can animate the wing by animating those 2 new channels.

Attachments:
butterfly.hipnc (38.1 KB)

--
Jobless
User Avatar
Member
365 posts
Joined: April 2008
Offline
Soothsayer
You could do it this way.

On the main tab I added 2 parameters. They are floats called Frequency and Amplitude.

These channels are then copy-pasted into the rotation in a sin expression sin($F*Frequency)*Amplitude.

You can animate the wing by animating those 2 new channels.


—————————————————————————————-
On the main tab I added 2 parameters.


Sorry I am a beginner. Can you show me more how to get there please. And explain a little more details. Thank you so much.

Steve
User Avatar
Member
861 posts
Joined: Oct. 2008
Offline
The top right quadrant of your screen should show parameters by default. There is an icon that looks like gears. In there you can select “Edit Parameter Interface”. You can add any type of parameter but in this case I choose a float, which is a single rational number. You add it with the little arrow and assign it a name, a label, etc.

You will then have a new, custom made parameter that you can animate.

You can use this parameter as a variable in another expression. If you right-click the name of the parameter you can copy it. Then, in your other expression you can paste it either as a value or as a referenced channel.

A sine wave is a good-enough approximation of how a butterfly wing flaps. $F refers to the current frame number so it can take the role of the more familiar “x” in sin(x), so you can write sin($F) to get an sine wave. If you have an expression in the form of sin($F*f+c)*A then “f” will adjust your frequency, c will phase shift the wave, and A scales the amplitude. You could even add several sine waves to get a more interesting shape. In fact, having sufficiently many sine waves you could make any shape you wanted.

You could just copy-paste that channel then onto other wings.
--
Jobless
User Avatar
Member
365 posts
Joined: April 2008
Offline
Soothsayer
The top right quadrant of your screen should show parameters by default. There is an icon that looks like gears. In there you can select “Edit Parameter Interface”. You can add any type of parameter but in this case I choose a float, which is a single rational number. You add it with the little arrow and assign it a name, a label, etc.

You will then have a new, custom made parameter that you can animate.

You can use this parameter as a variable in another expression. If you right-click the name of the parameter you can copy it. Then, in your other expression you can paste it either as a value or as a referenced channel.

A sine wave is a good-enough approximation of how a butterfly wing flaps. $F refers to the current frame number so it can take the role of the more familiar “x” in sin(x), so you can write sin($F) to get an sine wave. If you have an expression in the form of sin($F*f+c)*A then “f” will adjust your frequency, c will phase shift the wave, and A scales the amplitude. You could even add several sine waves to get a more interesting shape. In fact, having sufficiently many sine waves you could make any shape you wanted.

You could just copy-paste that channel then onto other wings.




WOW !!
Arikado Gozaimassne !!
Thank you very much for your tremendous patient and kind help.
I will try it. If i have still any difficulties can i post to you again.
Thank you so much again.

Steve,

By the way, I am looking for my ex-college roommate named “ Shin” Forgot his last name starting with N -. He is from Kyoto. He studied Journalizm. He was a wonderful cook speciallized in Kyoza. Uhmm, makes me hungry again.
User Avatar
Member
861 posts
Joined: Oct. 2008
Offline
OK, if I see Shin “N” among the other 18 million people today Ill say hello to him!
--
Jobless
User Avatar
Member
365 posts
Joined: April 2008
Offline
Soothsayer
OK, if I see Shin “N” among the other 18 million people today Ill say hello to him!


Thanks.

I am stuck after i added the new floating para, named “butterfly rotation” to the existing para. I guess i need to the same thing for all four wings. Would you please explain further the expression that i need to make and copy to where ? X, or Y or Z rotaion para of each wing (there are four wings, top 2 and bottom 2) ? Thank you very much again.

Steve
User Avatar
Member
861 posts
Joined: Oct. 2008
Offline
Just right-click the channel name, copy and then paste to the other channel.
--
Jobless
User Avatar
Member
1631 posts
Joined: July 2005
Offline
Hi aplink,

I strongly recommend going through the Help to familiarise yourself with the interface & features. Go to Help menu > Start Here to get introduced to GUI etc. There is also an Expression cookbook that will improve your understanding on using expressions within Houdini.

Good luck!

Cheers!
steven
User Avatar
Member
617 posts
Joined: Aug. 2008
Offline
thinking outside Houdini for other Apps,
you could do a slider that does, this,
if its 0 it hand animation, if is more than lets say .01 that is the value of a sin expression, and as keep moving the slider up the expression moves up.

that can help or in the speed of the animation, or in the range of the sin equation (affecting the rotation angle)
User Avatar
Member
365 posts
Joined: April 2008
Offline
pelos
thinking outside Houdini for other Apps,
you could do a slider that does, this,
if its 0 it hand animation, if is more than lets say .01 that is the value of a sin expression, and as keep moving the slider up the expression moves up.

that can help or in the speed of the animation, or in the range of the sin equation (affecting the rotation angle)


Can you let me know what that is ?
I am interested in

Steve
  • Quick Links