Skip to content

Commit

Permalink
make it possible to disable the visibility map
Browse files Browse the repository at this point in the history
  • Loading branch information
Theverat committed Feb 8, 2018
1 parent 9530c8c commit 12351b7
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
5 changes: 5 additions & 0 deletions export/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 ""
Expand Down
9 changes: 9 additions & 0 deletions properties/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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),
Expand Down
8 changes: 6 additions & 2 deletions properties/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
)
from .light import (
SAMPLES_DESCRIPTION, IMPORTANCE_DESCRIPTION,
GAMMA_DESCRIPTION, SAMPLEUPPERHEMISPHEREONLY_DESCRIPTION
GAMMA_DESCRIPTION, SAMPLEUPPERHEMISPHEREONLY_DESCRIPTION,
VISIBILITYMAP_ENABLE_DESC,
)


Expand Down Expand Up @@ -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)
4 changes: 4 additions & 0 deletions ui/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
2 changes: 2 additions & 0 deletions ui/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down

0 comments on commit 12351b7

Please sign in to comment.