Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- import math
- # Set the path where you want to save the renders
- output_path = "D:\\Downloads\\renders\\"
- # Set the name of your object in Blender
- object_name = "Cube"
- # Set the rotation angles in degrees
- angles = [0, 22.5, 45, 67.5]
- # Generate permutations of angles along x, y, and z axes
- permutations = [(x_angle, y_angle, z_angle) for x_angle in angles for y_angle in angles for z_angle in angles]
- # Iterate over each permutation and render the object
- for i, (x_angle, y_angle, z_angle) in enumerate(permutations):
- # Clear existing objects and materials
- bpy.ops.object.select_all(action='DESELECT')
- bpy.ops.object.select_by_type(type='MESH')
- bpy.ops.object.delete()
- # Import your object or create a new one if needed
- if object_name not in bpy.data.objects:
- bpy.ops.mesh.primitive_cube_add(size=2)
- obj = bpy.context.object
- obj.name = object_name
- else:
- obj = bpy.data.objects[object_name]
- # Set the rotation of the object along x, y, and z axes
- obj.rotation_euler[0] = math.radians(x_angle)
- obj.rotation_euler[1] = math.radians(y_angle)
- obj.rotation_euler[2] = math.radians(z_angle)
- # Set up rendering settings
- scene = bpy.context.scene
- scene.render.image_settings.file_format = 'PNG'
- # Set output path and filename for each render image
- scene.render.filepath = f"{output_path}render_{i}.png"
- # Render the image
- bpy.ops.render.render(write_still=True)
- print("Renderings complete!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement