ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

sampleImage of 3D Layer

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Greg Markovis
sampleImage of 3D Layer
on Dec 17, 2019 at 1:42:58 pm

Hi everyone. I have an issue with sampleImage of 3D layer that I can't figure out
So I have a composition with 2D shape layer a 3D shape layer and camera. I added expression to Fill of 2D layer that targets 3D layer.
What I would like to do is sample from 3D layer when it enters the point (100,500) of my composition view regardless of camera zoom etc. It works fine when I change 3D layer to 2D but right now the position of sampleImage point gets shifted from (100,500) of my comp view. I believe I have to use toComp somewhere but I don't know where.

3DLayer.sampleImage([100,500]), [0.5, 0.5]);


Return to posts index

Dan Ebberts
Re: sampleImage of 3D Layer
on Dec 17, 2019 at 5:10:42 pm

I got this to work:

myLayer = thisComp.layer("3DLayer");
p = myLayer.fromCompToSurface([100,500]);
myLayer.sampleImage(p,[0.5,0.5])


Dan



Return to posts index

Greg Markovis
Re: sampleImage of 3D Layer
on Dec 17, 2019 at 6:36:59 pm

Thank you for the response ☺
It doesn't work form me here whats happening. When I apply your expression to Fill Color of my 2D Layer the point of sampling occurs to be somewhere around (0,0) of my composition not defined (100,500). When I zoom camera or change Z position of 3D Layer the point of sampling moves somewhere else.
Maybe I didn't express myself good enough (sorry English is not my first language).
So what I'm trying to achieve is a steady point in my composition x,y dimensions that will sample 3D Layer whenever it will enter this point radius regardless of 3Dlayer Z position or camera Zoom amount. If 3D layer appears underneath this point it should be sampled. Like let's say you would want to draw sampling point at the screen with a marker to stay at your monitor 2D space and sample layers beneath it.


Return to posts index


Dan Ebberts
Re: sampleImage of 3D Layer
on Dec 17, 2019 at 6:50:03 pm

Hmmm... That's exactly how it works for me. I can move the camera or 3DLayer, but the expression samples the layer at [100,500] in the camera view. I'm not sure why it doesn't work for you.


Dan



Return to posts index

Greg Markovis
Re: sampleImage of 3D Layer
on Dec 17, 2019 at 7:10:06 pm
Last Edited By Greg Markovis on Dec 17, 2019 at 7:24:19 pm

Ok thank you anyway. Maybe there is something wrong with my setup. I'm just gonna upload screenshot from my test comp maybe you can spot some obvious mistake


Return to posts index

Dan Ebberts
Re: sampleImage of 3D Layer
on Dec 17, 2019 at 11:29:31 pm

Is there anything that's not square pixels?

Dan



Return to posts index


Greg Markovis
Re: sampleImage of 3D Layer
on Dec 18, 2019 at 12:04:48 am

Nope only these two shape layers. But you know what Dan, don't bother anymore. I will find a way to just not to make this layer 3D. I feel like I'm wasting your time. I'm trying to reverse engineer expressions by looking at them visually trying to figure out what they mean when I really should start from the beginning by understanding code language.

I would like to also thank you for everything that you do on this forum. For the last few days, I was digging through it and found many solutions by combining different expressions and you were always there.
I'm going to leave one here maybe it would be helpful for someone someday.
This expression applied to source text will display RGB,CMYK and HEX values.

Thanks again

theColor = thisComp.layer("Symbol Comp 1").effect("Fill")("Color") ;
R= (theColor[0]),
G = (theColor[1]),
B = (theColor[2]);
if (R<G) { R=G; } k = 1- Math.max(R, B);
c = (1-R-k) / (1-k);
m = (1-G-k) / (1-k);
y = (1-B-k) / (1-k);
r = Math.round(theColor[0]*255);
g = Math.round(theColor[1]*255);
b = Math.round(theColor[2]*255);
str = (r*65536 + g*256 + b).toString(16);
if (str.length &lt; 6) str = "0" + str;

//*Outputs,delate if not needed*//
//*RGB*//
"R:" + Math.round(theColor[0]*255) + " G:" + Math.round(theColor[1]*255) + " B:" + Math.round(theColor[2]*255)+
"\r"+
//*CMYK*//
"c:"+Math.round(c*100)+" m:"+Math.round(m*100)+" y:"+Math.round(y*100)+" k:"+Math.round(k*100)
+"\r"+
//*HEX*//
"Hex:"+" #"+str


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]