From f73aeb91e14d04b7b62bf8b371a76ee11bccd182 Mon Sep 17 00:00:00 2001 From: Simon Wendsche Date: Wed, 27 Jun 2018 00:07:56 +0200 Subject: [PATCH] first work on exposing DLS cache properties --- export/config.py | 19 +++++++++++++++++++ properties/config.py | 28 ++++++++++++++++++++++++++++ ui/config.py | 13 +++++++++++++ 3 files changed, 60 insertions(+) diff --git a/export/config.py b/export/config.py index e449e7cd..9e4a7f28 100644 --- a/export/config.py +++ b/export/config.py @@ -148,6 +148,9 @@ def convert(exporter, scene, context=None, engine=None): "scene.epsilon.max": config.max_epsilon, }) + if config.light_strategy == "DLS_CACHE": + _convert_dlscache_settings(definitions, config) + if config.path.use_clamping: definitions["path.clamping.variance.maxvalue"] = config.path.clamping @@ -265,3 +268,19 @@ def _convert_metropolis_settings(definitions, config): definitions["sampler.metropolis.largesteprate"] = config.metropolis_largesteprate / 100 definitions["sampler.metropolis.maxconsecutivereject"] = config.metropolis_maxconsecutivereject definitions["sampler.metropolis.imagemutationrate"] = config.metropolis_imagemutationrate / 100 + + +def _convert_dlscache_settings(definitions, config): + dls_cache = config.dls_cache + definitions.update({ + "lightstrategy.entry.radius": dls_cache.entry_radius, + "lightstrategy.entry.normalangle": dls_cache.entry_normalangle, + "lightstrategy.entry.maxpasses": dls_cache.entry_maxpasses, + "lightstrategy.entry.convergencethreshold": dls_cache.entry_convergencethreshold, + "lightstrategy.entry.volumes.enable": dls_cache.entry_volumes_enable, + + "lightstrategy.lightthreshold": dls_cache.lightthreshold, + "lightstrategy.targetcachehitratio": dls_cache.targetcachehitratio, + "lightstrategy.maxdepth": dls_cache.maxdepth, + "lightstrategy.maxsamplescount": dls_cache.maxsamplescount, + }) diff --git a/properties/config.py b/properties/config.py index f908cb04..79f7d9da 100644 --- a/properties/config.py +++ b/properties/config.py @@ -139,6 +139,31 @@ class LuxCoreConfigTile(PropertyGroup): description=THRESH_WARMUP_DESC) +class LuxCoreConfigDLSCache(PropertyGroup): + # TODO remove this comment + # Property("lightstrategy.entry.radius")(.15f) << + # + Property("lightstrategy.entry.normalangle")(10.f) << + # + Property("lightstrategy.entry.maxpasses")(1024) << + # + Property("lightstrategy.entry.convergencethreshold")(.01f) << + # ("lightstrategy.entry.volumes.enable")(false) + # + Property("lightstrategy.lightthreshold")(.01f) << + # + Property("lightstrategy.targetcachehitratio")(99.5f) << + # + Property("lightstrategy.maxdepth")(4) << + # + Property("lightstrategy.maxsamplescount")(10000000); + + # TODO names, min/max, percentage-type, descriptions + entry_radius = FloatProperty(default=0.15) + entry_normalangle = FloatProperty(default=10) + entry_maxpasses = IntProperty(default=1024) + entry_convergencethreshold = FloatProperty(default=0.01) + entry_volumes_enable = BoolProperty(default=False) + + lightthreshold = FloatProperty(default=0.01) + targetcachehitratio = FloatProperty(default=99.5) + maxdepth = IntProperty(default=4) + maxsamplescount = IntProperty(default=10000000) + + class LuxCoreConfig(PropertyGroup): """ Main config storage class. @@ -223,6 +248,9 @@ class LuxCoreConfig(PropertyGroup): light_strategy = EnumProperty(name="Light Strategy", items=light_strategy_items, default="LOG_POWER", description="Decides how the lights in the scene are sampled") + # Special properties of the direct light sampling cache + dls_cache = PointerProperty(type=LuxCoreConfigDLSCache) + # FILESAVER options use_filesaver = BoolProperty(name="Only write LuxCore scene", default=False) filesaver_format_items = [ diff --git a/ui/config.py b/ui/config.py index 69999552..e9244880 100644 --- a/ui/config.py +++ b/ui/config.py @@ -113,6 +113,19 @@ def draw(self, context): # Light strategy layout.prop(config, "light_strategy") + if config.light_strategy == "DLS_CACHE": + dls_cache = config.dls_cache + box = layout.box() + box.prop(dls_cache, "entry_radius") + box.prop(dls_cache, "entry_normalangle") + box.prop(dls_cache, "entry_maxpasses") + box.prop(dls_cache, "entry_convergencethreshold") + box.prop(dls_cache, "entry_volumes_enable") + box.prop(dls_cache, "lightthreshold") + box.prop(dls_cache, "targetcachehitratio") + box.prop(dls_cache, "maxdepth") + box.prop(dls_cache, "maxsamplescount") + def draw_clamp_settings(self, layout, config): split = layout.split() split.prop(config.path, "use_clamping")