Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-07-30 15:05:45 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-07-30 15:05:45 +0400
commitec4904a9fe19492f7ed07d1ebc1664d51ebcbb06 (patch)
tree88e3b453d42a045ce3529495a61bac1258cbfd34 /release
parent248fa8ec5479ecccb9471c321fa685e5d9f4ad0c (diff)
Support for povray radiosity settings, adjust in scene panel.
Diffstat (limited to 'release')
-rw-r--r--release/io/engine_render_pov.py166
1 files changed, 158 insertions, 8 deletions
diff --git a/release/io/engine_render_pov.py b/release/io/engine_render_pov.py
index c89d4390c77..44f34d890f6 100644
--- a/release/io/engine_render_pov.py
+++ b/release/io/engine_render_pov.py
@@ -419,15 +419,39 @@ def write_pov(filename, scene=None, info_callback = None):
mist = world.mist
if mist.enabled:
- file.write('\tfog {\n')
- file.write('\t\tdistance %.6f\n' % mist.depth)
- file.write('\t\tcolor rgbt<%.3g, %.3g, %.3g, %.3g>\n' % (tuple(world.horizon_color) + (1-mist.intensity,)))
- #file.write('\t\tfog_offset %.6f\n' % mist.start)
- #file.write('\t\tfog_alt 5\n')
- #file.write('\t\tturbulence 0.2\n')
- #file.write('\t\tturb_depth 0.3\n')
- file.write('\t\tfog_type 1\n')
+ file.write('fog {\n')
+ file.write('\tdistance %.6f\n' % mist.depth)
+ file.write('\tcolor rgbt<%.3g, %.3g, %.3g, %.3g>\n' % (tuple(world.horizon_color) + (1-mist.intensity,)))
+ #file.write('\tfog_offset %.6f\n' % mist.start)
+ #file.write('\tfog_alt 5\n')
+ #file.write('\tturbulence 0.2\n')
+ #file.write('\tturb_depth 0.3\n')
+ file.write('\tfog_type 1\n')
+ file.write('}\n')
+
+ def exportGlobalSettings(scene):
+
+ file.write('global_settings {\n')
+
+ if scene.pov_radio_enable:
+ file.write('\tradiosity {\n')
+ file.write("\t\tadc_bailout %.4g\n" % scene.pov_radio_adc_bailout)
+ file.write("\t\talways_sample %d\n" % scene.pov_radio_always_sample)
+ file.write("\t\tbrightness %.4g\n" % scene.pov_radio_brightness)
+ file.write("\t\tcount %d\n" % scene.pov_radio_count)
+ file.write("\t\terror_bound %.4g\n" % scene.pov_radio_error_bound)
+ file.write("\t\tgray_threshold %.4g\n" % scene.pov_radio_gray_threshold)
+ file.write("\t\tlow_error_factor %.4g\n" % scene.pov_radio_low_error_factor)
+ file.write("\t\tminimum_reuse %.4g\n" % scene.pov_radio_minimum_reuse)
+ file.write("\t\tnearest_count %d\n" % scene.pov_radio_nearest_count)
+ file.write("\t\tnormal %d\n" % scene.pov_radio_normal)
+ file.write("\t\trecursion_limit %d\n" % scene.pov_radio_recursion_limit)
file.write('\t}\n')
+
+ file.write('}\n')
+
+
+
exportCamera()
#exportMaterials()
@@ -436,6 +460,7 @@ def write_pov(filename, scene=None, info_callback = None):
exportLamps(lamps)
exportMeshs(sel)
exportWorld(scene.world)
+ exportGlobalSettings(scene)
file.close()
@@ -605,6 +630,8 @@ class PovrayRender(bpy.types.RenderEngine):
bpy.types.register(PovrayRender)
+
+
# Use some of the existing buttons.
import buttons_scene
buttons_scene.SCENE_PT_render.COMPAT_ENGINES.add('POVRAY_RENDER')
@@ -628,3 +655,126 @@ for member in dir(buttons_material):
try: subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except: pass
del buttons_material
+
+class RenderButtonsPanel(bpy.types.Panel):
+ __space_type__ = "BUTTONS_WINDOW"
+ __region_type__ = "WINDOW"
+ __context__ = "scene"
+ # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
+
+ def poll(self, context):
+ rd = context.scene.render_data
+ return (rd.use_game_engine==False) and (rd.engine in self.COMPAT_ENGINES)
+
+# Radiosity panel, use in the scene for now.
+class SCENE_PT_povray_radiosity(RenderButtonsPanel):
+ __label__ = "Radiosity"
+ COMPAT_ENGINES = set(['POVRAY_RENDER'])
+
+ def draw_header(self, context):
+ layout = self.layout
+ scene = context.scene
+ layout.itemR(scene, "pov_radio_enable", text="")
+
+ def draw(self, context):
+ layout = self.layout
+ scene = context.scene
+ rd = scene.render_data
+
+ layout.active = scene.pov_radio_enable
+
+ split = layout.split()
+
+ col = split.column()
+
+ col.itemR(scene, "pov_radio_count")
+ col.itemR(scene, "pov_radio_recursion_limit")
+ col.itemR(scene, "pov_radio_error_bound")
+
+ col.itemR(scene, "pov_radio_display_advanced")
+
+ if scene.pov_radio_display_advanced:
+ col.itemR(scene, "pov_radio_adc_bailout")
+ col.itemR(scene, "pov_radio_brightness")
+ col.itemR(scene, "pov_radio_gray_threshold")
+ col.itemR(scene, "pov_radio_low_error_factor")
+ col.itemR(scene, "pov_radio_minimum_reuse")
+ col.itemR(scene, "pov_radio_nearest_count")
+ col.itemR(scene, "pov_radio_normal")
+ col.itemR(scene, "pov_radio_always_sample")
+
+
+bpy.types.register(SCENE_PT_povray_radiosity)
+
+
+FloatProperty= bpy.types.Scene.FloatProperty
+IntProperty= bpy.types.Scene.IntProperty
+BoolProperty= bpy.types.Scene.BoolProperty
+
+# Not a real pov option, just to know if we should write
+BoolProperty( attr="pov_radio_enable",
+ name="Enable Radiosity",
+ description="Enable povrays radiosity calculation.",
+ default= False)
+BoolProperty( attr="pov_radio_display_advanced",
+ name="Advanced Options",
+ description="Show advanced options.",
+ default= False)
+
+# Real pov options
+FloatProperty( attr="pov_radio_adc_bailout",
+ name="ADC Bailout",
+ description="The adc_bailout for radiosity rays. Use adc_bailout = 0.01 / brightest_ambient_object for good results.",
+ min=0.0, max=1000.0, soft_min=0.0, soft_max=1.0, default= 0.01)
+
+BoolProperty( attr="pov_radio_always_sample",
+ name="Always Sample",
+ description="Only use the data from the pretrace step and not gather any new samples during the final radiosity pass..",
+ default= True)
+
+FloatProperty( attr="pov_radio_brightness",
+ name="Brightness",
+ description="Ammount objects are brightened before being returned upwards to the rest of the system.",
+ min=0.0, max=1000.0, soft_min=0.0, soft_max=10.0, default= 1.0)
+
+IntProperty( attr="pov_radio_count",
+ name="Ray Count",
+ description="number of rays that are sent out whenever a new radiosity value has to be calculated.",
+ min=1, max=1600, default= 35)
+
+FloatProperty( attr="pov_radio_error_bound",
+ name="Error Bound",
+ description="one of the two main speed/quality tuning values, lower values are more accurate.",
+ min=0.0, max=1000.0, soft_min=0.1, soft_max=10.0, default= 1.8)
+
+FloatProperty( attr="pov_radio_gray_threshold",
+ name="Gray Threshold",
+ description="one of the two main speed/quality tuning values, lower values are more accurate.",
+ min=0.0, max=1.0, default= 0.0)
+
+FloatProperty( attr="pov_radio_low_error_factor",
+ name="Low Error Factor",
+ description="If you calculate just enough samples, but no more, you will get an image which has slightly blotchy lighting.",
+ min=0.0, max=1.0, default= 0.5)
+
+# max_sample - not available yet
+
+FloatProperty( attr="pov_radio_minimum_reuse",
+ name="Minimum Reuse",
+ description="Fraction of the screen width which sets the minimum radius of reuse for each sample point (At values higher than 2% expect errors).",
+ min=0.0, max=1.0, soft_min=0.1, soft_max=0.1, default= 0.015)
+
+IntProperty( attr="pov_radio_nearest_count",
+ name="Nearest Count",
+ description="Number of old ambient values blended together to create a new interpolated value.",
+ min=1, max=20, default= 5)
+
+BoolProperty( attr="pov_radio_normal",
+ name="Normals",
+ description="Radiosity estimation can be affected by normals.",
+ default= False)
+
+IntProperty( attr="pov_radio_recursion_limit",
+ name="Recursion Limit",
+ description="how many recursion levels are used to calculate the diffuse inter-reflection.",
+ min=1, max=20, default= 3)