[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1389] trunk/py/scripts/addons/ render_povray: ADDED:

Maurice Raybaud mauriceraybaud at hotmail.fr
Wed Jan 12 16:27:52 CET 2011


Revision: 1389
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1389
Author:   mauriceraybaud
Date:     2011-01-12 15:27:51 +0000 (Wed, 12 Jan 2011)
Log Message:
-----------
ADDED:
-pov max trace level (ray depth)
-pov radiosity importance sampling
-Higher Radiosity samples count (allows Halton sampling)
-pov pretrace_start / pretrace_end
FIXED
-incomplete tooltip for pov low_error
-sky_sphere mapping options:
-world sky gradient to follow pov coordinate system
-Skysphere rotation made independant from camera
-generation of skysphere with image map and BlendSky will just consider the texture for now.

All issues reported here 
http://projects.blender.org/tracker/?func=detail&atid=469&aid=23145&group_id=153
by Constantin Rahn, except Layer selective export, adding it to maydo list

Modified Paths:
--------------
    trunk/py/scripts/addons/render_povray/__init__.py
    trunk/py/scripts/addons/render_povray/render.py
    trunk/py/scripts/addons/render_povray/ui.py

Modified: trunk/py/scripts/addons/render_povray/__init__.py
===================================================================
--- trunk/py/scripts/addons/render_povray/__init__.py	2011-01-12 09:45:14 UTC (rev 1388)
+++ trunk/py/scripts/addons/render_povray/__init__.py	2011-01-12 15:27:51 UTC (rev 1389)
@@ -71,6 +71,10 @@
             default=False)
 
     # Real pov options
+    Scene.pov_max_trace_level = IntProperty(
+            name="Max Trace Level", description="Number of reflections/refractions allowed on ray path",
+            min=1, max=256, default=5)
+    
     Scene.pov_radio_adc_bailout = FloatProperty(
             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)
@@ -84,8 +88,8 @@
             min=0.0, max=1000.0, soft_min=0.0, soft_max=10.0, default=1.0)
 
     Scene.pov_radio_count = IntProperty(
-            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)
+            name="Ray Count", description="Number of rays for each new radiosity value to be calculated (halton sequence over 1600)",
+            min=1, max=10000, soft_max=1600, default=35)
 
     Scene.pov_radio_error_bound = FloatProperty(
             name="Error Bound", description="One of the two main speed/quality tuning values, lower values are more accurate",
@@ -96,7 +100,7 @@
             min=0.0, max=1.0, soft_min=0, soft_max=1, default=0.0)
 
     Scene.pov_radio_low_error_factor = FloatProperty(
-            name="Low Error Factor", description="If you calculate just enough samples, but no more, you will get an image which has slightly blotchy lighting",
+            name="Low Error Factor", description="Just enough samples is slightly blotchy. Low error changes error tolerance for less critical last refining pass",
             min=0.0, max=1.0, soft_min=0.0, soft_max=1.0, default=0.5)
 
     # max_sample - not available yet
@@ -120,6 +124,14 @@
             name="Recursion Limit", description="how many recursion levels are used to calculate the diffuse inter-reflection",
             min=1, max=20, default=3)
 
+    Scene.pov_radio_pretrace_start = FloatProperty(
+            name="Pretrace Start", description="Fraction of the screen width which sets the size of the blocks in the mosaic preview first pass",
+            min=0.01, max=1.00, soft_min=0.02, soft_max=1.0, default=0.08)
+
+    Scene.pov_radio_pretrace_end = FloatProperty(
+            name="Pretrace End", description="Fraction of the screen width which sets the size of the blocks in the mosaic preview last pass",
+            min=0.01, max=1.00, soft_min=0.02, soft_max=1.0, default=0.04)
+
     ########################################MR######################################
     Mat = bpy.types.Material
 
@@ -208,6 +220,13 @@
             name="Custom texture gamma",
             description="value for which the file was issued e.g. a Raw photo is gamma 1.0",
             min=0.45, max=5.00, soft_min=1.00, soft_max=2.50, default=1.00)
+
+    #Importance sampling
+    Obj = bpy.types.Object
+    Obj.pov_importance_value = FloatProperty(
+            name="Radiosity Importance",
+            description="Priority value relative to other objects for sampling radiosity rays. Increase to get more radiosity rays at comparatively small yet bright objects",
+            min=0.01, max=1.00, default=1.00)
     
     ######################################EndMR#####################################
 
@@ -216,6 +235,7 @@
     Scene = bpy.types.Scene
     Mat = bpy.types.Material # MR
     Tex = bpy.types.Texture # MR
+    Obj = bpy.types.Object # MR
     del Scene.pov_radio_enable
     del Scene.pov_radio_display_advanced
     del Scene.pov_radio_adc_bailout
@@ -230,10 +250,13 @@
     del Scene.pov_radio_nearest_count
     del Scene.pov_radio_normal
     del Scene.pov_radio_recursion_limit
+    del Scene.pov_radio_pretrace_start # MR
+    del Scene.pov_radio_pretrace_end # MR
     del Scene.pov_media_enable # MR
     del Scene.pov_media_samples # MR
     del Scene.pov_media_color # MR
     del Scene.pov_baking_enable # MR
+    del Scene.pov_max_trace_level # MR
     del Mat.pov_irid_enable # MR
     del Mat.pov_mirror_use_IOR # MR
     del Mat.pov_mirror_metallic # MR    
@@ -250,6 +273,7 @@
     del Mat.pov_refraction_type # MR
     del Tex.pov_tex_gamma_enable # MR
     del Tex.pov_tex_gamma_value # MR
+    del Obj.pov_importance_value # MR
 
 if __name__ == "__main__":
     register()

Modified: trunk/py/scripts/addons/render_povray/render.py
===================================================================
--- trunk/py/scripts/addons/render_povray/render.py	2011-01-12 09:45:14 UTC (rev 1388)
+++ trunk/py/scripts/addons/render_povray/render.py	2011-01-12 15:27:51 UTC (rev 1389)
@@ -545,6 +545,7 @@
 
         for ob in metas:
             meta = ob.data
+            importance=ob.pov_importance_value              
 
             file.write('blob {\n')
             file.write('\t\tthreshold %.4g\n' % meta.threshold)
@@ -597,6 +598,10 @@
             writeObjectMaterial(material)
 
             writeMatrix(global_matrix * ob.matrix_world)
+            #Importance for radiosity sampling added here: 
+            file.write('\tradiosity { importance %3g }\n' % importance)
+            
+            file.write('}\n') #End of Metaball block
 
             file.write('}\n')
 
@@ -620,6 +625,7 @@
                 continue
 
             me = ob.data
+            importance=ob.pov_importance_value            
             me_materials = me.materials
 
             me = ob.create_mesh(scene, True, 'RENDER')
@@ -1073,7 +1079,11 @@
                     print(me)
 
             writeMatrix(matrix)
-            file.write('}\n')
+            
+            #Importance for radiosity sampling added here: 
+            file.write('\tradiosity { importance %3g }\n' % importance) 
+
+            file.write('}\n') # End of mesh block
             file.write('%s\n' % name) # Use named declaration to allow reference e.g. for baking. MR
 
             bpy.data.meshes.remove(me)
@@ -1100,9 +1110,10 @@
                     file.write('background {rgbt<%.3g, %.3g, %.3g, 1>}\n' % (tuple(world.horizon_color)))
 
                     
-
+            worldTexCount=0
             #For Background image textures
             for t in world.texture_slots: #risk to write several sky_spheres but maybe ok.
+                worldTexCount+=1
                 if t and t.texture.type == 'IMAGE': #and t.use: #No enable checkbox for world textures yet (report it?)
                     image_filename  = path_image(t.texture.image.filepath)
                     if t.texture.image.filepath != image_filename: t.texture.image.filepath = image_filename
@@ -1113,7 +1124,11 @@
                     #commented below was an idea to make the Background image oriented as camera taken here: http://news.povray.org/povray.newusers/thread/%3Cweb.4a5cddf4e9c9822ba2f93e20@news.povray.org%3E/
                     #mappingBlend = (" translate <%.4g,%.4g,%.4g> rotate z*degrees(atan((camLocation - camLookAt).x/(camLocation - camLookAt).y)) rotate x*degrees(atan((camLocation - camLookAt).y/(camLocation - camLookAt).z)) rotate y*degrees(atan((camLocation - camLookAt).z/(camLocation - camLookAt).x)) scale <%.4g,%.4g,%.4g>b" % (t_blend.offset.x / 10 ,t_blend.offset.y / 10 ,t_blend.offset.z / 10, t_blend.scale.x ,t_blend.scale.y ,t_blend.scale.z))#replace 4/3 by the ratio of each image found by some custom or existing function
                     #using camera rotation valuesdirectly from blender seems much easier
-                    mappingBlend = (" translate <%.4g-0.5,%.4g-0.5,%.4g-0.5> rotate<%.4g,%.4g,%.4g>  scale <%.4g,%.4g,%.4g>" % (t_blend.offset.x / 10 ,t_blend.offset.y / 10 ,t_blend.offset.z / 10, degrees(camera.rotation_euler[0]), degrees(camera.rotation_euler[1]), degrees(camera.rotation_euler[2]), t_blend.scale.x*0.85 , t_blend.scale.y*0.85 , t_blend.scale.z*0.85 ))
+                    if t_blend.texture_coords!='ANGMAP':
+                        mappingBlend = (" translate <%.4g-0.5,%.4g-0.5,%.4g-0.5> rotate<0,0,0>  scale <%.4g,%.4g,%.4g>" % (t_blend.offset.x / 10 ,t_blend.offset.y / 10 ,t_blend.offset.z / 10, t_blend.scale.x*0.85 , t_blend.scale.y*0.85 , t_blend.scale.z*0.85 ))
+                        #The initial position and rotation of the pov camera is probably creating the rotation offset should look into it someday but at least background won't rotate with the camera now. 
+                    else:
+                        mappingBlend = ("")
                     #Putting the map on a plane would not introduce the skysphere distortion and allow for better image scale matching but also some waay to chose depth and size of the plane relative to camera.
                     file.write('sky_sphere {\n')            
                     file.write('\tpigment {\n')
@@ -1124,11 +1139,11 @@
       
             #For only Background gradient        
         
-            if not t:
+            if worldTexCount==0:
                 if world.use_sky_blend:
                     file.write('sky_sphere {\n')            
                     file.write('\tpigment {\n')
-                    file.write('\t\tgradient z\n')#maybe Should follow the advice of POV doc about replacing gradient for skysphere..5.5
+                    file.write('\t\tgradient y\n')#maybe Should follow the advice of POV doc about replacing gradient for skysphere..5.5
                     file.write('\t\tcolor_map {\n')
                     if render.alpha_mode == 'STRAIGHT':
                         file.write('\t\t\t[0.0 rgbt<%.3g, %.3g, %.3g, 1>]\n' % (tuple(world.horizon_color)))
@@ -1174,7 +1189,7 @@
 
         file.write('global_settings {\n')
         file.write('\tassumed_gamma 1.0\n')
-        file.write('\tmax_trace_level 7\n')
+        file.write('\tmax_trace_level %d\n' % scene.pov_max_trace_level)
 
         if scene.pov_radio_enable:
             file.write('\tradiosity {\n')
@@ -1189,6 +1204,8 @@
             file.write("\t\tminimum_reuse %.4g\n" % scene.pov_radio_minimum_reuse)
             file.write("\t\tnearest_count %d\n" % scene.pov_radio_nearest_count)

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list