Copy link to clipboard
Copied
Using SmartFX and expanding on the 'Shifter' Example project, how can I expand the bounds of my square layer here to show the shifted image on top in its entirely, rather than being restricted to the original square?  
I know it is something to do with the extra and/or PF_CheckoutResult but cannot pinpoint how by messing with the result_rects!
Thanks!
 
3 Correct answers
If you want to go outside the bounds of the original layer to which the effect is applied, you'll need to resize the output buffer; see the (aptly-named) Resizer sample.
To expand the buffer in smartFX, in pre render you need to expand the result_rect and max_result_rect and then set the flag
extra->output->flags = PF_RenderOutputFlag_RETURNS_EXTRA_PIXELS;
In my case, I expanded the result_rect, then unioned it with the output rects which also expanded them:
PF_Rect expandedRect = in_result.result_rect;
expandedRect.left -= stuffP->innerExpansion.left; // expand by subtracting on the left and top
expandedRect.top -= stuffP->innerExpansion.top;
expandedRect.right += stuffP->innerExpansion.right;
expandedRect.bottom += stuffP->innerExpansion.bottom;
UnionLRect(&expandedRect, &in_result.result_rect);
UnionLRect(&expandedRect, &in_result.max_result_rect);
U
...Copy link to clipboard
Copied
Try applying Grow Bounds before you apply Shifter.
Copy link to clipboard
Copied
Rick, I don't believe there are any example projects or code for that! I'm asking how to do it via the SDK, not applying premade effects.
Copy link to clipboard
Copied
If you want to go outside the bounds of the original layer to which the effect is applied, you'll need to resize the output buffer; see the (aptly-named) Resizer sample.
Copy link to clipboard
Copied
To expand the buffer in smartFX, in pre render you need to expand the result_rect and max_result_rect and then set the flag
extra->output->flags = PF_RenderOutputFlag_RETURNS_EXTRA_PIXELS;
Copy link to clipboard
Copied
@James Whiffin Which rects are we talking about, the extra or the input? I have tried on the extra and the input in various places in the PreRender(), but I get 'AEGP Magic Error'. Is this the right format?
 
Copy link to clipboard
Copied
In my case, I expanded the result_rect, then unioned it with the output rects which also expanded them:
PF_Rect expandedRect = in_result.result_rect;
expandedRect.left -= stuffP->innerExpansion.left; // expand by subtracting on the left and top
expandedRect.top -= stuffP->innerExpansion.top;
expandedRect.right += stuffP->innerExpansion.right;
expandedRect.bottom += stuffP->innerExpansion.bottom;
UnionLRect(&expandedRect, &in_result.result_rect);
UnionLRect(&expandedRect, &in_result.max_result_rect);
UnionLRect(&in_result.result_rect, &extra->output->result_rect);
UnionLRect(&in_result.max_result_rect, &extra->output->max_result_rect);
I don't quite understand why your code gave a magic error though.
Copy link to clipboard
Copied
Here is the link from another thread with the checkout layer - https://community.adobe.com/t5/after-effects-discussions/is-it-possible-to-access-all-input-pixels-i...

