def enable_global_shadeless():
    """
    Disable shade on old version
    """
    from blender_scripts.utils import is_old_api
    for item in bpy.data.materials:
        if is_old_api():
            item.use_shadeless = True
Exemplo n.º 2
0
def setup_and_use_cycles(option: CyclesRendererOption, camera_name='Camera'):
    # The general setup code
    setup_renderer_resolution(option, camera_name=camera_name)
    bpy.context.scene.render.engine = 'CYCLES'
    if is_old_api():
        bpy.context.scene.render.use_raytrace = True
        bpy.context.scene.render.use_shadows = True

    # The number of samples and denosing
    bpy.data.scenes['Scene'].cycles.samples = option.num_samples
    if is_old_api():
        bpy.context.scene.render.layers[0].cycles.use_denoising = True
    else:
        bpy.context.view_layer.cycles.use_denoising = True

    # Performance parameters
    bpy.data.scenes['Scene'].render.tile_x = option.renderer_tile_x
    bpy.data.scenes['Scene'].render.tile_y = option.renderer_tile_y
    bpy.data.scenes['Scene'].cycles.device = option.renderer_device
Exemplo n.º 3
0
def setup_and_use_eevee(option: EeveeRendererOption, camera_name='Camera'):
    # The general setup code
    assert not is_old_api()
    setup_renderer_resolution(option, camera_name=camera_name)
    bpy.context.scene.render.engine = 'BLENDER_EEVEE'

    # The setup code for ambient occulusion
    bpy.context.scene.eevee.use_gtao = option.use_ambient_occlusion

    # the setup code for shadow
    bpy.context.scene.eevee.use_soft_shadows = option.use_soft_shadow
    bpy.context.scene.eevee.shadow_cube_size = option.shadow_cube_size
    bpy.context.scene.eevee.taa_render_samples = option.taa_render_samples
    bpy.context.scene.eevee.use_ssr = option.use_ssr
    bpy.context.scene.eevee.ssr_max_roughness = option.ssr_max_roughness