View Full Version : Expression Help

10-01-2003, 05:56 PM
Hi guys,
I posted this at the LW newsgroup already but noone could give me an answer...

I want to animate leaves twirling... I have used particleFX to make the leaves fly around and through eachother the way I want to, but there is one problem. I use FXLinker to attach the leaf object to the 100 or so particles, and I give it a spin (via FX_linker), because I want them to spin... However, when they drop to the floor they keep on spinning (and this is correct).

However, I'd like their pitch and bank to return to 0 when they are on the floor, and otherwise twirl around happily. Ive been doing my best with Expressions, but ive never been very
good at programming, and it doesnt want to do what I want it to do... Ive been reading the manual and the expression builder system, but to no avail... could someone help out? Maybe there's a better way?
Ive been trying to make an expression that links the bank of a leaf to the height. Something like Bankchannel: [channel.y]/10
This does not work though...



10-01-2003, 11:24 PM
You cannot do that via a simple expression (or any native expression in LW) since those cannot evaluate their own channels. You would have to create 100 Nulls and use them as reference. Also simply resetting your bank and pitch will give you a jumpy animation at the end of the fall. I would try to play around with Motion Designer which should be able to give you the kind of animation you need.


10-03-2003, 06:29 AM
Md eh?

Have alwyas shooed away from MD... aver since I tried that tue with the sail flapping in the wind that went horribly wrong. My family is mourning that day still. Oh, the horrors!

But you believe it can be done with MD? Care to explain or would it be self explanatory?

10-03-2003, 08:10 AM
Here, I just did an example. It's probably not exactly what you're looking for but it will give you a direction to go in.

My first screen shot here is in Layout. I have a bunch of polygons in one layer that I've surfaced leaves. Each one is a polygon subdivided once so it gives some body to it so md has something to deform. I placed a wind item in the middle and set it to explosion. Like I said, probably not what you want but you get the idea, I just needed something to blow the leaves apart. You can use a clip map to make each polygon a leaf.
I have a simple plane object divided several times to act as the ground.
Fx collision has been applied to the leaves so it will react to the wind.

10-03-2003, 08:11 AM
Here is screenshot 2. The wind has blow the leaves apart. Not much spinning and rotating but you can use whatever settings you currently have via FXlinker that works for you.

10-03-2003, 08:12 AM
Here are the leaves hitting the ground. I had no error in the calculation and every leaf hit the ground and laid flat. I didn't tweak the settings at all, it just worked.

10-03-2003, 08:18 AM
Basically, if you're not good with MD, here are the basics. For this example, you just need some leaf objects in one layer and your ground plane in another. Open up MD in Layout, select your leaves layer, activate the layer and turn on target under that first tab. Target tells MD that this is the object you want to deform. Next select your floor layer and turn on Collision. This tells MD the object you want to interact or collide with your target object.
Under the second tab(surface), choose your leaf surface and tweak the settings. I would refer to the manual on what each setting does. For my example, I just gave the leaf surface the heavy cloth preset. You might want to stiffen the leaves up a bit though and you can use the sub-structure or viscosity setting to do that.
Under the third tab (environment), you can set gravity and wind and such. You can use this or you can use the FX wind which I did in this case.

Good luck and post us your results when you're finished.

10-03-2003, 08:21 AM
Expressions are great things and they're even easier now with the built in expression builder but I still avoid them at all costs if there is another solution. MD will work great in this situation I think but it may take a little experimentation on your part. But that's what learning Lightwave is all about.

10-03-2003, 08:39 AM
Here is an animated GIF of the leaves hitting the ground, you can see that they conform to the shape of the ground. Like I said you can stiffen them up via MD if you need.

Also, you can see that the leaves slide a little on the ground, you can also fix that in MD if you want. Just play with the friction settings...

Not sure if this 493kb gif is too big for some people, it loaded pretty fast for me but you can let me know if it's too big and I'll make them a bit smaller in the future.

10-04-2003, 08:51 AM
thats cool, so what happens if you rotate them using FXlink? do they work with MD correctly?

10-06-2003, 07:26 AM
Mr Giger,

I thank you from the bottom of my heart for this comprehensive and completely clear and kind answer from you.
I will definately try to use this method, as it looks like exactly what I was looking for. I have used FX winds to animate my particles, and since it looks like MD usues FX winds I wouldnt actually have to setup my animation again!

Many many thanks, and Ill report here when its finished.

10-06-2003, 01:03 PM
Mr. Giger....That's funny....You can call me HR :)

No problem, I hope that's helpful to you. Honestly, this was so quick to setup and the results are decent enough that with a little tweaking, I think it could be pretty great. Good luck.

10-06-2003, 01:04 PM
Originally posted by HowardM
thats cool, so what happens if you rotate them using FXlink? do they work with MD correctly?

Howard, I didn't try it but I assume it would. The Wind seemed to work fine with MD...

10-09-2003, 04:55 AM
I know who giger is.. just wanted to express my respect... Mister!

I think FXLinker just makes keyframes for spin and rotation, so then it wouldnt work... but who needs it if they twirl because of MD anyway!

Im gonna try it *now* cos my object file lost its LightScape data. which sucked, so I had to make that again, took me a while...

10-09-2003, 05:50 AM
It works like a charm. It works very very slow as well... but thats the price you pay for cloth calculations I guess... My leaves are quite detailed... still it calculates at only a frame per second which makes it hard to prototype the winds. Mind you, I have 8 winds 3 turbulences and some other gimmicks and a few collision surfaces for 3000 poly's... damn, i love lightwave.

I think i will make a dummy object first, to speed it up with low resolution calculations and then replace the object when its done...

Thanks again, and I will post the results here!

10-11-2003, 01:42 AM
Uhh... damn! :)

I really have to try that out too... Never used MD nor FX-Linker, but HR just made a tutorial! ;)

Lightwave rocks! :)

10-22-2003, 08:41 AM
Well I must say this MD solution is a lot harder than using the particles... the leaves dont really react as, well, leaves... they're more like swarming birds ... they dont spin or flick over when blown... I know that this is probably a setting in md somewhere, but which? Stiffness?