After each frame is rendered, the time it took to render it is used to determine what the ETA is for the remaining frames. This unfortunately results in a very jumpy and inaccurate estimate, since each frame time differs slightly. This is a very common issue in pretty much all the software I use, and it’s honestly not that a huge deal. Still, it is a “quality of life” thing which I think your users would appreciate being addressed, and this solution really shouldn’t be too difficult to implement.
What I’m proposing is not to do an overall average of all the frames rendered, since that wouldn’t account for when render times change due to background processes. Instead, what I’m talking about doing is known as a “low pass filter”. It will give your ETA calculation a more stable and reliable average frame time to use. It will constantly adjust itself in case background processes impact render times, and it only takes one line to do all the work.
The variables:
CurrentFrameTime = The time it just took to render the currently displayed frame (this is the input)
FilteredFrameTime = Filtered render time which will be given to the ETA calculation (this is the output)
The algorithm:
if FilteredFrameTime == 0, then FilteredFrameTime = CurrentFrameTime
FIlteredFrameTime = (CurrentFrameTime * .1) + (FilteredFrameTime * .9)
Since ‘FilteredFrameTime’ uses itself in that second line, we make sure that the first time it runs (when it’s equal to zero), ‘FilteredFrameTime’ will initially be set to whatever the ‘CurrentFrameTime’ was. Without that first line, the ‘FilteredFrameTime’ would be slowly climbing up from zero. (Or it could also be a null or something else you wouldn’t want.)
In the main equation, the numbers .1 and .9 can be anything but they MUST both add up to 1. They are essentially the “strength” of the filter, and will affect how slowly the frame time adjusts itself. Having the smaller number applied to the input (CurrentFrameTime) instead of the output (FilteredFrameTime) will make the filter stronger and give much more useful results.
If the numbers were 1 and 0, then it would remove the filter altogether. If the numbers were .001 and .999 then it would still work, but it would be very slow to adjust itself, and ETAs for preview renders wouldn’t be that accurate. I think the first number should probably be somewhere between from .01 to .1 (and then the second would be 1 minus the first number).
Okay, thanks for reading all this.