- February 21, 2021 at 12:20 am
Hi everyone, I’m having a problem with a personal project where I want to spread a bunch of lavenders as a field and use cc bend it to animate them flowing with the wind, and ofc I don’t want to keyframe all of them so I’m using a sampleImage() expression to sample the brightness of a gradient as the value for bend it.
Now the problem is it all works well in 2d but as soon as I turn the 3D layer switch (of the lavender vectors) on to spread them into a field the sampleImage() stops sampling from the gradient layer as the sample position is tied to the position of the lavender layer.
is there any way I could sample the gradient layer while the lavender layers are 3D ?
I want to make a zoom out from the field and some parralax effect would be great
here’s the expression I used if it helps:
// To sample from the gradient layer sampleLayer = thisComp.layer("Bend controller"); samplePoint = transform.position; sampleSize = [1,1]; colour = sampleLayer.sampleImage(samplePoint,sampleSize); x=colour*100; // To convert the brightness range into a smaller range input = x; inputmin=0; inputmax=100; outputmin=0; outputmax=16; output=linear(input,inputmin,inputmax,outputmin,outputmax); value=output
- February 23, 2021 at 4:04 am
There’s actually a Sample Image Expression utility in newer versions of AE that simplifies that process quite a bit – you can find it in under Effects & Presets.
You could in theory put a bunch of the utilities on your gradient layer (precompose it first if your gradient is created using effects), and then tie each utility to one of the flower’s positions. Then tie that flower’s CC Bend It to the sampled value. This works even when the flowers are 3D, though bear in mind it will only use X and Y values to determine the sampled position within the gradient layer.
Would a wiggle expression on the rotation of the flowers serve your purposes just as well? Or maybe a wave warp effect?
Log in to reply.