This commit is contained in:
Tim Kuipers 2019-10-24 17:26:20 +02:00
parent 449ad19822
commit 03f7fab124

View file

@ -108,7 +108,7 @@ class ImageReader(MeshReader):
Job.yieldThread() Job.yieldThread()
if lighter_is_higher is use_transparency_model: if lighter_is_higher == use_transparency_model:
height_data = 1 - height_data height_data = 1 - height_data
for _ in range(0, blur_iterations): for _ in range(0, blur_iterations):
@ -129,11 +129,11 @@ class ImageReader(MeshReader):
Job.yieldThread() Job.yieldThread()
if use_transparency_model: if use_transparency_model:
p = 1.0 / math.log(transmittance_1mm / 100.0, 2) p = 1.0 / math.log(transmittance_1mm / 100.0, 2) # base doesn't matter here. use base 2 for fast computation
min_luminance = 2.0 ** ((peak_height - base_height) / p) min_luminance = 2.0 ** ((peak_height - base_height) / p)
for (y, x) in numpy.ndindex(height_data.shape): for (y, x) in numpy.ndindex(height_data.shape):
mapped_luminance = min_luminance + (1.0 - min_luminance) * height_data[y, x] mapped_luminance = min_luminance + (1.0 - min_luminance) * height_data[y, x]
height_data[y, x] = base_height + p * math.log(mapped_luminance, 2) height_data[y, x] = base_height + p * math.log(mapped_luminance, 2) # use same base as a couple lines above this
else: else:
height_data *= scale_vector.y height_data *= scale_vector.y
height_data += base_height height_data += base_height