From 12351b701aea0b3ad6f8f19fcb70c874c819dc52 Mon Sep 17 00:00:00 2001 From: Simon Wendsche Date: Thu, 8 Feb 2018 13:08:18 +0100 Subject: [PATCH] make it possible to disable the visibility map --- export/light.py | 5 +++++ properties/light.py | 9 +++++++++ properties/world.py | 8 ++++++-- ui/light.py | 4 ++++ ui/world.py | 2 ++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/export/light.py b/export/light.py index 8b48fc27..e4f38ea0 100644 --- a/export/light.py +++ b/export/light.py @@ -154,6 +154,7 @@ def convert_lamp(blender_obj, scene, context, luxcore_scene): raise Exception("Unkown light type", lamp.type, 'in lamp "%s"' % blender_obj.name) _indirect_light_visibility(definitions, lamp) + _visibilitymap(definitions, lamp) props = utils.create_props(prefix, definitions) return props, exported_light @@ -205,6 +206,7 @@ def convert_world(world, scene): definitions["type"] = "constantinfinite" _indirect_light_visibility(definitions, world) + _visibilitymap(definitions, world) props = utils.create_props(prefix, definitions) return props @@ -377,6 +379,9 @@ def _indirect_light_visibility(definitions, lamp_or_world): "visibility.indirect.specular.enable": lamp_or_world.luxcore.visibility_indirect_specular, }) +def _visibilitymap(definitions, lamp_or_world): + definitions["visibilitymap.enable"] = lamp_or_world.luxcore.visibilitymap_enable + def export_ies(definitions, iesfile_type, iesfile_text, iesfile_path, flipz, library, is_meshlight=False): prefix = "emission." if is_meshlight else "" diff --git a/properties/light.py b/properties/light.py index 12da7259..e4dbae95 100644 --- a/properties/light.py +++ b/properties/light.py @@ -53,6 +53,11 @@ "of the light and less to the sides." ) +VISIBILITYMAP_ENABLE_DESC = ( + "Compute a visibility map for this light source. Recommended for indoor scenes where this " + "light source is only visible through small openings (e.g. windows)" +) + def init(): bpy.types.Lamp.luxcore = PointerProperty(type=LuxCoreLightProps) @@ -146,6 +151,10 @@ def update_is_laser(self, context): visibility_indirect_glossy = BoolProperty(name="Glossy", default=True) visibility_indirect_specular = BoolProperty(name="Specular", default=True) + # sky2, infinite, constantinfinite + visibilitymap_enable = BoolProperty(name="Build Visibility Map", default=True, + description=VISIBILITYMAP_ENABLE_DESC) + # area # We use unit="ROTATION" because angles are radians, so conversion is necessary for the UI spread_angle = FloatProperty(name="Spread Angle", default=math.pi / 2, min=0, soft_min=math.radians(5), diff --git a/properties/world.py b/properties/world.py index 8f17c19c..8f252c7e 100644 --- a/properties/world.py +++ b/properties/world.py @@ -6,7 +6,8 @@ ) from .light import ( SAMPLES_DESCRIPTION, IMPORTANCE_DESCRIPTION, - GAMMA_DESCRIPTION, SAMPLEUPPERHEMISPHEREONLY_DESCRIPTION + GAMMA_DESCRIPTION, SAMPLEUPPERHEMISPHEREONLY_DESCRIPTION, + VISIBILITYMAP_ENABLE_DESC, ) @@ -49,5 +50,8 @@ class LuxCoreWorldProps(bpy.types.PropertyGroup): visibility_indirect_glossy = BoolProperty(name="Glossy", default=True) visibility_indirect_specular = BoolProperty(name="Specular", default=True) - volume = PointerProperty(type=bpy.types.NodeTree) + # sky2, infinite, constantinfinite + visibilitymap_enable = BoolProperty(name="Build Visibility Map", default=True, + description=VISIBILITYMAP_ENABLE_DESC) + volume = PointerProperty(type=bpy.types.NodeTree) diff --git a/ui/light.py b/ui/light.py index f212a8a1..436c3f68 100644 --- a/ui/light.py +++ b/ui/light.py @@ -152,6 +152,10 @@ def draw(self, context): layout.prop(lamp.luxcore, "samples") layout.prop(lamp.luxcore, "importance") + if lamp.type == "HEMI": + # infinite (with image) and constantinfinte lights + layout.prop(lamp.luxcore, "visibilitymap_enable") + class LUXCORE_LAMP_PT_visibility(DataButtonsPanel, Panel): COMPAT_ENGINES = {"LUXCORE"} diff --git a/ui/world.py b/ui/world.py index 86e3665d..d907f71f 100644 --- a/ui/world.py +++ b/ui/world.py @@ -115,6 +115,8 @@ def draw(self, context): layout.prop(world.luxcore, "samples") layout.prop(world.luxcore, "importance") + layout.prop(world.luxcore, "visibilitymap_enable") + class LUXCORE_WORLD_PT_visibility(WorldButtonsPanel, Panel): COMPAT_ENGINES = {"LUXCORE"}