blender python bpy 常见操作命令

目录

使用节点:

添加节点:

添加mp4 或图片

开启运动模糊:


使用节点:


bpy.context.scene.use_nodes = True


添加节点:


bpy.ops.node.add_node(type="CompositorNodeImage", use_transform=True)


添加mp4 或图片


bpy.ops.node.add_file(filepath="F:\\test_222.mp4")


bpy.data.scenes["Scene"].node_tree.nodes["图像.001"].frame_duration = 10000


bpy.data.scenes["Scene"].node_tree.nodes["图像.001"].use_cyclic = True


bpy.data.scenes["Scene"].node_tree.nodes["缩放"].space = 'RENDER_SIZE'


 
渲染属性:胶片->透明
bpy.context.scene.render.film_transparent = True


添加输出节点;

bpy.ops.node.add_node(type="CompositorNodeOutputFile", use_transform=True)


合成使用alpha 通道 

bpy.data.scenes["Scene"].node_tree.nodes["合成"].use_alpha = False
 

开启运动模糊:

bpy.context.scene.render.use_motion_blur = True
bpy.context.scene.render.motion_blur_shutter = 0.5
bpy.context.scene.render.motion_blur_samples = 16

在这个示例中,我们首先设置了渲染参数,包括渲染引擎、分辨率、渲染百分比、运动模糊开关、快门时间和样本数。然后,我们使用 bpy.ops.render.render() 方法来渲染场景。

请注意,在这个示例中,我们设置了 use_motion_blur 为 True 来启用运动模糊,并将 motion_blur_shutter 设置为 0.5,表示快门时间为 0.5 帧。我们还将 motion_blur_samples 设置为 16,以增加模糊效果的质量。你可以根据需要自定义这些参数。

请注意,如果你想渲染动画序列并添加运动模糊效果,则需要将 animation 参数设置为 True。

# 渲染动画序列
bpy.ops.render.render(animation=True, write_still=True)

猜你喜欢

转载自blog.csdn.net/jacke121/article/details/129907403