Render by time instead of sample count

This may be more a feature request than a question. I think it’s a little addition that needs to be considered, and shouldn’t be too difficult to implement either. Obviously this is important for animations that have a lot of frames, still renders shouldn’t need it.

The problem is this: Let’s say you have a long animation in Cycles, containing a lot of camera movement or changing objects. Some frames take longer to render than others, depending on what’s visible to the camera at that moment. When it’s time for the artist to produce the final render, they need to find the best settings (namely samples) to get good results while getting everything rendered in an acceptable time frame. I usually do a calculation of the form “the scene has 1000 frames, a frame takes some 6 minutes to render, I leave the computer rendering for about 10 hours a day, so the film should finish rendering in roughly 10 days”. However this is both tedious to do manually, as well as inaccurate since I can only estimate an average render time based on specific frames. In many cases my calculations were off, and I ended up wasting more time than I anticipated on rendering.

I realized it would be extremely helpful if instead of specifying a number of light samples, I could specify an amount of time for which I want each frame to render. It would be so much easier if instead of telling Blender “render each frame at 100 samples, I don’t care how long it takes” I could instead tell it “render each frame for 5 minutes, I don’t care how many samples you get”. The downside is of course a varying amount of samples, as frames that are slower will appear more noisy as they’re stopped sooner… however it’s a price I’d be willing to pay for having an exact render time for my animations, especially if I use random sampling which may hide it.

This should be a piece of cake to implement with progressive refine: Simply add a timer which stops the rendering and moves on to the next frame, once the specified amount of time has passed. With tile based rendering I’m not sure how it could be done: Each CPU / GPU core waits for the tile to finish sampling before declaring it done, and you can’t predict how long a tile will take until you’ve already rendered it… I assume a smart formula could ultimately be found here.

What do you think of this idea: Would you also consider it helpful? Is it doable? Has anyone made an addon or attempted to implement it in Blender before? Any chance we could get the developers to consider something like this?

That might be possible for progressive refine rendering, but I don’t know if that’s even possible with tiled rendering (and you will often want to do tiles now for the ability to use the denoiser).

The reason why it might not be possible for the latter is because the engine can’t know the length of time it will take to sample each tile and use that to get a ballpark estimate on the number of samples to do (because some tiles might take a lot longer to finish than others).

I was briefly thinking of a solution: Render only a certain number of samples per tile, then abandon it and attend to the next tile, but once all tiles are done start over and repeat the procedure. This is a process you can loop until a timer runs out.

For instance, let’s say you specify 10 samples per attempt: The CPU / GPU cores render the image as usual, and for each tile they only do 10 samples. However once they’ve finished rendering all tiles, they don’t call it a day and instead resume to add 10 more samples to all tiles in a second rendering phase. Then once that finishes another 10 in a third phase, and so on. New re-rendering phases only stop after the time limit has been reached, after which you also denoise the tiles then run the compositor.

Obviously this isn’t 100% accurate: If you set your timer to 5 minutes and use 10 samples per phase, and adding 10 samples to every tile takes 1 minute, the overall process will stop anywhere between 5 and 6 minutes. Still it would be much better than nothing!