Copy link to clipboard
Copied
Hi all
Two compositions Comp1 and Displase have been created in the application
Composition Comp1 contains three layers (Blue Solid 1, Magenta-Red Solid 1, Green Solid 1).
The Comp1 composition is placed within the Displase composition and the Displacement Map effect is applied to it.
The displacement layer is set to the Gradient layer of the Displase composition.
As a result of applying the Displacement Map effect, the position of the layers (Blue Solid 1, Magenta-Red Solid 1, Green Solid 1) changes.
Is there a way to get the new position of these layers without using the Motion Track utility?
Copy link to clipboard
Copied
The math is all there already. You could probably use something like this:
mPos=transform.position;
mPoint=mPos.toComp(transform.anchorPoint);
mVal=sampleImage(mPoint,[0.5,0.5]);
mLum=rgbToHsl(mVal)[2];
X=mPoint[0]+effect("Displacement Map")("Max Horizontal Displacement")*mLum;
Y=mPoint[1]+effect("Displacement Map")("Max Vertical Displacement")*mLum;
[X,Y]
Haven't checked it and it's made up from memory, but this is the basic drill should work - multiplying the offset from the map with the map value and adding it to the source value. You may need to add another "correction factor" as displacments tend to not produce the exact value that you dial in due to how all this color math works and of course will need to tweak things for your setup.
Mylenium
Copy link to clipboard
Copied
Thanks Mylenium.
I'll try it tomorrow and share the results