From 4262eb54033c8bb23225b9b51942006748939b89 Mon Sep 17 00:00:00 2001 From: Maurice Raybaud Date: Fri, 23 Aug 2019 23:54:57 +0200 Subject: post 2.8 fix light samples --- render_povray/__init__.py | 27 +++++++++++++++++++- render_povray/render.py | 12 ++++----- render_povray/ui.py | 64 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 7 deletions(-) diff --git a/render_povray/__init__.py b/render_povray/__init__.py index e475335e..0551e2eb 100644 --- a/render_povray/__init__.py +++ b/render_povray/__init__.py @@ -4094,7 +4094,32 @@ class RenderPovSettingsLight(PropertyGroup): default="RAY_SHADOW") active_texture_index: IntProperty( name = "Index for texture_slots", - default = 0) + default = 0) + use_halo: BoolProperty( + name="Halo", description="Render spotlight with a volumetric halo", + default=False) + halo_intensity: FloatProperty( + name="Halo intensity", + description="Brightness of the spotlight halo cone", + soft_min=0.0, soft_max=1.0, default=1.0) + shadow_ray_samples_x: IntProperty( + name = "Number of samples taken extra (samples x samples)", + min=1, soft_max=64, + default = 1) + shadow_ray_samples_y: IntProperty( + name = "Number of samples taken extra (samples x samples)", + min=1, soft_max=64, + default = 1) + shadow_ray_sample_method: EnumProperty( + name="", + description="Method for generating shadow samples: Adaptive QMC is fastest, Constant QMC is less noisy but slower", + items=(('ADAPTIVE_QMC', "", "Halton samples distribution", "",0), + ('CONSTANT_QMC', "", "QMC samples distribution", "",1), + ('CONSTANT_JITTERED', "", "Uses POV jitter keyword", "",2)), #"Show other data textures" + default = 'CONSTANT_JITTERED') + use_jitter: BoolProperty( + name="Jitter", description="Use noise for sampling (Constant Jittered sampling)", + default=False) ############################################################################### # World POV properties. ############################################################################### diff --git a/render_povray/render.py b/render_povray/render.py index 828141ce..1b03c241 100644 --- a/render_povray/render.py +++ b/render_povray/render.py @@ -600,13 +600,13 @@ def write_pov(filename, scene=None, info_callback=None): tabWrite("tightness 0\n") # 0:10f tabWrite("point_at <0, 0, -1>\n") - if lamp.use_halo: + if lamp.pov.use_halo: tabWrite("looks_like{\n") tabWrite("sphere{<0,0,0>,%.6f\n" %lamp.distance) tabWrite("hollow\n") tabWrite("material{\n") tabWrite("texture{\n") - tabWrite("pigment{rgbf<1,1,1,%.4f>}\n" % (lamp.halo_intensity*5.0)) + tabWrite("pigment{rgbf<1,1,1,%.4f>}\n" % (lamp.pov.halo_intensity*5.0)) tabWrite("}\n") tabWrite("interior{\n") tabWrite("media{\n") @@ -635,19 +635,19 @@ def write_pov(filename, scene=None, info_callback=None): # for those? tabWrite("fade_power %d\n" % 2) size_x = lamp.size - samples_x = lamp.shadow_ray_samples_x + samples_x = lamp.pov.shadow_ray_samples_x if lamp.shape == 'SQUARE': size_y = size_x samples_y = samples_x else: size_y = lamp.size_y - samples_y = lamp.shadow_ray_samples_y + samples_y = lamp.pov.shadow_ray_samples_y tabWrite("area_light <%.6f,0,0>,<0,%.6f,0> %d, %d\n" % \ (size_x, size_y, samples_x, samples_y)) tabWrite("area_illumination\n") - if lamp.shadow_ray_sample_method == 'CONSTANT_JITTERED': - if lamp.use_jitter: + if lamp.pov.shadow_ray_sample_method == 'CONSTANT_JITTERED': + if lamp.pov.use_jitter: tabWrite("jitter\n") else: tabWrite("adaptive 1\n") diff --git a/render_povray/ui.py b/render_povray/ui.py index c1408153..1ffb0140 100644 --- a/render_povray/ui.py +++ b/render_povray/ui.py @@ -622,6 +622,70 @@ class LIGHT_PT_POV_shadow(PovLampButtonsPanel, Panel): lamp = context.lamp layout.row().prop(lamp, "shadow_method", expand=True) + + split = layout.split() + + col = split.column() + sub = col.column() + sub.prop(lamp, "spot_size", text="Size") + sub.prop(lamp, "spot_blend", text="Blend", slider=True) + col.prop(lamp, "use_square") + col.prop(lamp, "show_cone") + + col = split.column() + + col.active = (lamp.shadow_method != 'BUFFER_SHADOW' or lamp.shadow_buffer_type != 'DEEP') + col.prop(lamp, "use_halo") + sub = col.column(align=True) + sub.active = lamp.use_halo + sub.prop(lamp, "halo_intensity", text="Intensity") + if lamp.shadow_method == 'BUFFER_SHADOW': + sub.prop(lamp, "halo_step", text="Step") + if lamp.shadow_method == 'NOSHADOW' and lamp.type == 'AREA': + split = layout.split() + + col = split.column() + col.label(text="Form factor sampling:") + + sub = col.row(align=True) + + if lamp.shape == 'SQUARE': + sub.prop(lamp, "shadow_ray_samples_x", text="Samples") + elif lamp.shape == 'RECTANGLE': + sub.prop(lamp.pov, "shadow_ray_samples_x", text="Samples X") + sub.prop(lamp.pov, "shadow_ray_samples_y", text="Samples Y") + + if lamp.shadow_method != 'NOSHADOW': + split = layout.split() + + col = split.column() + col.prop(lamp, "shadow_color", text="") + + col = split.column() + col.prop(lamp, "use_shadow_layer", text="This Layer Only") + col.prop(lamp, "use_only_shadow") + + if lamp.shadow_method == 'RAY_SHADOW': + split = layout.split() + + col = split.column() + col.label(text="Sampling:") + + if lamp.type in {'POINT', 'SUN', 'SPOT'}: + sub = col.row() + + sub.prop(lamp, "shadow_ray_samples", text="Samples") + sub.prop(lamp, "shadow_soft_size", text="Soft Size") + + elif lamp.type == 'AREA': + sub = col.row(align=True) + + if lamp.shape == 'SQUARE': + sub.prop(lamp, "shadow_ray_samples_x", text="Samples") + elif lamp.shape == 'RECTANGLE': + sub.prop(lamp, "shadow_ray_samples_x", text="Samples X") + sub.prop(lamp, "shadow_ray_samples_y", text="Samples Y") + ''' if lamp.shadow_method == 'NOSHADOW' and lamp.type == 'AREA': split = layout.split() -- cgit v1.2.3