diff --git a/render_povray/__init__.py b/render_povray/__init__.py index 792d5b250488722adb7484a169e73b05e702e5d0..3c3848d3378b92374af765a712a8dd0374bbf0f5 100644 --- a/render_povray/__init__.py +++ b/render_povray/__init__.py @@ -353,12 +353,16 @@ class RenderPovSettingsMaterial(bpy.types.PropertyGroup): default=False) photons_dispersion = FloatProperty( - name="chromatic dispersion", + name="Chromatic Dispersion", description="Light passing through will be separated according to wavelength. " \ "This ratio of refractive indices for violet to red controls how much " \ "the colors are spread out 1 = no dispersion, good values are 1.01 to 1.1", min=1.0000, max=10.000, soft_min=1.0000, soft_max=1.1000, precision=4, default=1.0000) + photons_dispersion_samples = IntProperty( + name="Dispersion Samples", description="Number of color-steps for dispersion", + min=2, max=128, default=7) + photons_reflection = BoolProperty( name="Reflective Photon Caustics", description="Use this to make your Sauron's ring ;-P", @@ -426,6 +430,14 @@ class RenderPovSettingsObject(bpy.types.PropertyGroup): " that generate caustics often don't need to show any on themselves).", default=True) + #Photons spacing_multiplier + spacing_multiplier = FloatProperty( + name="Photons Spacing Multiplier", + description="Multiplier value relative to global spacing of photons. " \ + "Decrease by half to get 4x more photons at surface of " \ + "this object (or 8x media photons than specified in the globals", + min=0.01, max=1.00, default=1.00) + ##################################CustomPOV Code############################ #Only DUMMIES below for now: replacement_text = StringProperty( diff --git a/render_povray/render.py b/render_povray/render.py index 87a4eb2d8f720e4b69778fcf0cce6d074accd76e..433172894fcfed0924ad77a3f6ff7b02bdb7f6ff 100644 --- a/render_povray/render.py +++ b/render_povray/render.py @@ -314,6 +314,7 @@ def write_pov(filename, scene=None, info_callback=None): if pov_photons_refraction: # Default of 1 means no dispersion tabWrite("dispersion %.6f\n" % material.pov.photons_dispersion) + tabWrite("dispersion_samples %.d\n" % material.pov.photons_dispersion_samples) #TODO # Other interior args if material.use_transparency and material.transparency_method == 'RAYTRACE': @@ -330,17 +331,17 @@ def write_pov(filename, scene=None, info_callback=None): # (variable) dispersion_samples (constant count for now) tabWrite("}\n") + + tabWrite("photons{") if not ob.pov.collect_photons: - tabWrite("photons{collect off}\n") + tabWrite("collect off\n") + tabWrite("target %.3g\n" % ob.pov.spacing_multiplier) + if pov_photons_refraction: + tabWrite("refraction on\n") + if pov_photons_reflection: + tabWrite("reflection on\n") + tabWrite("}\n") - if pov_photons_refraction or pov_photons_reflection: - tabWrite("photons{\n") - tabWrite("target\n") - if pov_photons_refraction: - tabWrite("refraction on\n") - if pov_photons_reflection: - tabWrite("reflection on\n") - tabWrite("}\n") materialNames = {} DEF_MAT_NAME = "Default" diff --git a/render_povray/ui.py b/render_povray/ui.py index 9335e004457ef0d830f946e60e270eba4130c77e..336424bd306f1b18ed99ce7eee7c8b651ecca26d 100644 --- a/render_povray/ui.py +++ b/render_povray/ui.py @@ -492,6 +492,7 @@ class MATERIAL_PT_povray_caustics(MaterialButtonsPanel, bpy.types.Panel): col.prop(mat.pov, "fake_caustics_power", slider=True) elif mat.pov.refraction_type == "2": col.prop(mat.pov, "photons_dispersion", slider=True) + col.prop(mat.pov, "photons_dispersion_samples", slider=True) col.prop(mat.pov, "photons_reflection") if mat.pov.refraction_type == "0" and not mat.pov.photons_reflection: @@ -560,13 +561,13 @@ class OBJECT_PT_povray_obj_importance(ObjectButtonsPanel, bpy.types.Panel): obj = context.object - layout.active = obj.pov.importance_value - col = layout.column() col.label(text="Radiosity:") col.prop(obj.pov, "importance_value", text="Importance") col.label(text="Photons:") col.prop(obj.pov, "collect_photons", text="Receive Photon Caustics") + if obj.pov.collect_photons: + col.prop(obj.pov, "spacing_multiplier", text="Photons Spacing Multiplier") class OBJECT_PT_povray_replacement_text(ObjectButtonsPanel, bpy.types.Panel):