Copy link to clipboard
Copied
I'm taking the fxphd course to get me starting and it's helping a lot in understanding how things work. But I have a couple of concept questions.
1. what's the difference between a layer and a world? The instructor said that the sdk calls a layer a world. But in 3d math and opengl I think of world as something else. And I see functions like GetLayerToWorldXform and I see the docs talking about layers. So it makes me think that either I misunderstood him or he was simplifying things or was incorrect.
2. If I wanted to replicate the transform plugin and make an effect that can position and scale layers (but not apply any pixel effects), would that plugin only need to change a matrix or would it need to render pixels? Maybe it's in the docs and I don't know what to search for, but I can't seem to find an explanation of how to do this.
This is my thinking.. let's say I had a plugin that filled the layer/solid/whatever with a checkerboard. I don't think moving this solid around in space or scaling it does anything to how that plugin is rendering that checkerboard. It still gets rendered at render size first. And then the layer position, rotation and scale, etc are transforming that layer as a last step during compositing. Can I have a layer that either doesn't have a cmd_render or doesn't do anything in it? Can I checkout the transformation matrix, change it and check it back in?
1 Correct answer
Hi,
these are actually very good questions!
So, just to try to make it clear (and the SDK is not always clear...): a 'world' usually refers to a PF_EffectWorld, roughly the pixels of your layer. This world is used by Effect layers. The effect layer's input and output are both worlds.
It is different from the '3D' world, meaning the 3D space of your composition, in 3D math or OpenGL. This is no 3D geometry, just a flat bunch of pixels...
I think if you really get the difference between a Layer Effect
...Copy link to clipboard
Copied
Hi,
these are actually very good questions!
So, just to try to make it clear (and the SDK is not always clear...): a 'world' usually refers to a PF_EffectWorld, roughly the pixels of your layer. This world is used by Effect layers. The effect layer's input and output are both worlds.
It is different from the '3D' world, meaning the 3D space of your composition, in 3D math or OpenGL. This is no 3D geometry, just a flat bunch of pixels...
I think if you really get the difference between a Layer Effect and an AEGP, it'll answer most of your questions 🙂
You can read the descriptions of Layer Effect and AEGP in the SDK.
And here's a quick explanation, probably uncomplete, but may be more instinctive:
Layer Effect: an effect affecting the output of your layer. Your Checkerboard example is a good example. You're right, it doesn't depend on the layer's geometry inside the composition.
AEGP: if you already know 'scripts', you can see AEGPs like more powerfull scripts. If not, well, you can see AEGPs like a way to modify your project like a user would do. An AEGP can add/remove keyframes, change layers order, modify composition settings, add/delete effects, layers, etc... Almost anything except modifying the output of layers. An AEGP can for example move a layer in the 3D space of your composition by modifying its position parameter.
Now the tricky part: 3D effects!
You mention OpenGL and 3D maths, so I guess you'll end up trying to write a 3D plugin (like a particles effect, may be? let's take this example)
This effect will be a Layer Effect plugin, cos' it'll render something on your layer, i.e. particles.
BUT! If you want this Layer Effect to depend on composition's 3D geometry and camera (via matrices) you'll need to get infos like an AEGP would do. GetLayerToWorldXform will provide you this kind of info. And in this case, the 'world' is actually a world like in OpenGL and 3D maths...
So, what's the difference between this Layer Effect and an AEGP? The AEGP can actually modify the composition's geometry, the Layer Effect can only modify the layer's output.
If you take Trapcode Particular, you usually apply it to a 2D solid. It gets the composition's geometry, render particles in this space, but never modifies the composition's geometry. Your solid is still a 'flat' 2D solid, and its position, rotation... don't change.
Sorry, my answer is probably a bit messy, and I hope it's not more confusing 😉
Cheers,
François
Copy link to clipboard
Copied
Thanks for your answers. That does answer #1 so cheers on that. Explaining that the world is the pixels on a layer makes it very clear!
But #2 still isn't quite answered yet.
I do understand what AEGP is and what a layer effect is. And I've used effects like element3D where you create a solid which is a canvas for the effect to do it's thing on. In my plugin I will need both. And if that actually has to be 2 "plugins" that's ok. But in that case my AEGP plugin will create layers (to install presets) and add my layer effect to those layers to assist in the animation of those presets. But for this application, my layer effect doesn't need to change the pixels (unless it must), it only needs to reposition the layer's position. And maybe this is the "wrong" way to go about it, but I still want to give it a try this way. Every other product that I've seen do this uses expressions to animate the layers. I'd like to try a solution where I have a layer effect to handle the motion preset, in the same way the transform layer effect does. I don't want to actually change the values in the layer's own transform properties. I want to completely do it programmatically, leaving those values and keyframes open.
If you look at the transform layer effect it provides a secondary position, scale, and rotation, etc, and has an option to turn on or off the motion blur there. So imagine you have a comp, put a white solid in it, then apply the transform layer effect. If you use the normal layer->transform->position to move the white solid off the screen, the transform layer effect can move it completely back. It doesn't get cropped off. And keyframing that effect will result in motion blur. You can continue adding transform layer effects moving the solid on and off the screen and none of them crop the edge of the solid off.
So what is really happening here? Is the transform layer effect simply accessing and modifying the position values internally (but not showing those changes in the layer's position properties? And then the motion happens during compositing? Or is the transform layer effect actually re-rendering the pixels in the new positions and scale, and then growing the layer bounds so that it can be returned to screen without being cropped? I'm starting to think the 2nd. But I wish there was a way to do the first.
Is there any way to do that? In an effect not in an aegp by creating keyframes.
As a test I brought in a photo, used one transform effect to scale it very small, then used a 2nd to scale it back up. And the resulting image had lost all it's detail. So this leads me to believe that the effect is re-rendering the pixels.
I still want to try to do this without expressions. My next idea would be to have a property of an effect that I can pickwhip a layer position to. I see the "wiggle" layer effect does this. It seems to be nothing more than placeholder for values that get used by a transform effect. So how do I make a layer effect not render pixels. Just not do it or do I have to copy the input to the output?
Copy link to clipboard
Copied
wait.. so I think what you're saying is that I can read the GetLayerToWorldXform but not modify it.
Copy link to clipboard
Copied
"So what is really happening here? Is the transform layer effect simply accessing and modifying the position values internally (but not showing those changes in the layer's position properties? And then the motion happens during compositing? Or is the transform layer effect actually re-rendering the pixels in the new positions and scale, and then growing the layer bounds so that it can be returned to screen without being cropped? I'm starting to think the 2nd. But I wish there was a way to do the first."
Sorry, but you're thinking right, this is second solution, and no real way to do the first.
I think I see what you're trying to do, but you can't do it the way you describe it. A Layer Effect cannot modify geometry, only output. But to exactly answer your question, a Layer Effect can do 'nothing' by just copying input to output.
If you do something like the transform effect, you'll still hit issues. For example, if your layer is scaled 0, it won't be rendered at all, so your effect won't work. If you want to modify the geometry of the layers into the composition, AEGP (or scripts) is the way to go. But it means going through keyframing and/or expressions.
Now, for the pickwhip stuff, you can add all the parameters you want in your effect. They don't affect the render. You can modify the ouput based on these parameters, but only you decide to do it. So if you want your effect to have 100 point parameters that you can pickwhip, and still do 'nothing', go ahead!
"wait.. so I think what you're saying is that I can read the GetLayerToWorldXform but not modify it."
When you get the matrix, you can modify it, no worry. What I meant is it won't modify the actual geometry of the layer itself (its position, scale, rotation), only its output.
If you give a bit more details on what you want to achieve, there are probably some workarounds to find...
Cheers,
François
Copy link to clipboard
Copied
I think that does answer it for me. I need to get in and code a test and see it work. I'll do that later this week.
I think what you're saying is that if I get the layerToWorld Xform and modify it I would only be modifying it locally and modifying it won't "Set" it back so that my modification effects the transformation of the layer.
Therefore if I wanted to do what I said I wanted to do, I would create some parameters (are these called streams?) and output my values in there according to my code. Then copy the input to the output in the layer effect so that it has no effect (there's no way to skip this step?). Then I can use a simple expression to have my output values affect the actual layer transform parameters, or have my output values via an expression affect the transform parameters on a transform effect. My AEGP plugin can build all of these layers and effects and similarly to how scripts use markers to allow the user to make changes,
Essentially what I want to do is make an animation preset plugin that simplifies some of the work. There are others out there that do it but they take a slightly different approach. And obfuscated or not I'd rather not have all my code in an expression, I'd rather have it in the plugin. And thanks because you have cleared up for me how to do that.
My next issue that I'm searching down is how to fill a panel in a aegp plugin with some interactive content. I don't get why the panelator sample only shows a blank window and not at least one button in there. Are there any samples that show how do populate a panel via C/C++?
Copy link to clipboard
Copied
"I think what you're saying is that if I get the layerToWorld Xform and modify it I would only be modifying it locally and modifying it won't "Set" it back so that my modification effects the transformation of the layer."
Exactly. Internally, you can do whatever you want (the matrix is just numbers...)
"Therefore if I wanted to do what I said I wanted to do, I would create some parameters (are these called streams?) and output my values in there according to my code."
It won't work, as parameters are just input, not output. Modifying parameters is the same than modifying position or whatsoever. You're right, a parameter is a stream, just like position or rotation, and streams cannot be modified at render time... The only thing it can modify is the ouput.
"copy the input to the output in the layer effect so that it has no effect (there's no way to skip this step?)"
It's been discussed here: Re: Pass Through Effect
"how to fill a panel in a aegp plugin with some interactive content"
I have no idea! But there must be someone out there knowing 🙂
Cheers,
François
Copy link to clipboard
Copied
"It won't work, as parameters are just input, not output. Modifying parameters is the same than modifying position or whatsoever. You're right, a parameter is a stream, just like position or rotation, and streams cannot be modified at render time... The only thing it can modify is the ouput."
Ohhh.. I see. Ok.. That's very helpful to know.
Copy link to clipboard
Copied
Hi guys, hope you're both well, i appreciate this post is over 1 year old but it would be really great to double check something Francois said :
"It won't work, as parameters are just input, not output. Modifying parameters is the same than modifying position or whatsoever. You're right, a parameter is a stream, just like position or rotation, and streams cannot be modified at render time... The only thing it can modify is the ouput."
Does this mean it's impossible to create a plugin that :
Contains 2 layer selectors
Gets the position of each of the 2 layers
Finds the middle point
Moves the host layer to the middle point or sets a point parameter on the plugin to the middle point value, which can then be pickwhipped.
I know this can be done easily with expressions, however this is just a very basic example and expressions make after effects very slow. I can use extendedscript to calculate the values and create keyframes, but unfortunately I need it to work realtime. My scripting skills are excellent and I'm keen to learn the SDK but at this stage it's only worthwhile if I can manipulate the values at realtime.
Please let me know if this is possible, really appreciate any advice/help/examples you can offer.
Kind regards
Copy link to clipboard
Copied
before CC2015 it was possible but highly problematic, as changing a param
during render time invalidates the render result, and causes an endless
render loop. (as long as the value keeps changing during render time)
since CC2015, the render thread is prevented from changing param values, or
making any change to the project, for that matter.
changing param values is only allowed from the UI thread. so what you're
describing is possible, with the following issues left to solve:
1. your plug-in's UI thread won't get called when other layers change their
position. you'll need to figure out a way for telling when a change
occurred, and trigger the param update.
2. each such change enters the undo stack. you can make your changes not
appear there by creating a NULL named undo group, however, when the user
undoes and redoes your param will go out of sync with the current state.
On Tue, Aug 7, 2018 at 12:11 PM, jamesVoodooMotion <forums_noreply@adobe.com
Copy link to clipboard
Copied
Sorry for the late reply, i was busy meeting an animation deadline! Hope all going well for you and thanks for the advice, much appreciated!
Building efficient character animation rigs is so frustrating. In 3ds Max the C based MaxScript works really well but AE Expression evaluation becomes sooooooo slow! The ability to create/edit paths in CC2018 was an exciting update, just wish it worked faster even on my new computer! Can a plugin manipulate Shape Layer or Mask paths realtime and would it be faster than expressions?
I'm trying to imagine what plugins could be created to help build more efficient character rigs.
Many thanks!
Copy link to clipboard
Copied
Unfortunately not...
The only way to modify masks, if you want to avoid expressions, is the way I wrote BAO Mask Avenger 2 - aescripts + aeplugins - aescripts.com
It bakes the mask path, and it was a nightmare to make it "almost realtime".
Sorry, no good news
Copy link to clipboard
Copied
Thanks, i remember seeing Mask Avenger 2 on AEScripts, a nice plug-in! Also like your BAO Bones but never got round to use it in any projects because I'm mostly doing vector animation

