[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1527] trunk/py/scripts/addons/ render_povray: Added more UI controls for Depth of Field

Maurice Raybaud mauriceraybaud at hotmail.fr
Mon Jan 31 02:29:43 CET 2011


Revision: 1527
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1527
Author:   mauriceraybaud
Date:     2011-01-31 01:29:37 +0000 (Mon, 31 Jan 2011)
Log Message:
-----------
Added more UI controls for Depth of Field
Cleaned up Media and photons UI layouts

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-30 13:39:30 UTC (rev 1526)
+++ trunk/py/scripts/addons/render_povray/__init__.py	2011-01-31 01:29:37 UTC (rev 1527)
@@ -174,7 +174,7 @@
             min=1, max=256, default=5)
 
     Scene.pov_photon_adc_bailout = FloatProperty(
-            name="ADC Bailout", description="The adc_bailout for radiosity rays. Use adc_bailout = 0.01 / brightest_ambient_object for good results",
+            name="ADC Bailout", description="The adc_bailout for photons. 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.1, precision=3)
 
     Scene.pov_photon_gather_min = IntProperty(
@@ -363,14 +363,53 @@
             default=True)   
 
     ###########################################################################
+    
+    Cam = bpy.types.Camera
 
+    #DOF Toggle
+    Cam.pov_dof_enable = BoolProperty(
+            name="Depth Of Field",
+            description="Enable POV-Ray Depth Of Field ",
+            default=True)
 
+    #Aperture (Intensity of the Blur)
+    Cam.pov_dof_aperture = FloatProperty(
+            name="Aperture",
+            description="Similar to a real camera's aperture effect over focal blur (though not in physical units and independant of focal length).Increase to get more blur",
+            min=0.01, max=1.00, default=0.25)
+
+    #Aperture adaptive sampling
+    Cam.pov_dof_samples_min = IntProperty(
+            name="Samples Min",
+            description="Minimum number of rays to use for each pixel",
+            min=1, max=128, default=96)
+
+    Cam.pov_dof_samples_max = IntProperty(
+            name="Samples Max",
+            description="Maximum number of rays to use for each pixel",
+            min=1, max=128, default=128)
+
+    Cam.pov_dof_variance = IntProperty(
+            name="Variance",
+            description="Minimum threshold (fractional value) for adaptive DOF sampling (up increases quality and render time). The value for the variance should be in the range of the smallest displayable color difference",
+            min=1, max=100000, soft_max=10000, default=256)
+    
+    Cam.pov_dof_confidence = FloatProperty(
+            name="Confidence",
+            description="Probability to reach the real color value. Larger confidence values will lead to more samples, slower traces and better images.",
+            min=0.01, max=0.99, default=0.90)
+
+    ###########################################################################
+
+
+
 def unregister():
     import bpy
     Scene = bpy.types.Scene
     Mat = bpy.types.Material
     Tex = bpy.types.Texture 
     Obj = bpy.types.Object
+    Cam = bpy.types.Camera 
     del Scene.pov_tempfiles_enable  # CR
     del Scene.pov_scene_name  # CR
     del Scene.pov_deletefiles_enable  # CR
@@ -433,6 +472,12 @@
     del Tex.pov_tex_gamma_value  # MR
     del Obj.pov_importance_value  # MR
     del Obj.pov_collect_photons # MR
-
+    del Cam.pov_dof_enable # MR
+    del Cam.pov_dof_aperture # MR
+    del Cam.pov_dof_samples_min # MR
+    del Cam.pov_dof_samples_max # MR
+    del Cam.pov_dof_variance # MR
+    del Cam.pov_dof_confidence # MR
+    
 if __name__ == "__main__":
     register()

Modified: trunk/py/scripts/addons/render_povray/render.py
===================================================================
--- trunk/py/scripts/addons/render_povray/render.py	2011-01-30 13:39:30 UTC (rev 1526)
+++ trunk/py/scripts/addons/render_povray/render.py	2011-01-31 01:29:37 UTC (rev 1527)
@@ -535,10 +535,11 @@
 
             tabWrite("rotate  <%.6f, %.6f, %.6f>\n" % tuple([degrees(e) for e in matrix.rotation_part().to_euler()]))
             tabWrite("translate <%.6f, %.6f, %.6f>\n" % (matrix[3][0], matrix[3][1], matrix[3][2]))
-            if focal_point != 0:
-                tabWrite("aperture 0.25\n")  # fixed blur amount for now to do, add slider a button?
-                tabWrite("blur_samples 96 128\n")
-                tabWrite("variance 1/10000\n")
+            if camera.data.pov_dof_enable and focal_point != 0:
+                tabWrite("aperture %.3g\n"% camera.data.pov_dof_aperture) 
+                tabWrite("blur_samples %d %d\n"% (camera.data.pov_dof_samples_min, camera.data.pov_dof_samples_max))
+                tabWrite("variance 1/%d\n"% camera.data.pov_dof_variance)
+                tabWrite("confidence %.3g\n"% camera.data.pov_dof_confidence)
                 tabWrite("focal_point <0, 0, %f>\n" % focal_point)
         tabWrite("}\n")
 

Modified: trunk/py/scripts/addons/render_povray/ui.py
===================================================================
--- trunk/py/scripts/addons/render_povray/ui.py	2011-01-30 13:39:30 UTC (rev 1526)
+++ trunk/py/scripts/addons/render_povray/ui.py	2011-01-31 01:29:37 UTC (rev 1527)
@@ -134,7 +134,20 @@
         rd = context.scene.render
         return obj and (rd.use_game_engine == False) and (rd.engine in cls.COMPAT_ENGINES)
 
+class CameraDataButtonsPanel():
+    bl_space_type = 'PROPERTIES'
+    bl_region_type = 'WINDOW'
+    bl_context = "data"
+    # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
 
+    @classmethod
+    def poll(cls, context):
+        cam = context.camera
+        rd = context.scene.render
+        return cam and (rd.use_game_engine == False) and (rd.engine in cls.COMPAT_ENGINES)
+
+
+
 class RENDER_PT_povray_export_settings(RenderButtonsPanel, bpy.types.Panel):
     bl_label = "Export Settings"
     COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -196,19 +209,25 @@
         rd = scene.render
 
         layout.active = scene.pov_max_trace_level
+
         split = layout.split()
+        col = split.column()
         
-        col = split.column()
         col.label(text="Global Settings")
         col.prop(scene, "pov_max_trace_level", text="Ray Depth")
-        row = col.row()
+
         col.label(text="Global Photons")
         col.prop(scene, "pov_photon_max_trace_level", text="Photon Depth")
-        row = col.row()
+
+        split = layout.split()
+        col = split.column()
         col.prop(scene, "pov_photon_spacing", text="Spacing")
+        col.prop(scene, "pov_photon_gather_min")
+
+        col = split.column()
+
         col.prop(scene, "pov_photon_adc_bailout", text="Photon ADC")
-        col.prop(scene, "pov_photon_gather_min", text="Photons gathered min")
-        col.prop(scene, "pov_photon_gather_max", text="Photons gathered max")
+        col.prop(scene, "pov_photon_gather_max")      
 
 
 class RENDER_PT_povray_antialias(RenderButtonsPanel, bpy.types.Panel):
@@ -324,7 +343,8 @@
 
         col = split.column()
         col.prop(scene, "pov_media_samples", text="Samples")
-        col.prop(scene, "pov_media_color", text="Color")
+        col = split.column()
+        col.prop(scene, "pov_media_color", text="")
 
 ##class RENDER_PT_povray_baking(RenderButtonsPanel, bpy.types.Panel):
 ##    bl_label = "Baking"
@@ -519,3 +539,36 @@
         row = col.row()
         col.label(text="Photons")
         col.prop(obj, "pov_collect_photons", text="Receive Photon Caustics")
+
+class Camera_PT_povray_cam_dof(CameraDataButtonsPanel, bpy.types.Panel):
+    bl_label = "POV-Ray Depth Of Field"
+    COMPAT_ENGINES = {'POVRAY_RENDER'}
+
+    def draw_header(self, context):
+        cam = context.camera
+
+        self.layout.prop(cam, "pov_dof_enable", text="")
+        
+    def draw(self, context):
+        layout = self.layout
+
+        cam = context.camera
+
+        layout.active = cam.pov_dof_enable
+        
+        split = layout.split()
+        row = split.row()
+        row.prop(cam, "pov_dof_aperture")
+        
+        split = layout.split()
+        col = split.column()
+
+        col.prop(cam, "pov_dof_samples_min")
+        col.prop(cam, "pov_dof_variance")
+        
+        col = split.column()
+
+        col.prop(cam, "pov_dof_samples_max")
+        col.prop(cam, "pov_dof_confidence")
+        
+



More information about the Bf-extensions-cvs mailing list