Copy link to clipboard
Copied
Hi,
I'm trying to figure out how to make a PF_LayerDef, draw into it and then use transform_world() to paste it all over the place at varying sizes.
I can get the basic process to work with composite_rect(), but transform_world() - to get the scaling and rotating to work) is stumping me and I can't find a single bit of code either in the SDK or online that uses it. Basically my blank empty layer stays blank and empty and there's no indication that the command is actually doing anything at all.
Here's where I think my problems lie:
1. mask_world0? If I pass NULL, will it just grab all the pixels? None? Random pixel data?
2. src2dst_matrix? huh? I've set it to true and false and see no difference.
3. matrices? Just to start, I'd like to get an identity matrix working. {{1,0,0}{0,1,0}{0,0,1}} Right?
4. dest_rect? I assume this needs to be the same width as my (potentially) scaled source?
code available upon request to see what I'm doing wrong.
Thanks
-Rich
in respect to your question, this is what i did to earn my "transform_word" badge:
1. passing a NULL for a mask_word0 will use the whole frame.
I use a NULL there, so don't worry about this param. (until you want to use it...)
2. you can either use 1 matrix or two.
if you choose to use 2, the you'll get motion blur from the first matrix transformation to the 2nd matrix transformation.
the syntax for using two matrixes is: (&matrix1, &matrix2).
if you use just one matrix, lose the parentheses. just: &m
...Copy link to clipboard
Copied
in respect to your question, this is what i did to earn my "transform_word" badge:
1. passing a NULL for a mask_word0 will use the whole frame.
I use a NULL there, so don't worry about this param. (until you want to use it...)
2. you can either use 1 matrix or two.
if you choose to use 2, the you'll get motion blur from the first matrix transformation to the 2nd matrix transformation.
the syntax for using two matrixes is: (&matrix1, &matrix2).
if you use just one matrix, lose the parentheses. just: &matrix1.
and don't forget to tell the function how many matrixes you're passing.
in case you're passing two matrixes, but wish to use just one (no motion blur), then the second of the two will be used.
3. as opposed to the way 3x3 matrixes are usually referred to in math,
AE's 3x3 matrixes are x and y swapped.
what the hell does that mean?
it means that what you would expect to put in matrix[1][2], should actually be in matrix[2][1].
check out the CCU sample.
there are a couple of functions there that will create an identity matrix and concatenate it with scale and rotation matrixes.
I used that code myself (though i merged it into one comfortable function).
once you get it to work, you can also add shearing to the process. (just another matrix to be concatenated).
4. the transform_world function doesn't accept NULL for a rectangle (some functions do, and regard it as "full frame").
to begin with, use a full frame rectagnle. when EVERYTHING else works, try just the destination rectangle.
I hope this helps.
🙂
Copy link to clipboard
Copied
VERY helpful. Thanks.
I got it working now, and it's nice. My biggest problem was that I wasn't thinking matrix-y enough and somehow got it into my head that the top left corner of my destination rectangle would be where it drew the top left corner of the transformed world, instead of putting offset coords into the matrix itself. What was I thinking?!?
Well, it works flawlessly now. I do wish there were a few more samples in the (otherwise tremendously helpful) SDK.
Thanks again
-Rich