Skip to content

Commit 691f0b4

Browse files
committed
Use proper area light conversion factor depending on blender version
1 parent bda9fb6 commit 691f0b4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

mitsuba-blender/io/exporter/lights.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from mathutils import Matrix
22
import numpy as np
33
from .export_context import Files
4+
import bpy
45

56
def convert_area_light(b_light, export_ctx):
67
params = {}
@@ -43,8 +44,11 @@ def convert_area_light(b_light, export_ctx):
4344
emitter = {
4445
'type': 'area'
4546
}
46-
# Conversion factor used in Cycles, to convert to irradiance (don't ask me why)
47-
conv_fac = 1.0 / (area * 4.0)
47+
# Conversion factor used in Cycles
48+
if bpy.app.version < (4, 0, 0):
49+
conv_fac = 1.0 / (area * 4.0)
50+
else:
51+
conv_fac = 1.0 / (area * np.pi)
4852
emitter['radiance'] = export_ctx.spectrum(conv_fac * b_light.data.energy * b_light.data.color)
4953
params['emitter'] = emitter
5054

0 commit comments

Comments
 (0)