• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Creating an effect plugin for a new blend mode

Participant ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

Hey Folks. I'm developing an effect plugin that will implement a new blend mode. Here is how it will work from the user's point of view:

 

1) Add a background image layer to the composition.

2) Add a foreground image layer.

3) Set the "adjustment layer" flag on the foreground layer.

4) Apply my affect to the foreground layer.

 

Here's the problem: In order to blend the foreground layer with the pixels behind it, I need to get the pixels for the foreground layer, and the pixels behind that layer. Getting the pixels behind the layer is easy. I simply call checkout_layer_pixels() on the layer that my effect is applied to, and since it's an adjustment layer, it gives me the pixels behind it. However, I don't know how to get the original foreground pixels in my layer.

 

How would I get the foreground pixels?

TOPICS
SDK

Views

635

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 17, 2021 May 17, 2021

ok, we'll need to escalate.

you can force AE to give you any item's image buffer by asking for it directly.

1. use AEGP_GetLayerSourceItem() to get your layer's itemH.

2. use AEGP_NewFromItem() to get a AEGP_RenderOptionsH for that item.

3. use AEGP_RenderAndCheckoutFrame() to get a receipt.

4. AEGP_GetReceiptWorld() will fetch you the pixels for the receipt.

 

it's a bit more wasteful that regular layer checkouts, since AE can't tell in advance you need some frame and therefore keep it in cache

...

Votes

Translate

Translate
Community Expert ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

perhaps an layer param set to "self" as a default would fetch the layer's original pixels? if that works for you, you can make that param invisible so it would appear to happen automagically.

you'll probably also need to use the old checkout meachnism instead of the new checkout_layer_pixels(), as they differ in the returned result. the old one fetches the original layer pixels pre masks and effects, while the new one fetches post masks and effects.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 14, 2021 May 14, 2021

Copy link to clipboard

Copied

You mentioned this: "You'll probably also need to use the old checkout meachnism instead of the new checkout_layer_pixels()."

 

I'm not familar with this old checkout system, and I can't find anything about it in the SDK documentation. Can you point me in the right direction? What function should I call?

 

Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 14, 2021 May 14, 2021

Copy link to clipboard

Copied

you need to checkout a layer param.

 

PF_ParamDef checkout;
ERR(PF_CHECKOUT_PARAM( in_data,
index_of_layer_param,

in_data->current_time,
in_data->time_step,
in_data->time_scale,
&checkout));

the fetched pixels will be at checkout.u.ld

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 17, 2021 May 17, 2021

Copy link to clipboard

Copied

Darn. That approach doesn't work. Adding another layer parameter to "self" doesn't return the original pixels. Since self is an adjustment layer, it returns the pixels that are behind the layer.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 17, 2021 May 17, 2021

Copy link to clipboard

Copied

ok, we'll need to escalate.

you can force AE to give you any item's image buffer by asking for it directly.

1. use AEGP_GetLayerSourceItem() to get your layer's itemH.

2. use AEGP_NewFromItem() to get a AEGP_RenderOptionsH for that item.

3. use AEGP_RenderAndCheckoutFrame() to get a receipt.

4. AEGP_GetReceiptWorld() will fetch you the pixels for the receipt.

 

it's a bit more wasteful that regular layer checkouts, since AE can't tell in advance you need some frame and therefore keep it in cache. however, it's not THAT a big a difference...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 21, 2021 May 21, 2021

Copy link to clipboard

Copied

This works great. Thanks so much!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 21, 2021 May 21, 2021

Copy link to clipboard

Copied

LATEST

you're welcome. 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines