forked from LeenkxTeam/LNXSDK
Update
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
from typing import Optional
|
||||
|
||||
import math
|
||||
import bpy
|
||||
from bpy.props import *
|
||||
|
||||
@ -44,6 +45,18 @@ def update_point_atlas_size_options(scene: bpy.types.Scene, context: bpy.types.C
|
||||
return atlas_sizes_from_min(int(rpdat.rp_shadowmap_cube) * 2)
|
||||
|
||||
|
||||
def auto_atlas_size(max_lights: int, tile_size: int, tiles_per_light: int) -> int:
|
||||
"""Automatically calculate the minimum atlas texture size needed to fit max_lights of a given type."""
|
||||
tiles_needed = max_lights * tiles_per_light
|
||||
grid_size = math.ceil(math.sqrt(tiles_needed))
|
||||
needed_pixels = grid_size * tile_size
|
||||
for size_entry in atlas_sizes:
|
||||
size = int(size_entry[0])
|
||||
if size >= needed_pixels:
|
||||
return size
|
||||
return int(atlas_sizes[-1][0])
|
||||
|
||||
|
||||
def update_preset(self, context):
|
||||
rpdat = self.lnx_rplist[-1]
|
||||
|
||||
@ -332,6 +345,7 @@ class LnxRPListItem(bpy.types.PropertyGroup):
|
||||
('64', '64', '64'),],
|
||||
name="Max Lights Shadows", description="Max number of rendered shadow maps that can be visible in the screen. Always equal or lower than Max Lights", default='16')
|
||||
rp_shadowmap_atlas: BoolProperty(name="Shadow Map Atlasing", description="Group shadow maps of lights of the same type in the same texture", default=False, update=update_renderpath)
|
||||
rp_shadowmap_atlas_auto: BoolProperty(name="Automatic Atlasing", description="Automatically compute atlas sizes based on max lights and shadow map sizes", default=True, update=update_renderpath)
|
||||
rp_shadowmap_atlas_single_map: BoolProperty(name="Shadow Map Atlas single map", description="Use a single texture for all different light types.", default=False, update=update_renderpath)
|
||||
rp_shadowmap_atlas_lod: BoolProperty(name="Shadow Map Atlas LOD (Experimental)", description="When enabled, the size of the shadow map will be determined on runtime based on the distance of the light to the camera", default=False, update=update_renderpath)
|
||||
rp_shadowmap_transparent: BoolProperty(name="Transparency", description="Enable shadows for transparent objects", default=False, update=update_renderpath)
|
||||
|
||||
Reference in New Issue
Block a user