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

How to stop AE caching every param change output?

New Here ,
Jan 19, 2019 Jan 19, 2019

Hi guys,

I am working on an after effects plugin  and for now I only have two params for testing purposes. What I am noticing is ae is caching the ouput image for every param change, even just when scrubbing the slider. How can I disable this? Another thing that happens is if I change the param fast it gives wrong ouput (e,g rotating a model will have wrong rotation param applied) and that combined with caching every param change output results in a very glitchy output animation. If I press ctrl and use the slider to change the param than I get correct results but fast param change gives me incorrect result possibly because the param changes so fast that the plugin is unable to render and copy it back to ae buffer within that time?  Or maybe I need to render lower res while the param is changing (scrubbing)? but how do I detect that the param is changing?

Trying to solve the param caching problem I have tried both smart render and regular render entrypoint and these flags  and I can't get it to work.

PF_OutFlag_PIX_INDEPENDENT |

PF_OutFlag_USE_OUTPUT_EXTENT |

PF_OutFlag_DEEP_COLOR_AWARE |

PF_OutFlag_NON_PARAM_VARY |

PF_OutFlag_FORCE_RERENDER;

TOPICS
SDK
1.1K
Translate
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
New Here ,
Jan 24, 2019 Jan 24, 2019

Hey Shachar could you please reply.

Translate
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 ,
Jan 25, 2019 Jan 25, 2019

in regards to making AE not cache frames, that's actually a user preference. AE caches whatever it can, so if a certain effect's param settings have gone back to a previous state, the render output would already be cached and no render would be needed. AE decides when to purge such frames. why would you not want that?

if you absolutely MUST disable that behavior for your plug-in only, you can sabotage the cache in 2 ways:
make all your params supervised, and on USER_CHANGED_PARAM :

1. set some random value into your sequence data, and during pre-render set it using GuidMixInPtr().

2. change some hidden param's value to a random value.

both methods would create a new unique state on every user interaction that AE doesn't have it's output cached. so previous setting WILL be cached but won't be used. on method 1, they won't be used even if the user uses undo to rerturn to previous states.

as for the glitchy behavior, i have never encountered such behavior.

is sounds to me like your algorithm is not handling re-entrancy and is stepping on it's own toes. can that be the case?

Translate
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
New Here ,
Jan 26, 2019 Jan 26, 2019

Thanks for the reply.

After your reply what I have realized is I need to fix first why is incorrect frame being rendered first when the params change fast like scrubbing. If the correct frames was being rendered then there would no need for me to try to disable caching frames. I am not sure why I am getting incorrect results, maybe by the time my plugin renders and tries to copy data back to ae buffer, render request for another frame is already in the way and I get incorrect render? Do i need to call PF_ABORT before rendering and copying data back to ae buffer?

If I am unable to fix this then I will try your suggested steps to sabotage the caching.

Translate
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 ,
Jan 26, 2019 Jan 26, 2019

you call PF_ABORT to check if AE wants you to stop the current render.

if indeed you aborted the render, you need to report

back PF_Interrupt_CANCEL as an error code, so AE would know the output

buffer is not be used.

On Sat, Jan 26, 2019 at 9:35 PM thirdmenson <forums_noreply@adobe.com>

Translate
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
New Here ,
Jan 26, 2019 Jan 26, 2019

I am doing this:  ERR(PF_ABORT(in_data));

Can you provide example code how to report PF_Interrupt_CANCEL if ae wants to stop current render?

Translate
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
New Here ,
Jan 26, 2019 Jan 26, 2019

Here is an example crash I get when I hit space bar to play, it crashes when it's trying to render fast. In this case it show crash when trying to read camera values but it used to crash when playback even before read camera code was in there. Most of the times  I get no useful stack trace while crashing in either Bee.dll or msvcr120.dll access violation reading location 0xFFFFFFFFFFFF

crash.png

Translate
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 ,
Jan 26, 2019 Jan 26, 2019

this is definitely some reentrancy/stack overflow/buffer overrun issue.

invalidating the cache is the least of your worries...

only for the sake of testing, try putting a mutex lock in your entry point

function. if the crashes and bad frames go away, it's a re-entrancy issue.

(but for the love of god, don't keep the mutex after that test...)

On Sat, Jan 26, 2019 at 10:23 PM thirdmenson <forums_noreply@adobe.com>

Translate
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
New Here ,
Jan 26, 2019 Jan 26, 2019
LATEST

I tried adding a mutex lock at the beginning of the render entry point and unlock it at the end of it and it still crashes on playback.

I must say the graphics library I am using expects to be called from a single thread and I am just calling it in the render entry point which is a single thread.

I do see this explanation in the sdk:  PF_Interrupt_CANCEL :  " Both effect and AEGP callbacks can return this to effects, if a user action aborts a render. If the effect gets this error from a callback, it should stop processing the frame and return the error to the host. Failure to pass the error back may result in misrendered frames being cached. " 

Which fits what is happening in my case. This   ERR(PF_ABORT(in_data)); won't report correct error back? How do I detect his abort and return PF_Interrupt_CANCEL? Can you provide an example code.

Translate
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