Skip to content

Commit

Permalink
first work on exposing DLS cache properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Theverat committed Jun 26, 2018
1 parent ac6ed67 commit f73aeb9
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
19 changes: 19 additions & 0 deletions export/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
})
28 changes: 28 additions & 0 deletions properties/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 = [
Expand Down
13 changes: 13 additions & 0 deletions ui/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit f73aeb9

Please sign in to comment.