Skip to main content
Participating Frequently
March 13, 2017
Answered

world vs layer

  • March 13, 2017
  • 1 reply
  • 2043 views

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?

This topic has been closed for replies.
Correct answer françois leroy

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

1 reply

françois leroy
françois leroyCorrect answer
Inspiring
March 14, 2017

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

badweaselAuthor
Participating Frequently
March 14, 2017

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?

badweaselAuthor
Participating Frequently
March 14, 2017

wait.. so I think what you're saying is that I can read the GetLayerToWorldXform but not modify it.