10

There is render_stats bpy handler

It seem like it is invoked every time rendering engine prints to console smth like

Fra:0 Mem:410.70M (0.00M, Peak 450.46M) | Remaining:01:16:22.96 | Mem:307.83M, Peak:307.83M | _mainScene, interior | Path Tracing Tile 18/8160

I am wondering if there is a way to get numbers like estimate(01:16:22.96) and current tile(18) from render_stats handler in python script?

Now the only way I see to get this is parsing blender output which is not very cool

There is something alike it in UI, but there is no tooltip with python snippet for it: screenshot

This question may seem alike Is it possible to get render time per tile?, and it's stands there that you can't. But in there it's about render time for specific tile, and I am asking about render time estimation for particular frame, may be you can get overall estimation?

andll
  • 213
  • 2
  • 5
  • there is an addon Render_Time_Estimation in blender you may ant to take a look at the source code – Chebhou Apr 24 '15 at 23:13
  • 1
    I've seen it, as long as I understand, this particular addon estimates total time for animation rendering essentially based on (total_frames_to_render/number_of_renderd_frames*time_spent_so_far). What I am ineteresed about is how to get estimation from rendering engine for rendering one frame – andll Apr 24 '15 at 23:18
  • 2
    Related https://blender.stackexchange.com/questions/133114/is-it-possible-to-get-total-render-time-via-python-code – batFINGER Jun 04 '20 at 05:21

1 Answers1

1

I know it's not the best, but the best I've been able to come up with is code that processes the console output:

  • Output gives you the render time of the last frame
  • Output tells you the frame number that was just rendered
  • You know how many frames are in the complete render, which you can pass to your program
  • You know the start time of the render

From the above, you can calculate the average render time per frame, which I've found after just a few minutes becomes a pretty stable value. If the number of rendered objects per frame changes dramatically over time, then of course the average value will change, but given the average render time per frame, you can come up with:

  • Number of frames which were rendered - grab that from the console
  • Amount of time elapsed (Current time - Start time)
  • Current running average render time per frame
  • Frames left * average time/frame == Render time left

If you have multiple scenes within an animation, you can then also do per-scene calculations, along with the overall animation calculation.

Again, it's not the optimal solution, but it's pretty easy to put together, and it does an effective job of informing you how much time do you have to go before your animation is done.

I hope this helps.

Packetor
  • 44
  • 2