0

hi guys i want to render a body in blender from all sides. i wrote a code where the camera rotates around a body in steps and renders one image each time. but i don't know how to make the code change the name of the file. so that each photo has a different name, because the program always overwrites the photos.

import bpy

#Kamera erstellen def camera_add(): bpy.ops.object.camera_add(location=(0, 10, 0), scale=(1, 1, 1)) bpy.context.object.rotation_euler[0] = -1.5708 bpy.context.object.rotation_euler[1] = 3.14159

camera_add()

#Objekt (CUBE) erstellen def körper_plazieren(x,y): bpy.ops.mesh.primitive_cube_add() bpy.context.object.location[0] = x

körper_plazieren(0,1)

Rotation mit rendern

i=0 for i in range(5): bpy.context.object.location[0] = 0 bpy.data.scenes[0].render.filepath = '...Desktop/Blender/testnew' bpy.ops.render.render(write_still=True) bpy.context.object.rotation_euler[0] = i * 1.5708

i want it to render images by eachrotation, but save the image with different names each , so it dont overwrite the images.

yaviii
  • 1
  • I think you can just replace bpy.data.scenes[0].render.filepath = '...Desktop/Blender/testnew' with bpy.data.scenes[0].render.filepath = f"...Desktop/Blender/testnew{i}" or something similar to this. – NeverConvex Aug 12 '21 at 22:05
  • Why not just animate the camera about the body, and render an image sequence? – TheLabCat Aug 13 '21 at 02:24
  • 1
    I'd suggest, create all cameras in the first place, then render. Also see: https://blender.stackexchange.com/questions/8850/how-to-take-images-with-multiple-cameras-with-script, https://blender.stackexchange.com/questions/8850/how-to-take-images-with-multiple-cameras-with-script and there is more... e.g. alternatively you can also create markers: https://blender.stackexchange.com/questions/23121/is-it-possible-to-set-the-output-name-based-on-the-current-timeline-marker/23145#23145 – brockmann Aug 13 '21 at 06:33

0 Answers0