Speed vs Quality

Hi,

This is a start of a plugin for making it easier/faster to set base settings for Cycles renderer based on speed or quality.

Things I haven’t solved:

  • Should be a percentage slider.
  • Should only be visible when Cycles is selected.

Things that could be done:

  • Update settings of objects/lamps.
  • Update more renderer settings.
  • Fine tune settings.
  • Store original settings so that they can be restored.
  • Probably a lot more.

Anyway, I will not develop it further but I thought I put it up here if someone wants to use it as is or take it a step further.

import bpy
from bpy.props import IntProperty

def update_render_settings(self, context):
    quality = bpy.context.scene.quality
    scene = bpy.context.scene
    cycles = scene.cycles
    cycles.samples = 70 + quality * 10
    cycles.max_bounces = quality / 8
    cycles.min_bounces = quality / 16
    cycles.transparent_max_bounces = quality / 7.5
    cycles.transparent_min_bounces = quality / 7.5
    if quality < 51:
        cycles.no_caustics = True
        cycles.use_transparent_shadows = False
        scene.render.use_motion_blur = False
    else:
        cycles.no_caustics = False
        cycles.use_transparent_shadows = True
        scene.render.use_motion_blur = True
    
bpy.types.Scene.quality = bpy.props.IntProperty(name='Quality', update=update_render_settings, min=1, max=100, default=50)

class panel(bpy.types.Panel):
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = 'render'
    bl_label = 'Speed vs Quality'
    COMPAT_ENGINES = {'CYCLES'}
    
    def draw(self, context):
        scene = bpy.context.scene
        layout = self.layout
        row = layout.row()
        col = row.column()
        print(scene.quality)
        col.prop(scene, 'quality', text='Quality')
        
def register():
    bpy.utils.register_class( panel )


def unregister():
    bpy.utils.register_class( panel )


if __name__ == '__main__':
    register()