3
$\begingroup$

This request is to be used as a workaround for a problem in the current 2.8 build. Everything works perfectly until using the render animation function, some frames are wrong with objects randomly out of place. I have tried many hours of tweaking, and noticed that if I just use the render image button for each frame there is no problem (except having to press render and save as 6000 times).

If one of you Blender legends could whip up a script for this I would be very grateful.

Cycles would take months to render this, however Eevee does it overnight, which was the reason for trying the 2.8.

$\endgroup$
  • $\begingroup$ @bat Thank you, I removed the wrong comment. Use this instead. Also John, have you tried using the background mode render option? $\endgroup$ – Leander Jun 13 '18 at 15:30
5
$\begingroup$

The solution is to use a script to render each frame, and the script needs to include a short time pause. This is the script that solved the problem I have had for days.

import bpy
import time

scene = bpy.context.scene
for frame in range(scene.frame_start, scene.frame_end + 1):
    scene.render.filepath = 'C:/blndtmp/' + str(frame).zfill(4)
    scene.frame_set(frame)
    bpy.ops.render.render(write_still=True)
    time.sleep(3)

Thankyou for all your help Blender Community :)

$\endgroup$
  • $\begingroup$ This question was answered by someone, the solution was simple and works perfectly, yet it's been downvoted. OK. $\endgroup$ – John October Rage Jun 14 '18 at 4:34
  • $\begingroup$ Neither the question nor your answer have any downvotes at this moment. The downvotes may simply be because this solution won't help many others. Since Blender 2.8 is developing and changing all the time the rendering might work properly in just a few days. $\endgroup$ – Leander Jun 14 '18 at 12:04
  • $\begingroup$ Ah roger that. Well it's rendered now thanks again team. Great result. $\endgroup$ – John October Rage Jun 14 '18 at 16:01
  • $\begingroup$ You saved my life, thank you so much. Hope devs will fix this terrible evil bug soon $\endgroup$ – Alumx Jun 13 at 18:09
1
$\begingroup$

Thank you @John October Rage for writing this script!

I edited and improved the script a bit so now it doesn't overwrite the files

And it also fetches info from from Output panel in Properties window so now there's even less manual tinkering needed for this script to work (just make sure the folder path is set in absolute and not relative)

Hope this is useful 👍

import bpy
import time
import os

scene = bpy.context.scene #variable that fetches current scene
outputDir = scene.render.filepath #variable that fetches output directory
filext = scene.render.file_extension #file extension suffix

for frame in range(scene.frame_start, scene.frame_end + 1): #note "frame" is just a variable
    filepath = os.path.join(outputDir, str(frame).zfill(4)) #variable for file checker

    if os.path.isfile(filepath + filext):
        print('File exists, skipping to next...')
    else:
        scene.render.filepath = filepath
        scene.frame_set(frame)
        bpy.ops.render.render(write_still=True)
        time.sleep(3) #wait time in seconds after each frame render, inscreasce if there are dependency/driver related errors


scene.render.filepath = outputDir

print('Finished!')

#RENDERER SCRIPT FOR FIXING BLENDER 2.80 ANIMATION RENDER PROBLEMS
#The name of files will always be frame number (eg. 0000.jpg), Its recommended to separate different takes/versions by folders
#This script will use Output settings that you have defined in Properties tab
#Original script by John October Rage
#Improved by Alumx (with assistence of Bobbe)
$\endgroup$
0
$\begingroup$
import bpy


for frame in range(bpy.context.scene.frame_start, bpy.context.scene.frame_end):
    bpy.context.scene.frame_current = frame
    bpy.ops.render.render()

I have not tested it, but looks like what you need.

$\endgroup$
  • $\begingroup$ Need to set the render filepath otherwise will render to same image for each. Using scene.frame_set(frame) is recommended. $\endgroup$ – batFINGER Jun 13 '18 at 15:30
  • $\begingroup$ Please test your code beforehand. This would also render all frames to the same file and and it wouldn't write any files anyway since write_still=True is missing. Refer to the codeblock in my comment. $\endgroup$ – Leander Jun 13 '18 at 15:32
  • $\begingroup$ Wow that sure was fast. I'm very much appreciating the community as a whole for this program. This is the first time I have have had a question I couldn't find an existing answer for - and it took only minutes. Kudos friends. I shall try both background rendering and the script. $\endgroup$ – John October Rage Jun 13 '18 at 15:40
  • $\begingroup$ Update: Background rendering outputs an access violation error, my guess being it's not quite implemented yet for 2.8 The script WORKS - the frames are correct, but it only ever gets 4 frames in before a crash... perhaps running out of memory I really have no idea... Perhaps it needs time between frames. Is there a scripting function to "wait 2 seconds?" $\endgroup$ – John October Rage Jun 13 '18 at 16:32
  • $\begingroup$ Perhaps this is a job for Autohotkey. Like that time Homer uses that drinking bird to press keyboard buttons for him. I shall keep this thread up to date on developments. $\endgroup$ – John October Rage Jun 14 '18 at 3:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.