Skip to content

Commit

Permalink
add support for more filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Theverat committed Jan 27, 2018
1 parent 82bc34f commit 6b8d8f6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
6 changes: 5 additions & 1 deletion export/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,14 @@ def convert(scene, context=None):
"sampler.type": sampler,
"film.width": width,
"film.height": height,
"film.filter.type": "BLACKMANHARRIS" if config.use_filter else "NONE",
"film.filter.type": config.filter,
"film.filter.width": config.filter_width,
})

# Filter
if config.filter == "GAUSSIAN":
definitions["film.filter.gaussian.alpha"] = config.gaussian_alpha

use_filesaver = context is None and config.use_filesaver

# Transparent film settings
Expand Down
13 changes: 11 additions & 2 deletions properties/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,18 @@ class LuxCoreConfig(PropertyGroup):
bidir_path_maxdepth = IntProperty(name="Eye Depth", default=10, min=1, soft_max=16)

# Pixel filter
use_filter = BoolProperty(name="Use Pixel Filter", default=True, description=FILTER_DESC)
filter_width = FloatProperty(name="Width", default=1.5, min=0.5, soft_max=3,
filters = [
("BLACKMANHARRIS", "Blackman-Harris", "Default, usually the best option", 0),
("MITCHELL_SS", "Mitchell", "Sharp, but can produce black ringing artifacts around bright pixels", 1),
("GAUSSIAN", "Gaussian", "Blurry", 2),
("NONE", "None", "Disable pixel filtering. Fastest setting when rendering on GPU", 3)
]
filter = EnumProperty(name="Filter", items=filters, default="BLACKMANHARRIS",
description=FILTER_DESC)
filter_width = FloatProperty(name="Filter Width", default=1.5, min=0.5, soft_max=3,
description=FILTER_WIDTH_DESC, subtype="PIXEL")
gaussian_alpha = FloatProperty(name="Gaussian Filter Alpha", default=2, min=0.1, max=10,
description="Gaussian rate of falloff. Lower values give blurrier images.")

# FILESAVER options
use_filesaver = BoolProperty(name="Only write LuxCore scene", default=False)
Expand Down
21 changes: 13 additions & 8 deletions ui/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,15 @@ def draw(self, context):

if config.use_tiles:
layout.label("Tiled path uses special sampler", icon="INFO")
layout.prop(config.tile, "size")
layout.prop(config.tile, "path_sampling_aa_size")
row = layout.row(align=True)
row.prop(config.tile, "size")
row.prop(config.tile, "path_sampling_aa_size")

layout.prop(config.tile, "multipass_enable")
if config.tile.multipass_enable:
layout.prop(config.tile, "multipass_convtest_threshold")
layout.prop(config.tile, "multipass_convtest_threshold_reduction")
col = layout.column(align=True)
col.prop(config.tile, "multipass_convtest_threshold")
col.prop(config.tile, "multipass_convtest_threshold_reduction")
# TODO do we need to expose this? In LuxBlend we didn't
# layout.prop(config.tile, "multipass_convtest_warmup")
else:
Expand All @@ -94,10 +97,12 @@ def draw(self, context):

# Filter settings
row = layout.row()
row.prop(config, "use_filter")
split = row.split()
split.active = config.use_filter
split.prop(config, "filter_width")
row.prop(config, "filter")
sub = row.row()
sub.active = config.filter != "NONE"
sub.prop(config, "filter_width")
if config.filter == "GAUSSIAN":
layout.prop(config, "gaussian_alpha")

# Seed settings
row = layout.row(align=True)
Expand Down

0 comments on commit 6b8d8f6

Please sign in to comment.