Skip to content

Commit

Permalink
make it possible to disable area light visibility for indirect rays
Browse files Browse the repository at this point in the history
  • Loading branch information
Theverat committed Jul 31, 2019
1 parent 336c5d9 commit 7956892
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
10 changes: 6 additions & 4 deletions export/light.py
Expand Up @@ -317,10 +317,12 @@ def _convert_area_lamp(obj, scene, context, luxcore_scene, gain, importance, lux
"emission.theta": math.degrees(lamp.luxcore.spread_angle),
"emission.id": scene.luxcore.lightgroups.get_id_by_name(lamp.luxcore.lightgroup),
"emission.importance": importance,
# TODO: maybe transparency (hacky)

# Note: do not add support for visibility.indirect.* settings, they are useless here
# because the only sensible setting is to have them enabled, otherwise we lose MIS
# TODO: transparency
# Note: if any of these is disabled, we lose MIS, which can lead to more noise.
# However, in some rare cases it's needed to disable some of them.
"visibility.indirect.diffuse.enable": lamp.luxcore.visibility_indirect_diffuse,
"visibility.indirect.glossy.enable": lamp.luxcore.visibility_indirect_glossy,
"visibility.indirect.specular.enable": lamp.luxcore.visibility_indirect_specular,
}

# IES data
Expand Down
2 changes: 1 addition & 1 deletion properties/light.py
Expand Up @@ -172,7 +172,7 @@ def update_is_laser(self, context):
# laser
# Note: radius is set with default Blender properties (area light size)

# sky2, sun, infinite, constantinfinite
# sky2, sun, infinite, constantinfinite, area
visibility_indirect_diffuse = BoolProperty(name="Diffuse", default=True, description=VIS_INDIRECT_DIFFUSE_DESC)
visibility_indirect_glossy = BoolProperty(name="Glossy", default=True, description=VIS_INDIRECT_GLOSSY_DESC)
visibility_indirect_specular = BoolProperty(name="Specular", default=True, description=VIS_INDIRECT_SPECULAR_DESC)
Expand Down
17 changes: 9 additions & 8 deletions ui/light.py
Expand Up @@ -193,16 +193,17 @@ class LUXCORE_LAMP_PT_visibility(DataButtonsPanel, Panel):
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
if engine != "LUXCORE":
return False

visible = False
if context.lamp:
# Visible for sky2, sun, infinite, constantinfinite
if context.lamp.type == "SUN" and context.lamp.luxcore.sun_type == "sun":
visible = True
elif context.lamp.type == "HEMI":
visible = True
light = context.lamp
if not light:
return False

return context.lamp and engine == "LUXCORE" and visible
# Visible for sky2, sun, infinite, constantinfinite, area
return ((light.type == "SUN" and light.luxcore.sun_type == "sun")
or light.type == "HEMI"
or (light.type == "AREA" and not light.luxcore.is_laser))

def draw(self, context):
layout = self.layout
Expand Down

0 comments on commit 7956892

Please sign in to comment.