Skip to main content
Inspiring
November 9, 2011
Answered

Layer parameter pixel: best access method

  • November 9, 2011
  • 1 reply
  • 1691 views

Hi guys,

I m using the layer parameters in some effects, and it works well.

Still, I use two methods to do that.

First method:

PF_ParamDef def;


AEFX_CLR_STRUCT(def);



ERR(PF_CHECKOUT_PARAM(in_data,








layerID,







in_data->current_time,







in_data->time_step,







in_data->time_scale,







&(def)));

PF_EffectWorld myLayer= def.u.ld;

ERR2(PF_CHECKIN_PARAM(in_data, &(def)));

PF_COPY(&myLayer, output, NULL, NULL);

Second method:

in PreRender callback:

extraP->cb->checkout_layer(in_dataP->effect_ref,












layerID,









layerID,









&req,









in_dataP->current_time,









in_dataP->time_step,









in_dataP->time_scale,









&ck_result))

in Render callback

PF_EffectWorld myLayer*;

ERR(extraP->cb->checkout_layer_pixels(in_data->effect_ref, layerID, &myLayer));

PF_COPY(myLayer, output, NULL, NULL);

extraP->cb->checkin_layer_pixels(in_data->effect_ref, layerID);

If I read the documentation well, the Second method is the right method. Still the first method works fine...

I m wondering if they are equivalent and if I may encouter some problem with either on of those method...

Thanks for any shared experience.

This topic has been closed for replies.
Correct answer shachar carmi

both methods are ok, but they differ in some ways.

1. the second method is more "economic", as it allows smartFX to plan ahead and use resources more efficiently.

it doesn't affect the single plug-ins performance as much as it allows for the whole rendering process to use ram and buffers better. (and that helps for overall faster renders)

2. smartFX is not supported by all other hosts, so if you care about porting to other hosts, you should take that into consideration (regardless of checking out layers).

3. when checking out the same layer you're on, method 1 will give you a pre-effects image, and method 2 will give you post-effects (previous effects in the stack, that is), even if you sample times other than the time of the currently rendered frame (that caught me by surprise, b.t.w).

if that's relevant to you, you should know which of the two methods you prefer.

1 reply

shachar carmiCommunity ExpertCorrect answer
Community Expert
November 9, 2011

both methods are ok, but they differ in some ways.

1. the second method is more "economic", as it allows smartFX to plan ahead and use resources more efficiently.

it doesn't affect the single plug-ins performance as much as it allows for the whole rendering process to use ram and buffers better. (and that helps for overall faster renders)

2. smartFX is not supported by all other hosts, so if you care about porting to other hosts, you should take that into consideration (regardless of checking out layers).

3. when checking out the same layer you're on, method 1 will give you a pre-effects image, and method 2 will give you post-effects (previous effects in the stack, that is), even if you sample times other than the time of the currently rendered frame (that caught me by surprise, b.t.w).

if that's relevant to you, you should know which of the two methods you prefer.

Inspiring
November 10, 2011

Dear Shachar,

Thank you for the great and simple explanations.

As always you have an answer to all my problems.

Inspiring
November 18, 2011

also if you want to use float images, smart fx, aka checkout_layer/checkout_layer_pixels combination, is the way to go.