ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Re: sampleImage + Trapcode Particular - If sample area is not a specific color, emit particles

COW Forums : Adobe After Effects Expressions

FAQ   •   VIEW ALL   •   ADD A NEW POST   •   PRINT
Respond to this post   •   Return to posts index   •   Read entire thread


Filip Vandueren
Re: sampleImage + Trapcode Particular - If sample area is not a specific color, emit particles
on Oct 21, 2018 at 11:59:20 am

So if I understand correctly, the layer with the particle system is in an entirely different composition than your "map" with shapes that shows where the emitter should be active ?
That comp is not available as a (hidden) layer inside the comp with the emitter ?
That would make it harder because you would need to sample every layer of your shapes-comp…
-> So just add the "animation" comp as a layer to your "Particular" comp, and then make the layer invisible.

Another complicating factor is that your Particular setup could be 3D: is there an (animated) camera, is the emitter's position's Z-value varying over time, or is it always at Z=0 ?
If it's not just a 'flat' particle system, we need to transform the 3D position of the emitter to a 2D position for sampleImage.

The easiest way to tackle this is to add a Null-layer, make it 3D and give its position this expression:
thisComp.layer("red square particles").effect("Particular")("Position")

Then we'll use this Null-layer as our reference and the expression below should hopefully work for you now…

sl=thisComp.layer("Animation"); // the layer to sample from
pl=thisComp.layer("Null 1"); // the layer that represents the 3D location of the emitter
// first do some voodoo to get parented, scaled, or not precisely aligned layers to work seamlessly
pos2d=sl.fromComp(pl.toComp(pl.anchorPoint));

// sample th target layer
sampleColor = sl.sampleImage(pos2d , radius = [3, 3], postEffect = true, t = time);

if (sampleColor.toSource()=="[0, 0, 0, 0]") { // change this to your color value
0;
} else {
1000;
}




Posts IndexRead Thread 


Current Message Thread:





© 2019 CreativeCOW.net All Rights Reserved
[TOP]