forked from LeenkxTeam/LNXSDK
Update
This commit is contained in:
@ -1745,92 +1745,113 @@ class LNX_PT_RenderPathShadowsPanel(bpy.types.Panel):
|
||||
layout.prop(rpdat, 'rp_shadowmap_atlas')
|
||||
colatlas = layout.column()
|
||||
colatlas.enabled = rpdat.rp_shadowmap_atlas
|
||||
|
||||
colatlas.prop(rpdat, 'rp_shadowmap_atlas_auto')
|
||||
|
||||
colatlas.prop(rpdat, 'rp_max_lights')
|
||||
colatlas.prop(rpdat, 'rp_max_lights_cluster')
|
||||
|
||||
if not rpdat.rp_shadowmap_atlas_auto:
|
||||
colatlas.prop(rpdat, 'rp_max_lights_cluster')
|
||||
|
||||
if rpdat.rp_shadowmap_atlas_auto:
|
||||
# Automatic mode: compute sizes from max lights
|
||||
max_lights = int(rpdat.rp_max_lights)
|
||||
cube_size = int(rpdat.rp_shadowmap_cube)
|
||||
cascade_size = int(rpdat.rp_shadowmap_cascade)
|
||||
cascades = int(rpdat.rp_shadowmap_cascades)
|
||||
|
||||
auto_point = lnx.props_renderpath.auto_atlas_size(max_lights, cube_size, 6)
|
||||
auto_spot = lnx.props_renderpath.auto_atlas_size(max_lights, cascade_size, 1)
|
||||
auto_sun = lnx.props_renderpath.auto_atlas_size(max_lights, cascade_size, cascades)
|
||||
|
||||
if auto_point > 2048 or auto_spot > 2048 or auto_sun > 2048:
|
||||
size_warning = True
|
||||
|
||||
colatlas.prop(rpdat, 'rp_shadowmap_atlas_lod')
|
||||
|
||||
colatlas_lod = colatlas.column()
|
||||
colatlas_lod.enabled = rpdat.rp_shadowmap_atlas_lod
|
||||
colatlas_lod.prop(rpdat, 'rp_shadowmap_atlas_lod_subdivisions')
|
||||
if rpdat.rp_shadowmap_atlas_lod:
|
||||
colatlas_lod = colatlas.column()
|
||||
colatlas_lod.prop(rpdat, 'rp_shadowmap_atlas_lod_subdivisions')
|
||||
|
||||
colatlas_lod_info = colatlas_lod.row()
|
||||
colatlas_lod_info.alignment = 'RIGHT'
|
||||
subdivs_list = self.compute_subdivs(int(rpdat.rp_shadowmap_cascade), int(rpdat.rp_shadowmap_atlas_lod_subdivisions))
|
||||
subdiv_text = "Subdivisions for spot lights: " + ', '.join(map(str, subdivs_list))
|
||||
colatlas_lod_info.label(text=subdiv_text, icon="IMAGE_ZDEPTH")
|
||||
|
||||
if not rpdat.rp_shadowmap_atlas_single_map:
|
||||
colatlas_lod_info = colatlas_lod.row()
|
||||
colatlas_lod_info.alignment = 'RIGHT'
|
||||
subdivs_list = self.compute_subdivs(int(rpdat.rp_shadowmap_cube), int(rpdat.rp_shadowmap_atlas_lod_subdivisions))
|
||||
subdiv_text = "Subdivisions for point lights: " + ', '.join(map(str, subdivs_list))
|
||||
subdivs_list = self.compute_subdivs(int(rpdat.rp_shadowmap_cascade), int(rpdat.rp_shadowmap_atlas_lod_subdivisions))
|
||||
subdiv_text = "Subdivisions for spot lights: " + ', '.join(map(str, subdivs_list))
|
||||
colatlas_lod_info.label(text=subdiv_text, icon="IMAGE_ZDEPTH")
|
||||
|
||||
if not rpdat.rp_shadowmap_atlas_single_map:
|
||||
colatlas_lod_info = colatlas_lod.row()
|
||||
colatlas_lod_info.alignment = 'RIGHT'
|
||||
subdivs_list = self.compute_subdivs(int(rpdat.rp_shadowmap_cube), int(rpdat.rp_shadowmap_atlas_lod_subdivisions))
|
||||
subdiv_text = "Subdivisions for point lights: " + ', '.join(map(str, subdivs_list))
|
||||
colatlas_lod_info.label(text=subdiv_text, icon="IMAGE_ZDEPTH")
|
||||
|
||||
size_warning = int(rpdat.rp_shadowmap_cascade) > 2048 or int(rpdat.rp_shadowmap_cube) > 2048
|
||||
|
||||
colatlas.prop(rpdat, 'rp_shadowmap_atlas_single_map')
|
||||
# show size for single texture
|
||||
if rpdat.rp_shadowmap_atlas_single_map:
|
||||
colatlas_single = colatlas.column()
|
||||
colatlas_single.prop(rpdat, 'rp_shadowmap_atlas_max_size')
|
||||
if rpdat.rp_shadowmap_atlas_max_size != '':
|
||||
atlas_size = int(rpdat.rp_shadowmap_atlas_max_size)
|
||||
shadowmap_size = int(rpdat.rp_shadowmap_cascade)
|
||||
if not rpdat.rp_shadowmap_atlas_auto:
|
||||
# show size for single texture
|
||||
if rpdat.rp_shadowmap_atlas_single_map:
|
||||
colatlas_single = colatlas.column()
|
||||
colatlas_single.prop(rpdat, 'rp_shadowmap_atlas_max_size')
|
||||
if rpdat.rp_shadowmap_atlas_max_size != '':
|
||||
atlas_size = int(rpdat.rp_shadowmap_atlas_max_size)
|
||||
shadowmap_size = int(rpdat.rp_shadowmap_cascade)
|
||||
|
||||
if shadowmap_size > 2048:
|
||||
size_warning = True
|
||||
if shadowmap_size > 2048:
|
||||
size_warning = True
|
||||
|
||||
point_lights = self.lights_number_atlas(rpdat, atlas_size, shadowmap_size, 'point')
|
||||
spot_lights = self.lights_number_atlas(rpdat, atlas_size, shadowmap_size, 'spot')
|
||||
dir_lights = self.lights_number_atlas(rpdat, atlas_size, shadowmap_size, 'sun')
|
||||
point_lights = self.lights_number_atlas(rpdat, atlas_size, shadowmap_size, 'point')
|
||||
spot_lights = self.lights_number_atlas(rpdat, atlas_size, shadowmap_size, 'spot')
|
||||
dir_lights = self.lights_number_atlas(rpdat, atlas_size, shadowmap_size, 'sun')
|
||||
|
||||
col = colatlas_single.row()
|
||||
col.alignment = 'RIGHT'
|
||||
col.label(text=f'Enough space for { point_lights } point lights or { spot_lights } spot lights or { dir_lights } directional lights.')
|
||||
else:
|
||||
# show size for all types
|
||||
colatlas_mixed = colatlas.column()
|
||||
colatlas_mixed.prop(rpdat, 'rp_shadowmap_atlas_max_size_spot')
|
||||
col = colatlas_single.row()
|
||||
col.alignment = 'RIGHT'
|
||||
col.label(text=f'Enough space for { point_lights } point lights or { spot_lights } spot lights or { dir_lights } directional lights.')
|
||||
else:
|
||||
# show size for all types
|
||||
colatlas_mixed = colatlas.column()
|
||||
colatlas_mixed.prop(rpdat, 'rp_shadowmap_atlas_max_size_spot')
|
||||
|
||||
if rpdat.rp_shadowmap_atlas_max_size_spot != '':
|
||||
atlas_size = int(rpdat.rp_shadowmap_atlas_max_size_spot)
|
||||
shadowmap_size = int(rpdat.rp_shadowmap_cascade)
|
||||
spot_lights = self.lights_number_atlas(rpdat, atlas_size, shadowmap_size, 'spot')
|
||||
if rpdat.rp_shadowmap_atlas_max_size_spot != '':
|
||||
atlas_size = int(rpdat.rp_shadowmap_atlas_max_size_spot)
|
||||
shadowmap_size = int(rpdat.rp_shadowmap_cascade)
|
||||
spot_lights = self.lights_number_atlas(rpdat, atlas_size, shadowmap_size, 'spot')
|
||||
|
||||
if shadowmap_size > 2048:
|
||||
size_warning = True
|
||||
if shadowmap_size > 2048:
|
||||
size_warning = True
|
||||
|
||||
col = colatlas_mixed.row()
|
||||
col.alignment = 'RIGHT'
|
||||
col.label(text=f'Enough space for {spot_lights} spot lights.')
|
||||
col = colatlas_mixed.row()
|
||||
col.alignment = 'RIGHT'
|
||||
col.label(text=f'Enough space for {spot_lights} spot lights.')
|
||||
|
||||
colatlas_mixed.prop(rpdat, 'rp_shadowmap_atlas_max_size_point')
|
||||
colatlas_mixed.prop(rpdat, 'rp_shadowmap_atlas_max_size_point')
|
||||
|
||||
if rpdat.rp_shadowmap_atlas_max_size_point != '':
|
||||
atlas_size = int(rpdat.rp_shadowmap_atlas_max_size_point)
|
||||
shadowmap_size = int(rpdat.rp_shadowmap_cube)
|
||||
point_lights = self.lights_number_atlas(rpdat, atlas_size, shadowmap_size, 'point')
|
||||
if rpdat.rp_shadowmap_atlas_max_size_point != '':
|
||||
atlas_size = int(rpdat.rp_shadowmap_atlas_max_size_point)
|
||||
shadowmap_size = int(rpdat.rp_shadowmap_cube)
|
||||
point_lights = self.lights_number_atlas(rpdat, atlas_size, shadowmap_size, 'point')
|
||||
|
||||
if shadowmap_size > 2048:
|
||||
size_warning = True
|
||||
if shadowmap_size > 2048:
|
||||
size_warning = True
|
||||
|
||||
col = colatlas_mixed.row()
|
||||
col.alignment = 'RIGHT'
|
||||
col.label(text=f'Enough space for {point_lights} point lights.')
|
||||
col = colatlas_mixed.row()
|
||||
col.alignment = 'RIGHT'
|
||||
col.label(text=f'Enough space for {point_lights} point lights.')
|
||||
|
||||
colatlas_mixed.prop(rpdat, 'rp_shadowmap_atlas_max_size_sun')
|
||||
colatlas_mixed.prop(rpdat, 'rp_shadowmap_atlas_max_size_sun')
|
||||
|
||||
if rpdat.rp_shadowmap_atlas_max_size_sun != '':
|
||||
atlas_size = int(rpdat.rp_shadowmap_atlas_max_size_sun)
|
||||
shadowmap_size = int(rpdat.rp_shadowmap_cascade)
|
||||
dir_lights = self.lights_number_atlas(rpdat, atlas_size, shadowmap_size, 'sun')
|
||||
if rpdat.rp_shadowmap_atlas_max_size_sun != '':
|
||||
atlas_size = int(rpdat.rp_shadowmap_atlas_max_size_sun)
|
||||
shadowmap_size = int(rpdat.rp_shadowmap_cascade)
|
||||
dir_lights = self.lights_number_atlas(rpdat, atlas_size, shadowmap_size, 'sun')
|
||||
|
||||
if shadowmap_size > 2048:
|
||||
size_warning = True
|
||||
if shadowmap_size > 2048:
|
||||
size_warning = True
|
||||
|
||||
col = colatlas_mixed.row()
|
||||
col.alignment = 'RIGHT'
|
||||
col.label(text=f'Enough space for {dir_lights} directional lights.')
|
||||
col = colatlas_mixed.row()
|
||||
col.alignment = 'RIGHT'
|
||||
col.label(text=f'Enough space for {dir_lights} directional lights.')
|
||||
|
||||
# show warning when user picks a size higher than 2048 (arbitrary number).
|
||||
if size_warning:
|
||||
|
||||
Reference in New Issue
Block a user