2
$\begingroup$

I have an animated object in the origin of my scene. I want to render the animation from different angles rotating the camera 45 degrees along the path, while keeping the camera pointed at the subject of the scene. I made a circle curve and parented the camera to it, but when I start the animation the camera follows the path.

What I want to do is, have the camera stay in the same location until the rendering of the whole animation finishes, then move 45 degrees and start rendering the whole animation again from the new position, then add another 45 and start rendering the animation again and so on, as shown below the red dots are the location where the camera will stop to begin rendering the animation from this point and once it finishes, it will move to the next stop and so on until it comes back to the first initial location and stops.

$\endgroup$
  • $\begingroup$ @MrZak thanks for your comment. But how I can make it wait until at each position until the animation rendering is finished then move to the next location and render the animation and so on? $\endgroup$ – Tak Feb 15 '17 at 12:35
4
$\begingroup$

animated gif - rendered out from multiple angles

This script will render your scene from the number of angles you specify in the variable numAngles, assuming you have your camera set in the zero position, and the camera is parented to an empty. You can review the setup in the attached blendfile.

The script replaces a traditional animation render, it will by itself render each frame and set the frame number each time. It iterates over the entire span of the animation (specified in the variable animLen) as many times as the number of angles specified in numAngles.

import bpy
from math import radians
from os.path import join

S = bpy.context.scene

renderFolder = "C:/MyRenderFolder/"

camParent = bpy.data.objects['Empty']

animLen   = 40 # frames
numAngles = 8
rotAngle  = 360 / numAngles

for i in range(numAngles):
    # Set camera angle via parent
    angle = i * rotAngle
    camParent.rotation_euler.z = radians( angle )

    # Render animation
    for f in range(1,animLen + 1):
        S.frame_set( f ) # Set frame

        frmNum   = str( f ).zfill(3) # Formats 5 --> 005
        fileName = "angle_{a}_frm_{f}".format( a = angle, f = frmNum )
        fileName += S.render.file_extension
        bpy.context.scene.render.filepath = join( renderFolder, fileName )

        bpy.ops.render.render(write_still = True)
$\endgroup$
  • $\begingroup$ This script replaces a traditional animation render, it will by itself render each frame and set the frame number each time. It iterates over the entire span of the animation (specified in the variable animLen) as many times as the number of angles specified in the variable numAngles. Actually I'll add this comment to the answer to make it clear to everyone. $\endgroup$ – TLousky Feb 15 '17 at 12:53
  • $\begingroup$ And how did you set the camera to position 0,0,0? although it's far from the origin. And is that important? $\endgroup$ – Tak Feb 15 '17 at 12:55
  • $\begingroup$ It's not important, you can place the camera anywhere you want, since we're rotating the empty. The initial camera position will be the zero angle, from which it will be rotated around the parent empty in every rotation cycle. $\endgroup$ – TLousky Feb 15 '17 at 13:01
  • 1
    $\begingroup$ @TLousky awesome answer! Uved. I really like how your python is so clear and easily readable. $\endgroup$ – David Feb 15 '17 at 15:26
  • $\begingroup$ @David It does however break the pep8 requirement of the Best Practice: Style Guide ... Would make a good meta q? $\endgroup$ – batFINGER Feb 16 '17 at 9:30
2
$\begingroup$

I've fixed TLousky's script a bit to be able to render specific range of animation. Maybe someone will find that useful:

import bpy
from math import radians
from os.path import join

S = bpy.context.scene

renderFolder = "C:/MyRenderFolder/"

camParent = bpy.data.objects['Empty']

startFrame = 60 # replace with your start frame
endFrame  = 76 # replace with your end frame
numAngles = 8
rotAngle  = 360 / numAngles

for i in range(numAngles):
    # Set camera angle via parent
    angle = i * rotAngle
    camParent.rotation_euler.z = radians( angle )

    # Render animation
    for f in range(startFrame,endFrame + 1):
        S.frame_set( f ) # Set frame

        frmNum   = str( f-startFrame ).zfill(3) # Formats 5 --> 005
        fileName = "angle_{a}_frm_{f}".format( a = angle, f = frmNum)
        fileName += S.render.file_extension
        bpy.context.scene.render.filepath = join( renderFolder, fileName )

        bpy.ops.render.render(write_still = True)
$\endgroup$

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.