armory/blender/arm/props_renderer.py

387 lines
14 KiB
Python
Raw Normal View History

2016-12-09 02:08:01 +01:00
import bpy
from bpy.types import Menu, Panel, UIList
from bpy.props import *
2017-03-15 12:30:14 +01:00
import arm.nodes_renderpath as nodes_renderpath
import arm.make_renderer as make_renderer
import arm.assets as assets
2016-12-09 02:08:01 +01:00
2017-01-03 12:20:46 +01:00
updating_preset = False
def set_preset(self, context, preset):
global updating_preset
2016-12-09 02:08:01 +01:00
cam = bpy.context.camera
if cam == None:
return
2017-05-17 21:41:13 +02:00
wrd = bpy.data.worlds['Arm']
2017-01-03 12:20:46 +01:00
updating_preset = True
2017-05-17 21:41:13 +02:00
if preset == 'Low':
2016-12-09 02:08:01 +01:00
cam.rp_renderer = 'Forward'
2017-04-26 14:21:22 +02:00
cam.rp_materials = 'Full'
2016-12-09 02:08:01 +01:00
cam.rp_shadowmap = '1024'
cam.rp_meshes = True
2017-01-13 00:16:00 +01:00
cam.rp_translucency_state = 'Off'
2017-02-15 13:15:24 +01:00
cam.rp_overlays_state = 'Off'
cam.rp_decals_state = 'Off'
2017-05-24 11:04:15 +02:00
cam.rp_sss_state = 'Off'
2016-12-09 02:08:01 +01:00
cam.rp_hdr = False
cam.rp_worldnodes = False
2017-05-20 19:07:15 +02:00
cam.rp_clearbackground = True
2016-12-09 02:08:01 +01:00
cam.rp_stereo = False
cam.rp_greasepencil = False
2017-04-26 14:21:22 +02:00
cam.rp_voxelgi = False
2016-12-09 02:08:01 +01:00
cam.rp_render_to_texture = False
cam.rp_supersampling = '1'
cam.rp_antialiasing = 'None'
cam.rp_compositornodes = False
cam.rp_volumetriclight = False
cam.rp_ssao = False
cam.rp_ssr = False
cam.rp_bloom = False
2016-12-21 00:51:04 +01:00
cam.rp_motionblur = 'None'
2016-12-09 02:08:01 +01:00
elif preset == 'Forward':
cam.rp_renderer = 'Forward'
2017-04-26 14:21:22 +02:00
cam.rp_materials = 'Full'
2016-12-09 02:08:01 +01:00
cam.rp_shadowmap = '2048'
cam.rp_meshes = True
2017-01-13 00:16:00 +01:00
cam.rp_translucency_state = 'Auto'
2017-02-15 13:15:24 +01:00
cam.rp_overlays_state = 'Auto'
cam.rp_decals_state = 'Auto'
2017-05-24 11:04:15 +02:00
cam.rp_sss_state = 'Off'
2016-12-09 02:08:01 +01:00
cam.rp_hdr = True
cam.rp_worldnodes = True
2017-05-20 19:07:15 +02:00
cam.rp_clearbackground = False
2016-12-09 02:08:01 +01:00
cam.rp_stereo = False
cam.rp_greasepencil = False
2017-04-26 14:21:22 +02:00
cam.rp_voxelgi = False
2016-12-09 02:08:01 +01:00
cam.rp_render_to_texture = True
cam.rp_supersampling = '1'
2017-05-17 21:41:13 +02:00
cam.rp_antialiasing = 'SMAA'
2016-12-09 02:08:01 +01:00
cam.rp_compositornodes = True
cam.rp_volumetriclight = False
2017-05-17 21:41:13 +02:00
cam.rp_ssao = True
cam.rp_ssr = True
2016-12-09 02:08:01 +01:00
cam.rp_bloom = False
2016-12-21 00:51:04 +01:00
cam.rp_motionblur = 'None'
2017-05-17 21:41:13 +02:00
elif preset == 'Deferred':
cam.rp_renderer = 'Deferred'
cam.rp_shadowmap = '2048'
2016-12-09 02:08:01 +01:00
cam.rp_meshes = True
2017-01-13 00:16:00 +01:00
cam.rp_translucency_state = 'Auto'
2017-02-15 13:15:24 +01:00
cam.rp_overlays_state = 'Auto'
cam.rp_decals_state = 'Auto'
2017-05-24 11:04:15 +02:00
cam.rp_sss_state = 'Off'
2016-12-09 02:08:01 +01:00
cam.rp_hdr = True
cam.rp_worldnodes = True
2017-05-20 19:07:15 +02:00
cam.rp_clearbackground = False
2016-12-09 02:08:01 +01:00
cam.rp_stereo = False
cam.rp_greasepencil = False
2017-04-26 14:21:22 +02:00
cam.rp_voxelgi = False
2016-12-09 02:08:01 +01:00
cam.rp_render_to_texture = True
cam.rp_supersampling = '1'
2017-05-17 21:41:13 +02:00
cam.rp_antialiasing = 'FXAA'
2016-12-09 02:08:01 +01:00
cam.rp_compositornodes = True
cam.rp_volumetriclight = False
cam.rp_ssao = True
2017-05-17 21:41:13 +02:00
cam.rp_ssr = False
2016-12-09 02:08:01 +01:00
cam.rp_bloom = False
2016-12-21 00:51:04 +01:00
cam.rp_motionblur = 'None'
2017-05-17 21:41:13 +02:00
elif preset == 'Max':
2016-12-09 02:08:01 +01:00
cam.rp_renderer = 'Deferred'
2017-05-17 21:41:13 +02:00
cam.rp_shadowmap = '4096'
2016-12-09 02:08:01 +01:00
cam.rp_meshes = True
2017-01-13 00:16:00 +01:00
cam.rp_translucency_state = 'Auto'
2017-02-15 13:15:24 +01:00
cam.rp_overlays_state = 'Auto'
cam.rp_decals_state = 'Auto'
2017-05-24 11:04:15 +02:00
cam.rp_sss_state = 'Off'
2016-12-09 02:08:01 +01:00
cam.rp_hdr = True
cam.rp_worldnodes = True
2017-05-20 19:07:15 +02:00
cam.rp_clearbackground = False
2016-12-09 02:08:01 +01:00
cam.rp_stereo = False
cam.rp_greasepencil = False
2017-04-26 14:21:22 +02:00
cam.rp_voxelgi = False
2016-12-09 02:08:01 +01:00
cam.rp_render_to_texture = True
cam.rp_supersampling = '1'
2017-05-17 21:41:13 +02:00
cam.rp_antialiasing = 'TAA'
2016-12-09 02:08:01 +01:00
cam.rp_compositornodes = True
cam.rp_volumetriclight = False
cam.rp_ssao = True
2017-05-17 21:41:13 +02:00
cam.rp_ssr = True
2016-12-09 02:08:01 +01:00
cam.rp_bloom = False
2016-12-21 00:51:04 +01:00
cam.rp_motionblur = 'None'
2017-05-17 21:41:13 +02:00
elif preset == 'Render Capture':
2016-12-09 02:08:01 +01:00
cam.rp_renderer = 'Deferred'
2017-05-17 21:41:13 +02:00
cam.rp_shadowmap = '8192'
2016-12-09 02:08:01 +01:00
cam.rp_meshes = True
2017-01-13 00:16:00 +01:00
cam.rp_translucency_state = 'Auto'
2017-02-15 13:15:24 +01:00
cam.rp_overlays_state = 'Auto'
cam.rp_decals_state = 'Auto'
2017-05-24 11:04:15 +02:00
cam.rp_sss_state = 'Off'
2016-12-09 02:08:01 +01:00
cam.rp_hdr = True
cam.rp_worldnodes = True
2017-05-20 19:07:15 +02:00
cam.rp_clearbackground = False
2016-12-09 02:08:01 +01:00
cam.rp_stereo = False
cam.rp_greasepencil = False
2017-05-17 21:41:13 +02:00
cam.rp_voxelgi = True
2017-05-22 15:55:34 +02:00
cam.rp_voxelgi_resolution[0] = 256
cam.rp_voxelgi_resolution[1] = 256
cam.rp_voxelgi_resolution[2] = 256
2016-12-09 02:08:01 +01:00
cam.rp_render_to_texture = True
2017-05-17 21:41:13 +02:00
cam.rp_supersampling = '2'
cam.rp_antialiasing = 'TAA'
2016-12-09 02:08:01 +01:00
cam.rp_compositornodes = True
cam.rp_volumetriclight = False
cam.rp_ssao = True
cam.rp_ssr = True
cam.rp_bloom = True
2016-12-21 00:51:04 +01:00
cam.rp_motionblur = 'None'
2017-05-17 21:41:13 +02:00
wrd.lighting_model = 'Cycles'
wrd.generate_pcss_state = 'On'
elif preset == 'Deferred Plus':
cam.rp_renderer = 'Deferred Plus'
2016-12-09 02:08:01 +01:00
cam.rp_shadowmap = '4096'
cam.rp_meshes = True
2017-01-13 00:16:00 +01:00
cam.rp_translucency_state = 'Auto'
2017-02-15 13:15:24 +01:00
cam.rp_overlays_state = 'Auto'
cam.rp_decals_state = 'Auto'
2017-05-24 11:04:15 +02:00
cam.rp_sss_state = 'Off'
2016-12-09 02:08:01 +01:00
cam.rp_hdr = True
cam.rp_worldnodes = True
2017-05-20 19:07:15 +02:00
cam.rp_clearbackground = False
2016-12-09 02:08:01 +01:00
cam.rp_stereo = False
cam.rp_greasepencil = False
2017-04-26 14:21:22 +02:00
cam.rp_voxelgi = False
2016-12-09 02:08:01 +01:00
cam.rp_render_to_texture = True
cam.rp_supersampling = '1'
cam.rp_antialiasing = 'TAA'
cam.rp_compositornodes = True
cam.rp_volumetriclight = False
cam.rp_ssao = True
cam.rp_ssr = True
2017-05-17 21:41:13 +02:00
cam.rp_bloom = False
2016-12-21 00:51:04 +01:00
cam.rp_motionblur = 'None'
2016-12-09 02:08:01 +01:00
elif preset == 'VR Low':
cam.rp_renderer = 'Forward'
2017-04-26 14:21:22 +02:00
cam.rp_materials = 'Restricted'
2016-12-09 02:08:01 +01:00
cam.rp_shadowmap = '1024'
cam.rp_meshes = True
2017-01-13 00:16:00 +01:00
cam.rp_translucency_state = 'Off'
2017-02-15 13:15:24 +01:00
cam.rp_overlays_state = 'Off'
cam.rp_decals_state = 'Off'
2017-05-24 11:04:15 +02:00
cam.rp_sss_state = 'Off'
2016-12-09 02:08:01 +01:00
cam.rp_hdr = False
2017-04-26 14:21:22 +02:00
cam.rp_worldnodes = False
2017-05-20 19:07:15 +02:00
cam.rp_clearbackground = True
2016-12-09 02:08:01 +01:00
cam.rp_stereo = True
cam.rp_greasepencil = False
2017-04-26 14:21:22 +02:00
cam.rp_voxelgi = False
2016-12-09 02:08:01 +01:00
cam.rp_render_to_texture = False
cam.rp_supersampling = '1'
cam.rp_antialiasing = 'None'
cam.rp_compositornodes = False
cam.rp_volumetriclight = False
cam.rp_ssao = False
cam.rp_ssr = False
cam.rp_bloom = False
2016-12-21 00:51:04 +01:00
cam.rp_motionblur = 'None'
2016-12-09 02:08:01 +01:00
elif preset == 'Grease Pencil':
2017-05-18 23:40:10 +02:00
cam.rp_renderer = 'Forward'
cam.rp_materials = 'Restricted'
2016-12-09 02:08:01 +01:00
cam.rp_shadowmap = 'None'
cam.rp_meshes = False
2017-01-13 00:16:00 +01:00
cam.rp_translucency_state = 'Off'
2017-02-15 13:15:24 +01:00
cam.rp_overlays_state = 'Off'
cam.rp_decals_state = 'Off'
2017-05-24 11:04:15 +02:00
cam.rp_sss_state = 'Off'
2016-12-09 02:08:01 +01:00
cam.rp_hdr = False
cam.rp_worldnodes = False
2017-05-20 19:07:15 +02:00
cam.rp_clearbackground = True
2016-12-09 02:08:01 +01:00
cam.rp_stereo = False
cam.rp_greasepencil = True
cam.rp_render_to_texture = False
cam.rp_supersampling = '1'
cam.rp_antialiasing = 'None'
cam.rp_compositornodes = False
cam.rp_volumetriclight = False
cam.rp_ssao = False
cam.rp_ssr = False
cam.rp_bloom = False
2016-12-21 00:51:04 +01:00
cam.rp_motionblur = 'None'
2016-12-09 02:08:01 +01:00
2017-01-03 12:20:46 +01:00
updating_preset = False
set_renderpath(self, context)
def set_renderpath(self, context):
global updating_preset
if updating_preset == True:
return
if bpy.context.camera == None:
return
2017-05-14 22:23:47 +02:00
# assets.invalidate_compiled_data(self, context)
assets.invalidate_shader_cache(self, context)
2017-01-03 12:20:46 +01:00
make_renderer.make_renderer(bpy.context.camera)
bpy.context.camera.renderpath_path = 'armory_default'
2016-12-09 02:08:01 +01:00
# Menu in camera data region
class GenRPDataPropsPanel(bpy.types.Panel):
bl_label = "Armory Render Path"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "data"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
obj = bpy.context.object
if obj == None:
return
dat = obj.data
2017-05-06 00:22:15 +02:00
wrd = bpy.data.worlds['Arm']
2016-12-09 02:08:01 +01:00
if obj.type == 'CAMERA':
layout.prop(dat, "rp_preset")
layout.separator()
layout.prop(dat, "rp_renderer")
2017-04-26 14:21:22 +02:00
layout.prop(dat, "rp_materials")
2017-05-06 00:22:15 +02:00
layout.prop(wrd, 'lighting_model')
2016-12-09 02:08:01 +01:00
layout.prop(dat, "rp_shadowmap")
layout.prop(dat, "rp_meshes")
2017-01-13 00:16:00 +01:00
layout.prop(dat, "rp_translucency_state")
2017-02-15 13:15:24 +01:00
layout.prop(dat, "rp_overlays_state")
layout.prop(dat, "rp_decals_state")
2017-05-23 15:01:56 +02:00
layout.prop(dat, "rp_sss_state")
if dat.rp_sss_state == 'On':
layout.prop(wrd, 'sss_width')
2016-12-09 02:08:01 +01:00
layout.prop(dat, "rp_hdr")
layout.prop(dat, "rp_worldnodes")
2017-05-20 19:07:15 +02:00
if not dat.rp_worldnodes:
layout.prop(dat, "rp_clearbackground")
2016-12-09 02:08:01 +01:00
layout.prop(dat, "rp_stereo")
2017-05-18 23:40:10 +02:00
layout.prop(dat, "rp_greasepencil")
2017-02-22 15:50:19 +01:00
layout.prop(dat, 'rp_voxelgi')
if dat.rp_voxelgi:
layout.prop(dat, 'rp_voxelgi_resolution')
2017-05-06 00:22:15 +02:00
layout.prop(wrd, 'generate_voxelgi_dimensions')
2017-05-17 23:02:36 +02:00
row = layout.row()
row.prop(wrd, 'voxelgi_diff')
row.prop(wrd, 'voxelgi_spec')
row = layout.row()
row.prop(wrd, 'voxelgi_occ')
row.prop(wrd, 'voxelgi_env')
2017-05-20 19:07:15 +02:00
row = layout.row()
row.prop(wrd, 'voxelgi_step')
row.prop(wrd, 'voxelgi_range')
row = layout.row()
row.prop(wrd, 'voxelgi_revoxelize')
row.prop(wrd, 'voxelgi_multibounce')
row.prop(dat, 'rp_voxelgi_hdr')
2016-12-09 02:08:01 +01:00
layout.separator()
layout.prop(dat, "rp_render_to_texture")
if dat.rp_render_to_texture:
layout.prop(dat, "rp_supersampling")
layout.prop(dat, "rp_antialiasing")
layout.prop(dat, "rp_compositornodes")
layout.prop(dat, "rp_volumetriclight")
layout.prop(dat, "rp_ssao")
layout.prop(dat, "rp_ssr")
layout.prop(dat, "rp_bloom")
layout.prop(dat, "rp_motionblur")
class PropsRPDataPropsPanel(bpy.types.Panel):
bl_label = "Armory Render Props"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "data"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
obj = bpy.context.object
if obj == None:
return
wrd = bpy.data.worlds['Arm']
if obj.type == 'CAMERA':
2017-01-23 00:48:59 +01:00
layout.prop(wrd, 'generate_pcss_state')
if wrd.generate_pcss_state == 'On' or wrd.generate_pcss_state == 'Auto':
layout.prop(wrd, 'generate_pcss_rings')
layout.prop(wrd, 'generate_ssrs')
2016-12-09 02:08:01 +01:00
layout.prop(wrd, 'arm_samples_per_pixel')
2017-04-11 23:21:42 +02:00
row = layout.row()
row.prop(wrd, 'generate_gpu_skin')
2016-12-09 02:08:01 +01:00
if wrd.generate_gpu_skin:
2017-04-11 23:21:42 +02:00
row.prop(wrd, 'generate_gpu_skin_max_bones_auto')
if not wrd.generate_gpu_skin_max_bones_auto:
layout.prop(wrd, 'generate_gpu_skin_max_bones')
2017-05-19 10:25:59 +02:00
layout.prop(wrd, 'texture_filtering_state')
2016-12-09 02:08:01 +01:00
layout.prop(wrd, 'tessellation_enabled')
layout.prop(wrd, 'force_no_culling')
2017-05-13 00:05:50 +02:00
layout.prop(wrd, 'generate_two_sided_area_lamp')
2016-12-09 02:08:01 +01:00
layout.prop(wrd, 'arm_camera_props_advanced')
if wrd.arm_camera_props_advanced:
layout.prop(wrd, 'generate_clouds')
if wrd.generate_clouds:
layout.prop(wrd, 'generate_clouds_density')
layout.prop(wrd, 'generate_clouds_size')
layout.prop(wrd, 'generate_clouds_lower')
layout.prop(wrd, 'generate_clouds_upper')
layout.prop(wrd, 'generate_clouds_wind')
layout.prop(wrd, 'generate_clouds_secondary')
layout.prop(wrd, 'generate_clouds_precipitation')
layout.prop(wrd, 'generate_clouds_eccentricity')
2017-01-17 14:48:47 +01:00
layout.label('SSAO')
2016-12-09 02:08:01 +01:00
# layout.prop(wrd, 'generate_ssao')
# if wrd.generate_ssao:
layout.prop(wrd, 'generate_ssao_size')
layout.prop(wrd, 'generate_ssao_strength')
2017-03-14 20:43:54 +01:00
layout.prop(wrd, 'generate_ssao_half_res')
2016-12-09 02:08:01 +01:00
layout.label('Bloom')
# layout.prop(wrd, 'generate_bloom')
# if wrd.generate_bloom:
layout.prop(wrd, 'generate_bloom_threshold')
layout.prop(wrd, 'generate_bloom_strength')
layout.prop(wrd, 'generate_bloom_radius')
layout.label('Motion Blur')
# layout.prop(wrd, 'generate_motion_blur')
# if wrd.generate_motion_blur:
layout.prop(wrd, 'generate_motion_blur_intensity')
2017-01-17 14:48:47 +01:00
layout.label('SSR')
2016-12-09 02:08:01 +01:00
# layout.prop(wrd, 'generate_ssr')
# if wrd.generate_ssr:
layout.prop(wrd, 'generate_ssr_ray_step')
layout.prop(wrd, 'generate_ssr_min_ray_step')
layout.prop(wrd, 'generate_ssr_search_dist')
layout.prop(wrd, 'generate_ssr_falloff_exp')
layout.prop(wrd, 'generate_ssr_jitter')
2017-03-14 20:43:54 +01:00
layout.prop(wrd, 'generate_ssr_half_res')
2016-12-09 02:08:01 +01:00
2017-01-17 14:48:47 +01:00
layout.label('SSRS')
layout.prop(wrd, 'generate_ssrs_ray_step')
2016-12-09 02:08:01 +01:00
layout.label('Volumetric Light')
# layout.prop(wrd, 'generate_volumetric_light')
# if wrd.generate_volumetric_light:
layout.prop(wrd, 'generate_volumetric_light_air_turbidity')
layout.prop(wrd, 'generate_volumetric_light_air_color')
def register():
2017-03-15 12:30:14 +01:00
bpy.utils.register_class(GenRPDataPropsPanel)
bpy.utils.register_class(PropsRPDataPropsPanel)
2016-12-09 02:08:01 +01:00
def unregister():
2017-03-15 12:30:14 +01:00
bpy.utils.unregister_class(GenRPDataPropsPanel)
bpy.utils.unregister_class(PropsRPDataPropsPanel)