Fix #20452: motion blur buttons were missing. Motion blur samples
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 6 Feb 2010 20:25:17 +0000 (20:25 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 6 Feb 2010 20:25:17 +0000 (20:25 +0000)
are now also decoupled from antialiasing samples. Implemented by
Matt, I'm just committing the patch.

release/scripts/ui/properties_render.py
source/blender/blenloader/intern/readfile.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_scene.c
source/blender/render/intern/include/render_types.h
source/blender/render/intern/source/initrender.c
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/zbuf.c

index fe83a70fe56b9fb9c732c09843c98da843cf568c..ea12e4d42c4308f5ddee5c9e211c6dd0dcd556f9 100644 (file)
@@ -460,7 +460,26 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
             col = split.column()
         col.prop(rd, "pixel_filter", text="")
         col.prop(rd, "filter_size", text="Size")
+        
 
+class RENDER_PT_motion_blur(RenderButtonsPanel):
+    bl_label = "Full Sample Motion Blur"
+    bl_default_closed = True
+    COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+    def draw_header(self, context):
+        rd = context.scene.render_data
+
+        self.layout.prop(rd, "motion_blur", text="")
+
+    def draw(self, context):
+        layout = self.layout
+
+        rd = context.scene.render_data
+        layout.active = rd.motion_blur
+
+        row = layout.row()
+        row.prop(rd, "motion_blur_samples")
 
 class RENDER_PT_dimensions(RenderButtonsPanel):
     bl_label = "Dimensions"
@@ -608,6 +627,7 @@ bpy.types.register(RENDER_PT_render)
 bpy.types.register(RENDER_PT_layers)
 bpy.types.register(RENDER_PT_dimensions)
 bpy.types.register(RENDER_PT_antialiasing)
+bpy.types.register(RENDER_PT_motion_blur)
 bpy.types.register(RENDER_PT_shading)
 bpy.types.register(RENDER_PT_output)
 bpy.types.register(RENDER_PT_encoding)
index 084f29e7d55a149a4d6b3ab1e7a7e969904b6925..f4261cbb738046a06a0ceeecc68dc75fbe24d3e3 100644 (file)
@@ -10082,6 +10082,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                
                                if(sce->r.frame_step==0)
                                        sce->r.frame_step= 1;
+                               if (sce->r.mblur_samples==0)
+                                       sce->r.mblur_samples = sce->r.osa;
                                
                                if(sce->ed && sce->ed->seqbasep)
                                {
index d646d9b7c67112c5fa1e2d17abde88a2312151dc..63d3e7642637e53990538adcc892a6317fafe324 100644 (file)
@@ -302,7 +302,10 @@ typedef struct RenderData {
        
        /* information on different layers to be rendered */
        ListBase layers;
-       short actlay, pad;
+       short actlay;
+       
+       /* number of mblur samples */
+       short mblur_samples;
        
        /**
         * Adjustment factors for the aspect ratio in the x direction, was a short in 2.45
index a5d6e92707fc227bc9f063a2f88685163c3d79c7..ba203929e2d7a69977b656ea68d99e4dceb3b299 100644 (file)
@@ -2164,7 +2164,13 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
        
        prop= RNA_def_property(srna, "motion_blur", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "mode", R_MBLUR);
-       RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled 3D scene motion blur (uses number of anti-aliasing samples).");
+       RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled 3D scene motion blur");
+       RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+       
+       prop= RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "mblur_samples");
+       RNA_def_property_range(prop, 1, 32);
+       RNA_def_property_ui_text(prop, "Motion Samples", "Number of scene samples to take with motion blur");
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
        
        prop= RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE);
index ba995621a98a39608d25a4b07d10f5eef8b8f653..de7d176759e4b14888402b5a7aedff31016dcf01 100644 (file)
@@ -161,6 +161,7 @@ struct Render
        /* samples */
        SampleTables *samples;
        float jit[32][2];
+       float mblur_jit[32][2];
        ListBase *qmcsamplers;
        
        /* shadow counter, detect shadow-reuse for shaders */
index abff8bf2655467c0af3ed73e5e8253907f1fe105..faa5f17649a94ee6beed1d864d1357d31b010127 100644 (file)
 static void init_render_jit(Render *re)
 {
        static float jit[32][2];        /* simple caching */
+       static float mblur_jit[32][2];  /* simple caching */
        static int lastjit= 0;
+       static int last_mblur_jit= 0;
        
-       if(lastjit!=re->r.osa) {
+       if(lastjit!=re->r.osa || last_mblur_jit != re->r.mblur_samples) {
                memset(jit, 0, sizeof(jit));
                BLI_initjit(jit[0], re->r.osa);
+               
+               memset(mblur_jit, 0, sizeof(mblur_jit));
+               BLI_initjit(mblur_jit[0], re->r.mblur_samples);
        }
        
        lastjit= re->r.osa;
        memcpy(re->jit, jit, sizeof(jit));
+       
+       last_mblur_jit= re->r.mblur_samples;
+       memcpy(re->mblur_jit, mblur_jit, sizeof(mblur_jit));
 }
 
 
index 4ae00c94c6aaa0473df55b17dce9f6e67dc7fa58..95e98c1861c548965606dec5497ff75fe1b5b3c8 100644 (file)
@@ -1929,20 +1929,20 @@ static void do_render_blur_3d(Render *re)
 {
        RenderResult *rres;
        float blurfac;
-       int blur= re->r.osa;
+       int blur= re->r.mblur_samples;
        
        /* create accumulation render result */
        rres= new_render_result(re, &re->disprect, 0, RR_USEMEM);
        
        /* do the blur steps */
        while(blur--) {
-               set_mblur_offs( re->r.blurfac*((float)(re->r.osa-blur))/(float)re->r.osa );
+               set_mblur_offs( re->r.blurfac*((float)(re->r.mblur_samples-blur))/(float)re->r.mblur_samples );
                
-               re->i.curblur= re->r.osa-blur;  /* stats */
+               re->i.curblur= re->r.mblur_samples-blur;        /* stats */
                
                do_render_3d(re);
                
-               blurfac= 1.0f/(float)(re->r.osa-blur);
+               blurfac= 1.0f/(float)(re->r.mblur_samples-blur);
                
                merge_renderresult_blur(rres, re->result, blurfac, re->r.alphamode & R_ALPHAKEY);
                if(re->test_break(re->tbh)) break;
index 6d67c068bddd9e394e4d4800687357438c340ae3..612c5660f68df09925146f548c7be050800ea393 100644 (file)
@@ -2070,8 +2070,8 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
                        zspan->zofsy= -pa->disprect.ymin - R.jit[pa->sample+zsample][1];
                }
                else if(R.i.curblur) {
-                       zspan->zofsx= -pa->disprect.xmin - R.jit[R.i.curblur-1][0];
-                       zspan->zofsy= -pa->disprect.ymin - R.jit[R.i.curblur-1][1];
+                       zspan->zofsx= -pa->disprect.xmin - R.mblur_jit[R.i.curblur-1][0];
+                       zspan->zofsy= -pa->disprect.ymin - R.mblur_jit[R.i.curblur-1][1];
                }
                else {
                        zspan->zofsx= -pa->disprect.xmin;
@@ -3414,7 +3414,7 @@ static int zbuffer_abuf_render(RenderPart *pa, APixstr *APixbuf, APixstrand *APi
        if(R.osa)
                jit= R.jit;
        else if(R.i.curblur)
-               jit= &R.jit[R.i.curblur-1];
+               jit= &R.mblur_jit[R.i.curblur-1];
        else
                jit= NULL;