armory/blender/arm/make_renderpath.py

401 lines
15 KiB
Python
Raw Permalink Normal View History

2016-09-23 00:34:42 +02:00
import bpy
2021-08-04 22:49:38 +02:00
import arm.api
2017-03-15 12:30:14 +01:00
import arm.assets as assets
2017-12-05 22:00:27 +01:00
import arm.log as log
2017-12-05 23:06:24 +01:00
import arm.make_state as state
2021-08-04 22:49:38 +02:00
import arm.utils
if arm.is_reload(__name__):
2021-08-04 22:49:38 +02:00
arm.api = arm.reload_module(arm.api)
assets = arm.reload_module(assets)
log = arm.reload_module(log)
state = arm.reload_module(state)
arm.utils = arm.reload_module(arm.utils)
else:
arm.enable_reload(__name__)
2018-01-03 15:09:55 +01:00
2018-03-07 23:37:47 +01:00
callback = None
2017-12-20 22:56:22 +01:00
def add_world_defs():
wrd = bpy.data.worlds['Arm']
rpdat = arm.utils.get_rp()
# Screen-space ray-traced shadows
if rpdat.arm_ssrs:
wrd.world_defs += '_SSRS'
2019-05-21 21:53:57 +02:00
if rpdat.arm_micro_shadowing:
wrd.world_defs += '_MicroShadowing'
if rpdat.arm_two_sided_area_light:
wrd.world_defs += '_TwoSidedAreaLight'
2017-12-20 22:56:22 +01:00
# Store contexts
if rpdat.rp_hdr == False:
wrd.world_defs += '_LDR'
if wrd.arm_light_ies_texture != '':
wrd.world_defs += '_LightIES'
2017-12-20 22:56:22 +01:00
assets.add_embedded_data('iestexture.png')
if wrd.arm_light_clouds_texture != '':
wrd.world_defs += '_LightClouds'
2017-12-20 22:56:22 +01:00
assets.add_embedded_data('cloudstexture.png')
if rpdat.rp_renderer == 'Deferred':
assets.add_khafile_def('arm_deferred')
2018-04-25 22:38:52 +02:00
wrd.world_defs += '_Deferred'
2018-01-28 16:16:21 +01:00
# Shadows
2018-12-10 00:02:40 +01:00
if rpdat.rp_shadows:
wrd.world_defs += '_ShadowMap'
2018-06-28 16:26:15 +02:00
if rpdat.rp_shadowmap_cascades != '1':
wrd.world_defs += '_CSM'
assets.add_khafile_def('arm_csm')
Add support for shadow map atlasing With this it is now possible to enable atlasing of shadow maps, which solves the existing limitation of 4 lights in a scene. This is done by grouping the rendering of shadow maps, that currently are drawn into their own images for each light, into one or several big textures. This was done because the openGL and webGL version Armory targets do not support dynamic indexing of shadowMapSamplers, meaning that the index that access an array of shadow maps has to be know by the compiler before hand so it can be unrolled into if/else branching. By instead simply using a big shadow map texture and moving the dynamic part to other types of array that are allowed dynamic indexing like vec4 and mat4, this limitation was solved. The premise was simple enough for the shader part, but for the Haxe part, managing and solving where lights shadow maps should go in a shadow map can be tricky. So to keep track and solve this, ShadowMapAtlas and ShadowMapTile were created. These classes have the minimally required logic to solve the basic features needed for this problem: defining some kind of abstraction to prevent overlapping of shadowmaps, finding available space, assigning such space efficiently, locking and freeing this space, etc. This functionality it is used by drawShadowMapAtlas(), which is a modified version of drawShadowMap(). Shadow map atlases are represented with perfectly balanced 4-ary trees, where each tree of the previous definition represents a "tile" or slice that results from dividing a square that represents the image into 4 slices or sub-images. The root of this "tile" it's a reference to the tile-slice, and this tile is divided in 4 slices, and the process is repeated depth-times. If depth is 1, slices are kept at just the initial 4 tiles of max size, which is the default size of the shadow map. #arm_shadowmap_atlas_lod allows controlling if code to support more depth levels is added or not when compiling. the tiles that populate atlases tile trees are simply a data structure that contains a reference to the light they are linked to, inner subtiles in case LOD is enabled, coordinates to where this tile starts in the atlas that go from 0 to Shadow Map Size, and a reference to a linked tile for LOD. This simple definition allows tiles having a theoretically small memory footprint, but in turn this simplicity might make some functionality that might be responsibility of tiles (for example knowing if they are overlapping) a responsibility of the ones that utilizes tiles instead. This decision may complicate maintenance so it is to be revised in future iterations of this feature.
2021-01-27 02:01:06 +01:00
if rpdat.rp_shadowmap_atlas:
assets.add_khafile_def('arm_shadowmap_atlas')
wrd.world_defs += '_ShadowMapAtlas'
if rpdat.rp_shadowmap_atlas_single_map:
assets.add_khafile_def('arm_shadowmap_atlas_single_map')
wrd.world_defs += '_SingleAtlas'
assets.add_khafile_def('rp_shadowmap_atlas_max_size_point={0}'.format(int(rpdat.rp_shadowmap_atlas_max_size_point)))
assets.add_khafile_def('rp_shadowmap_atlas_max_size_spot={0}'.format(int(rpdat.rp_shadowmap_atlas_max_size_spot)))
assets.add_khafile_def('rp_shadowmap_atlas_max_size_sun={0}'.format(int(rpdat.rp_shadowmap_atlas_max_size_sun)))
assets.add_khafile_def('rp_shadowmap_atlas_max_size={0}'.format(int(rpdat.rp_shadowmap_atlas_max_size)))
assets.add_khafile_def('rp_max_lights_cluster={0}'.format(int(rpdat.rp_max_lights_cluster)))
assets.add_khafile_def('rp_max_lights={0}'.format(int(rpdat.rp_max_lights)))
if rpdat.rp_shadowmap_atlas_lod:
assets.add_khafile_def('arm_shadowmap_atlas_lod')
assets.add_khafile_def('rp_shadowmap_atlas_lod_subdivisions={0}'.format(int(rpdat.rp_shadowmap_atlas_lod_subdivisions)))
2017-12-20 22:56:22 +01:00
# SS
if rpdat.rp_ssgi == 'RTGI' or rpdat.rp_ssgi == 'RTAO':
if rpdat.rp_ssgi == 'RTGI':
wrd.world_defs += '_RTGI'
2018-03-15 16:02:56 +01:00
if rpdat.arm_ssgi_rays == '9':
2017-12-20 22:56:22 +01:00
wrd.world_defs += '_SSGICone9'
if rpdat.rp_autoexposure:
wrd.world_defs += '_AutoExposure'
has_voxels = arm.utils.voxel_support()
if rpdat.rp_voxelao and has_voxels and rpdat.arm_material_model == 'Full':
2018-03-15 16:02:56 +01:00
wrd.world_defs += '_VoxelCones' + rpdat.arm_voxelgi_cones
2017-12-20 22:56:22 +01:00
if rpdat.arm_voxelgi_revoxelize:
assets.add_khafile_def('arm_voxelgi_revox')
if rpdat.arm_voxelgi_camera:
wrd.world_defs += '_VoxelGICam'
if rpdat.arm_voxelgi_temporal:
assets.add_khafile_def('arm_voxelgi_temporal')
wrd.world_defs += '_VoxelGITemporal'
wrd.world_defs += '_VoxelAOvar' # Write a shader variant
if rpdat.arm_voxelgi_shadows:
wrd.world_defs += '_VoxelShadow'
if rpdat.arm_voxelgi_occ == 0.0:
wrd.world_defs += '_VoxelAONoTrace'
2017-12-20 22:56:22 +01:00
2019-02-13 16:29:53 +01:00
if arm.utils.get_legacy_shaders() or 'ios' in state.target:
2018-06-28 16:26:15 +02:00
wrd.world_defs += '_Legacy'
2019-02-10 20:37:38 +01:00
assets.add_khafile_def('arm_legacy')
2018-06-28 16:26:15 +02:00
# Light defines
2018-12-10 17:25:29 +01:00
point_lights = 0
for bo in bpy.data.objects: # TODO: temp
2018-12-19 13:33:17 +01:00
if bo.type == 'LIGHT':
2018-12-10 17:25:29 +01:00
light = bo.data
if light.type == 'AREA' and '_LTC' not in wrd.world_defs:
2019-01-27 19:12:00 +01:00
point_lights += 1
2018-12-10 17:25:29 +01:00
wrd.world_defs += '_LTC'
assets.add_khafile_def('arm_ltc')
if light.type == 'SUN' and '_Sun' not in wrd.world_defs:
wrd.world_defs += '_Sun'
if light.type == 'POINT' or light.type == 'SPOT':
point_lights += 1
if light.type == 'SPOT' and '_Spot' not in wrd.world_defs:
wrd.world_defs += '_Spot'
assets.add_khafile_def('arm_spot')
Add support for shadow map atlasing With this it is now possible to enable atlasing of shadow maps, which solves the existing limitation of 4 lights in a scene. This is done by grouping the rendering of shadow maps, that currently are drawn into their own images for each light, into one or several big textures. This was done because the openGL and webGL version Armory targets do not support dynamic indexing of shadowMapSamplers, meaning that the index that access an array of shadow maps has to be know by the compiler before hand so it can be unrolled into if/else branching. By instead simply using a big shadow map texture and moving the dynamic part to other types of array that are allowed dynamic indexing like vec4 and mat4, this limitation was solved. The premise was simple enough for the shader part, but for the Haxe part, managing and solving where lights shadow maps should go in a shadow map can be tricky. So to keep track and solve this, ShadowMapAtlas and ShadowMapTile were created. These classes have the minimally required logic to solve the basic features needed for this problem: defining some kind of abstraction to prevent overlapping of shadowmaps, finding available space, assigning such space efficiently, locking and freeing this space, etc. This functionality it is used by drawShadowMapAtlas(), which is a modified version of drawShadowMap(). Shadow map atlases are represented with perfectly balanced 4-ary trees, where each tree of the previous definition represents a "tile" or slice that results from dividing a square that represents the image into 4 slices or sub-images. The root of this "tile" it's a reference to the tile-slice, and this tile is divided in 4 slices, and the process is repeated depth-times. If depth is 1, slices are kept at just the initial 4 tiles of max size, which is the default size of the shadow map. #arm_shadowmap_atlas_lod allows controlling if code to support more depth levels is added or not when compiling. the tiles that populate atlases tile trees are simply a data structure that contains a reference to the light they are linked to, inner subtiles in case LOD is enabled, coordinates to where this tile starts in the atlas that go from 0 to Shadow Map Size, and a reference to a linked tile for LOD. This simple definition allows tiles having a theoretically small memory footprint, but in turn this simplicity might make some functionality that might be responsibility of tiles (for example knowing if they are overlapping) a responsibility of the ones that utilizes tiles instead. This decision may complicate maintenance so it is to be revised in future iterations of this feature.
2021-01-27 02:01:06 +01:00
if not rpdat.rp_shadowmap_atlas:
if point_lights == 1:
wrd.world_defs += '_SinglePoint'
elif point_lights > 1:
wrd.world_defs += '_Clusters'
assets.add_khafile_def('arm_clusters')
else:
wrd.world_defs += '_SMSizeUniform'
2018-12-10 17:25:29 +01:00
wrd.world_defs += '_Clusters'
assets.add_khafile_def('arm_clusters')
2017-12-20 22:56:22 +01:00
2019-05-26 21:03:25 +02:00
if '_Rad' in wrd.world_defs and '_Brdf' not in wrd.world_defs:
2018-01-29 19:06:57 +01:00
wrd.world_defs += '_Brdf'
2017-11-22 21:17:36 +01:00
def build():
2018-01-04 16:22:16 +01:00
rpdat = arm.utils.get_rp()
if rpdat.rp_driver != 'Armory' and arm.api.drivers[rpdat.rp_driver]['make_rpath'] != None:
arm.api.drivers[rpdat.rp_driver]['make_rpath']()
2018-01-03 15:09:55 +01:00
return
2018-08-16 23:07:50 +02:00
assets_path = arm.utils.get_sdk_path() + '/armory/Assets/'
2017-11-22 21:17:36 +01:00
wrd = bpy.data.worlds['Arm']
2017-08-19 12:10:06 +02:00
wrd.compo_defs = ''
2017-12-20 22:56:22 +01:00
add_world_defs()
2017-10-01 19:42:47 +02:00
mobile_mat = rpdat.arm_material_model == 'Mobile' or rpdat.arm_material_model == 'Solid'
if not mobile_mat:
2017-06-18 19:20:20 +02:00
# Always include
assets.add(assets_path + 'brdf.png')
assets.add_embedded_data('brdf.png')
2016-09-23 00:34:42 +02:00
2017-11-22 21:17:36 +01:00
if rpdat.rp_hdr:
assets.add_khafile_def('rp_hdr')
assets.add_khafile_def('rp_renderer={0}'.format(rpdat.rp_renderer))
if rpdat.rp_depthprepass:
assets.add_khafile_def('rp_depthprepass')
2018-12-10 00:02:40 +01:00
if rpdat.rp_shadows:
2017-11-22 21:17:36 +01:00
assets.add_khafile_def('rp_shadowmap')
2019-01-21 17:59:25 +01:00
assets.add_khafile_def('rp_shadowmap_cascade={0}'.format(arm.utils.get_cascade_size(rpdat)))
2018-12-10 00:02:40 +01:00
assets.add_khafile_def('rp_shadowmap_cube={0}'.format(rpdat.rp_shadowmap_cube))
2017-11-22 21:17:36 +01:00
2020-05-05 09:54:24 +02:00
if arm.utils.get_gapi() == 'metal':
2020-05-11 09:03:13 +02:00
assets.add_shader_pass('clear_color_depth_pass')
assets.add_shader_pass('clear_color_pass')
assets.add_shader_pass('clear_depth_pass')
2020-05-04 23:08:47 +02:00
2017-11-22 21:17:36 +01:00
assets.add_khafile_def('rp_background={0}'.format(rpdat.rp_background))
if rpdat.rp_background == 'World':
if '_EnvClouds' in wrd.world_defs:
2019-04-25 22:39:08 +02:00
assets.add(assets_path + 'clouds_base.raw')
assets.add_embedded_data('clouds_base.raw')
assets.add(assets_path + 'clouds_detail.raw')
assets.add_embedded_data('clouds_detail.raw')
assets.add(assets_path + 'clouds_map.png')
assets.add_embedded_data('clouds_map.png')
2017-11-22 21:17:36 +01:00
if rpdat.rp_renderer == 'Deferred':
assets.add_shader_pass('copy_pass')
2018-06-28 16:26:15 +02:00
2017-11-22 21:17:36 +01:00
if rpdat.rp_render_to_texture:
assets.add_khafile_def('rp_render_to_texture')
2018-12-15 19:03:11 +01:00
if rpdat.rp_renderer == 'Forward' and not rpdat.rp_compositornodes:
assets.add_shader_pass('copy_pass')
2017-11-22 21:17:36 +01:00
if rpdat.rp_compositornodes:
assets.add_khafile_def('rp_compositornodes')
compo_depth = False
2018-03-15 16:02:56 +01:00
if rpdat.arm_tonemap != 'Off':
wrd.compo_defs = '_CTone' + rpdat.arm_tonemap
2017-12-15 12:52:58 +01:00
if rpdat.rp_antialiasing == 'FXAA':
2017-11-22 21:17:36 +01:00
wrd.compo_defs += '_CFXAA'
2018-03-15 16:02:56 +01:00
if rpdat.arm_letterbox:
2017-11-22 21:17:36 +01:00
wrd.compo_defs += '_CLetterbox'
2018-03-15 16:02:56 +01:00
if rpdat.arm_grain:
2017-11-22 21:17:36 +01:00
wrd.compo_defs += '_CGrain'
2018-03-15 16:02:56 +01:00
if rpdat.arm_sharpen:
2018-03-02 17:02:27 +01:00
wrd.compo_defs += '_CSharpen'
2019-05-01 10:52:42 +02:00
if bpy.data.scenes[0].view_settings.exposure != 0.0:
2017-11-22 21:17:36 +01:00
wrd.compo_defs += '_CExposure'
2018-03-15 16:02:56 +01:00
if rpdat.arm_fog:
2017-11-22 21:17:36 +01:00
wrd.compo_defs += '_CFog'
compo_depth = True
2019-05-20 14:32:48 +02:00
2019-08-24 11:50:27 +02:00
focus_distance = 0.0
if len(bpy.data.cameras) > 0 and bpy.data.cameras[0].dof.use_dof:
focus_distance = bpy.data.cameras[0].dof.focus_distance
if focus_distance > 0.0:
2017-11-22 21:17:36 +01:00
wrd.compo_defs += '_CDOF'
compo_depth = True
2018-03-15 16:02:56 +01:00
if rpdat.arm_lens_texture != '':
2017-11-22 21:17:36 +01:00
wrd.compo_defs += '_CLensTex'
assets.add_embedded_data('lenstexture.jpg')
2019-08-08 18:56:56 +02:00
if rpdat.arm_lens_texture_masking:
wrd.compo_defs += '_CLensTexMasking'
2018-03-15 16:02:56 +01:00
if rpdat.arm_fisheye:
2017-11-22 21:17:36 +01:00
wrd.compo_defs += '_CFishEye'
2018-03-15 16:02:56 +01:00
if rpdat.arm_vignette:
2017-11-22 21:17:36 +01:00
wrd.compo_defs += '_CVignette'
2018-03-15 16:02:56 +01:00
if rpdat.arm_lensflare:
2017-11-22 21:17:36 +01:00
wrd.compo_defs += '_CGlare'
2019-09-30 11:50:13 +02:00
compo_depth = True
2018-03-15 16:02:56 +01:00
if rpdat.arm_lut_texture != '':
2017-12-07 17:43:59 +01:00
wrd.compo_defs += '_CLUT'
2017-12-07 18:04:17 +01:00
assets.add_embedded_data('luttexture.jpg')
2018-03-02 17:02:27 +01:00
if '_CDOF' in wrd.compo_defs or '_CFXAA' in wrd.compo_defs or '_CSharpen' in wrd.compo_defs:
wrd.compo_defs += '_CTexStep'
2018-09-01 18:35:32 +02:00
if '_CDOF' in wrd.compo_defs or '_CFog' in wrd.compo_defs or '_CGlare' in wrd.compo_defs:
wrd.compo_defs += '_CCameraProj'
2019-09-30 11:50:13 +02:00
if compo_depth:
wrd.compo_defs += '_CDepth'
assets.add_khafile_def('rp_compositordepth')
if rpdat.rp_pp:
wrd.compo_defs += '_CPostprocess'
2017-12-13 14:21:42 +01:00
assets.add_shader_pass('compositor_pass')
2017-11-22 21:17:36 +01:00
assets.add_khafile_def('rp_antialiasing={0}'.format(rpdat.rp_antialiasing))
if rpdat.rp_antialiasing == 'SMAA' or rpdat.rp_antialiasing == 'TAA':
2017-12-13 14:21:42 +01:00
assets.add_shader_pass('smaa_edge_detect')
assets.add_shader_pass('smaa_blend_weight')
assets.add_shader_pass('smaa_neighborhood_blend')
2017-11-22 21:17:36 +01:00
assets.add(assets_path + 'smaa_area.png')
assets.add(assets_path + 'smaa_search.png')
assets.add_embedded_data('smaa_area.png')
assets.add_embedded_data('smaa_search.png')
wrd.world_defs += '_SMAA'
if rpdat.rp_antialiasing == 'TAA':
2017-12-13 14:21:42 +01:00
assets.add_shader_pass('taa_pass')
assets.add_shader_pass('copy_pass')
2017-11-22 21:17:36 +01:00
if rpdat.rp_antialiasing == 'TAA' or rpdat.rp_motionblur == 'Object':
2016-10-12 18:26:56 +02:00
assets.add_khafile_def('arm_veloc')
2017-08-21 15:36:21 +02:00
wrd.world_defs += '_Veloc'
2017-11-22 21:17:36 +01:00
if rpdat.rp_antialiasing == 'TAA':
assets.add_khafile_def('arm_taa')
2016-09-23 00:34:42 +02:00
2020-05-04 23:08:47 +02:00
assets.add_khafile_def('rp_supersampling={0}'.format(rpdat.rp_supersampling))
2017-11-22 21:17:36 +01:00
if rpdat.rp_supersampling == '4':
2017-12-13 14:21:42 +01:00
assets.add_shader_pass('supersample_resolve')
2017-08-13 22:50:08 +02:00
2018-12-15 19:03:11 +01:00
assets.add_khafile_def('rp_ssgi={0}'.format(rpdat.rp_ssgi))
if rpdat.rp_ssgi != 'Off':
wrd.world_defs += '_SSAO'
if rpdat.rp_ssgi == 'SSAO':
assets.add_shader_pass('ssao_pass')
assets.add_shader_pass('blur_edge_pass')
else:
assets.add_shader_pass('ssgi_pass')
assets.add_shader_pass('blur_edge_pass')
if rpdat.arm_ssgi_half_res:
assets.add_khafile_def('rp_ssgi_half')
if rpdat.rp_bloom:
assets.add_khafile_def('rp_bloom')
assets.add_shader_pass('bloom_pass')
assets.add_shader_pass('blur_gaus_pass')
if rpdat.rp_ssr:
assets.add_khafile_def('rp_ssr')
assets.add_shader_pass('ssr_pass')
assets.add_shader_pass('blur_adaptive_pass')
if rpdat.arm_ssr_half_res:
assets.add_khafile_def('rp_ssr_half')
2017-11-22 21:17:36 +01:00
if rpdat.rp_overlays:
assets.add_khafile_def('rp_overlays')
2017-05-23 15:01:56 +02:00
2017-11-22 21:17:36 +01:00
if rpdat.rp_translucency:
assets.add_khafile_def('rp_translucency')
2017-12-13 14:21:42 +01:00
assets.add_shader_pass('translucent_resolve')
2016-09-23 00:34:42 +02:00
2017-11-22 21:17:36 +01:00
if rpdat.rp_stereo:
assets.add_khafile_def('rp_stereo')
2016-10-12 18:26:56 +02:00
assets.add_khafile_def('arm_vr')
2017-08-21 15:36:21 +02:00
wrd.world_defs += '_VR'
2016-09-23 00:34:42 +02:00
2018-01-28 17:28:13 +01:00
has_voxels = arm.utils.voxel_support()
if rpdat.rp_voxelao and has_voxels and rpdat.arm_material_model == 'Full':
assets.add_khafile_def('rp_voxelao')
assets.add_khafile_def('rp_voxelgi_resolution={0}'.format(rpdat.rp_voxelgi_resolution))
assets.add_khafile_def('rp_voxelgi_resolution_z={0}'.format(rpdat.rp_voxelgi_resolution_z))
2017-11-22 21:17:36 +01:00
2018-04-20 00:56:54 +02:00
if rpdat.arm_rp_resolution == 'Custom':
assets.add_khafile_def('rp_resolution_filter={0}'.format(rpdat.arm_rp_resolution_filter))
2017-11-22 21:17:36 +01:00
if rpdat.rp_renderer == 'Deferred':
2018-12-10 09:46:46 +01:00
if rpdat.arm_material_model == 'Full':
assets.add_shader_pass('deferred_light')
else: # mobile, solid
assets.add_shader_pass('deferred_light_' + rpdat.arm_material_model.lower())
assets.add_khafile_def('rp_material_' + rpdat.arm_material_model.lower())
2020-05-04 23:08:47 +02:00
if len(bpy.data.lightprobes) > 0:
2018-10-04 15:35:33 +02:00
wrd.world_defs += '_Probes'
2018-10-01 22:01:03 +02:00
assets.add_khafile_def('rp_probes')
assets.add_shader_pass('probe_planar')
2018-10-04 15:35:33 +02:00
assets.add_shader_pass('probe_cubemap')
assets.add_shader_pass('copy_pass')
2018-10-01 22:01:03 +02:00
2019-01-28 11:28:21 +01:00
if rpdat.rp_volumetriclight:
assets.add_khafile_def('rp_volumetriclight')
assets.add_shader_pass('volumetric_light')
assets.add_shader_pass('blur_bilat_pass')
assets.add_shader_pass('blur_bilat_blend_pass')
assets.add(assets_path + 'blue_noise64.png')
assets.add_embedded_data('blue_noise64.png')
2016-10-09 16:06:18 +02:00
2017-11-22 21:17:36 +01:00
if rpdat.rp_decals:
assets.add_khafile_def('rp_decals')
2016-10-09 16:06:18 +02:00
2019-04-29 16:21:44 +02:00
if rpdat.rp_water:
assets.add_khafile_def('rp_water')
2017-12-17 13:36:56 +01:00
assets.add_shader_pass('water_pass')
2019-04-29 16:21:44 +02:00
assets.add_shader_pass('copy_pass')
assets.add(assets_path + 'water_base.png')
assets.add_embedded_data('water_base.png')
assets.add(assets_path + 'water_detail.png')
assets.add_embedded_data('water_detail.png')
assets.add(assets_path + 'water_foam.png')
assets.add_embedded_data('water_foam.png')
2016-10-09 16:06:18 +02:00
2018-08-16 14:46:18 +02:00
if rpdat.rp_blending:
2017-11-22 21:17:36 +01:00
assets.add_khafile_def('rp_blending')
2016-09-23 00:34:42 +02:00
2017-11-22 21:17:36 +01:00
if rpdat.rp_sss:
assets.add_khafile_def('rp_sss')
wrd.world_defs += '_SSS'
2017-12-13 14:21:42 +01:00
assets.add_shader_pass('sss_pass')
2017-11-22 21:17:36 +01:00
2018-12-10 17:25:29 +01:00
if (rpdat.rp_ssr and rpdat.arm_ssr_half_res) or (rpdat.rp_ssgi != 'Off' and rpdat.arm_ssgi_half_res):
2018-12-06 15:23:08 +01:00
assets.add_shader_pass('downsample_depth')
2017-11-22 21:17:36 +01:00
if rpdat.rp_motionblur != 'Off':
assets.add_khafile_def('rp_motionblur={0}'.format(rpdat.rp_motionblur))
2017-12-13 14:21:42 +01:00
assets.add_shader_pass('copy_pass')
2017-11-22 21:17:36 +01:00
if rpdat.rp_motionblur == 'Camera':
2017-12-13 14:21:42 +01:00
assets.add_shader_pass('motion_blur_pass')
2017-11-22 21:17:36 +01:00
else:
2017-12-13 14:21:42 +01:00
assets.add_shader_pass('motion_blur_veloc_pass')
2016-11-07 16:11:35 +01:00
2017-11-22 21:17:36 +01:00
if rpdat.rp_compositornodes and rpdat.rp_autoexposure:
assets.add_khafile_def('rp_autoexposure')
2019-04-22 14:11:17 +02:00
assets.add_shader_pass('histogram_pass')
2016-10-09 16:06:18 +02:00
2017-11-22 21:17:36 +01:00
if rpdat.rp_dynres:
assets.add_khafile_def('rp_dynres')
if rpdat.rp_pp:
assets.add_khafile_def('rp_pp')
2019-08-08 20:02:42 +02:00
if rpdat.rp_chromatic_aberration:
assets.add_shader_pass('copy_pass')
assets.add_khafile_def('rp_chromatic_aberration')
assets.add_shader_pass('chromatic_aberration_pass')
ignoreIrr = False
for obj in bpy.data.objects:
if obj.type == "MESH":
for slot in obj.material_slots:
mat = slot.material
if mat: #Check if not NoneType
if mat.arm_ignore_irradiance:
ignoreIrr = True
if ignoreIrr:
wrd.world_defs += '_IgnoreIrr'
gbuffer2 = '_Veloc' in wrd.world_defs or '_IgnoreIrr' in wrd.world_defs
2018-05-19 19:29:14 +02:00
if gbuffer2:
assets.add_khafile_def('rp_gbuffer2')
wrd.world_defs += '_gbuffer2'
2018-03-07 23:37:47 +01:00
if callback != None:
callback()