Skip to main content
Participant
March 25, 2024
Answered

Sample Image to Scale applied to a 3D layer

  • March 25, 2024
  • 1 reply
  • 1090 views

I've created this Gradient Controller

 

https://youtu.be/1UaZNcVobhg?si=c_kJ0Y9vpdnM4kEG

 

but I need to change and apply that expression to 3D shape layers that form the grid (everything same as in the tutorial, only change is that the layer is supposed to be 3D, not 2D). I need to turn on Collapse Transformations on that precomped grid and work with it as a background in the animation where I animate in 3D space, meaning I need those shape layers to be sharp even if I get close to the grid with the 3D camera.

 

I have already checked all those few threads speaking about this problem but I can't get nothing of it to get to work.

 

Every help would be highly appreciated, thank you very, very much in advance

This topic has been closed for replies.
Correct answer Dan Ebberts

I pasted in the wrong expression, but I'm not sure it explains the error you're seeing. Try this and see if it works any better:

target = thisComp.layer("background");
p = target.fromComp(toComp(anchorPoint));
x = target.sampleImage(p, [.5,.5], true, time)[0];
100*[x,x]

Ah. If your background is 3D you might need to do it this way:

target = thisComp.layer("background");
p = target.fromComp(toComp(anchorPoint));
x = target.sampleImage([p[0],p[1]], [.5,.5], true, time)[0];
100*[x,x]

1 reply

Dan Ebberts
Community Expert
Community Expert
March 26, 2024

Se

target = thisComp.layer("background");
p = target.fromComp(toComp(anchorPoint));
target.sampleImage(p, [.5,.5], true, time)

e if this does what you want:

Dan Ebberts
Community Expert
Community Expert
March 26, 2024

Sorry that was for color. Try this for scale:

target = thisComp.layer("background");
p = target.fromComp(toComp(anchorPoint));
x = target.sampleImage(p, [width, height]/2, true, time)[0];
100*[x,x]
HotoviAuthor
Participant
March 26, 2024

I'm sorry Sir