[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43325] trunk/blender/source/blender/ editors/render/render_opengl.c: use render osa setting for opengl render sample count and BLI_jitter for opengl rendering (previously was hard coded at 5).

Campbell Barton ideasman42 at gmail.com
Thu Jan 12 18:04:19 CET 2012


Revision: 43325
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43325
Author:   campbellbarton
Date:     2012-01-12 17:04:09 +0000 (Thu, 12 Jan 2012)
Log Message:
-----------
use render osa setting for opengl render sample count and BLI_jitter for opengl rendering (previously was hard coded at 5).

Modified Paths:
--------------
    trunk/blender/source/blender/editors/render/render_opengl.c

Modified: trunk/blender/source/blender/editors/render/render_opengl.c
===================================================================
--- trunk/blender/source/blender/editors/render/render_opengl.c	2012-01-12 16:31:27 UTC (rev 43324)
+++ trunk/blender/source/blender/editors/render/render_opengl.c	2012-01-12 17:04:09 UTC (rev 43325)
@@ -40,6 +40,7 @@
 #include "BLI_editVert.h"
 #include "BLI_dlrbTree.h"
 #include "BLI_utildefines.h"
+#include "BLI_jitter.h"
 
 #include "DNA_scene_types.h"
 #include "DNA_object_types.h"
@@ -150,28 +151,31 @@
 		}
 		else {
 			/* simple accumulation, less hassle then FSAA FBO's */
-#			define SAMPLES 5 /* fixed, easy to have more but for now this is ok */
-			const float jit_ofs[SAMPLES][2] = {{0, 0}, {0.5f, 0.5f}, {-0.5f,-0.5f}, {-0.5f, 0.5f}, {0.5f, -0.5f}};
+			static float jit_ofs[32][2];
 			float winmat_jitter[4][4];
 			float *accum_buffer= MEM_mallocN(sizex * sizey * sizeof(float) * 4, "accum1");
 			float *accum_tmp= MEM_mallocN(sizex * sizey * sizeof(float) * 4, "accum2");
 			int j;
 
+			BLI_initjit(jit_ofs[0], scene->r.osa);
+
 			/* first sample buffer, also initializes 'rv3d->persmat' */
 			ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat);
 			GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, accum_buffer);
 
 			/* skip the first sample */
-			for(j=1; j < SAMPLES; j++) {
+			for(j=1; j < scene->r.osa; j++) {
 				copy_m4_m4(winmat_jitter, winmat);
-				window_translate_m4(winmat_jitter, rv3d->persmat, jit_ofs[j][0] / sizex, jit_ofs[j][1] / sizey);
+				window_translate_m4(winmat_jitter, rv3d->persmat,
+				                    (jit_ofs[j][0] * 2.0f) / sizex,
+				                    (jit_ofs[j][1] * 2.0f) / sizey);
 
 				ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat_jitter);
 				GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, accum_tmp);
 				add_vn_vn(accum_buffer, accum_tmp, sizex*sizey*sizeof(float));
 			}
 
-			mul_vn_vn_fl(rr->rectf, accum_buffer, sizex*sizey*sizeof(float), 1.0/SAMPLES);
+			mul_vn_vn_fl(rr->rectf, accum_buffer, sizex*sizey*sizeof(float), 1.0f / scene->r.osa);
 
 			MEM_freeN(accum_buffer);
 			MEM_freeN(accum_tmp);



More information about the Bf-blender-cvs mailing list