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:
authorTon Roosendaal <ton@blender.org>2004-12-19 21:18:54 +0300
committerTon Roosendaal <ton@blender.org>2004-12-19 21:18:54 +0300
commit302dc94b7aed7cb5abac375df8c41bbc6ef02613 (patch)
treedccaae77603697f888e16d0bd0bc0e11e8a2c5ac
parentadd84ea301ab842584a37921f9d130587063c6c3 (diff)
Fix for #2034
It appeared that the method as used in unified render for "render all sub- pixels" isn't very well resistant to having large amounts of faces in a single pixel. The bug file had about 16x70x2 faces per pixel... causing tremendous slowdown and even wrong render. I've disabled the option (was coded by Nzc in NaN days) and made it sampling in the main render loop. Goes much faster, error free. Only loss is in that it doesnt use superiour subsamples for gauss anymore. Here the normal render performs slightly better. Not a real issue though. Hard to notice.
-rw-r--r--source/blender/render/intern/source/vanillaRenderPipe.c47
-rw-r--r--source/blender/render/intern/source/zbufferdatastruct.c7
2 files changed, 39 insertions, 15 deletions
diff --git a/source/blender/render/intern/source/vanillaRenderPipe.c b/source/blender/render/intern/source/vanillaRenderPipe.c
index 659be7265f1..6745d58aacb 100644
--- a/source/blender/render/intern/source/vanillaRenderPipe.c
+++ b/source/blender/render/intern/source/vanillaRenderPipe.c
@@ -424,7 +424,7 @@ static int VR_cbuf[RE_MAX_FACES_PER_PIXEL][2];
int composeStack(int zrow[RE_MAX_FACES_PER_PIXEL][RE_PIXELFIELDSIZE],
struct RE_faceField* stack, int ptr,
int totvlak, float x, float y, int osaNr) {
-
+ VlakRen *vlr= NULL;
float xs = 0.0;
float ys = 0.0; /* coordinates for the render-spot */
@@ -438,6 +438,7 @@ int composeStack(int zrow[RE_MAX_FACES_PER_PIXEL][RE_PIXELFIELDSIZE],
int Cthresh = 0;
int save_totvlak = totvlak;
int fullsubpixelflags = 0;
+ int full_osa;
VR_covered = 0;
for(i = 0; i < osaNr; i++) alphathreshold[i] = 0.0;
@@ -446,16 +447,44 @@ int composeStack(int zrow[RE_MAX_FACES_PER_PIXEL][RE_PIXELFIELDSIZE],
while ( (!saturated || (saturated && inconflict) ) && (totvlak > 0) ) {
totvlak--;
- i= centmask[ zrow[totvlak][RE_MASK] ]; /* recenter sample position - */
- xs= (float)x+centLut[i & 15];
- ys= (float)y+centLut[i >> 4];
-
- /* stack face ----------- */
- stack[ptr].mask = zrow[totvlak][RE_MASK];
- stack[ptr].data = renderPixel(xs, ys, zrow[totvlak], stack[ptr].mask);
+ full_osa= 0;
+ if(R.osa && (zrow[totvlak][RE_TYPE] & RE_POLY)) {
+ vlr= RE_findOrAddVlak((zrow[totvlak][RE_INDEX]-1) & 0x7FFFFF);
+ if(vlr->flag & R_FULL_OSA) full_osa= 1;
+ }
+
+ if(full_osa) {
+ float div=0.0, accol[4]={0.0, 0.0, 0.0, 0.0};
+ int a, mask= zrow[totvlak][RE_MASK];
+
+ for(a=0; a<R.osa; a++) {
+ if(mask & (1<<a)) {
+ xs= (float)x + jit[a][0];
+ ys= (float)y + jit[a][1];
+ renderPixel(xs, ys, zrow[totvlak], 1<<a);
+ accol[0] += collector[0]; accol[1] += collector[1]; accol[2] += collector[2]; accol[3] += collector[3];
+ div+= 1.0;
+ }
+ }
+ if(div!=0.0) {
+ div= 1.0/div;
+ collector[0]= accol[0]*div; collector[1]= accol[1]*div; collector[2]= accol[2]*div; collector[3]= accol[3]*div;
+ }
+ stack[ptr].mask= mask;
+ stack[ptr].data= vlr;
+ }
+ else {
+ i= centmask[ zrow[totvlak][RE_MASK] ]; /* recenter sample position - */
+ xs= (float)x+centLut[i & 15];
+ ys= (float)y+centLut[i >> 4];
+
+ /* stack face ----------- */
+ stack[ptr].mask = zrow[totvlak][RE_MASK];
+ stack[ptr].data = renderPixel(xs, ys, zrow[totvlak], stack[ptr].mask);
+ }
stack[ptr].faceType = zrow[totvlak][RE_TYPE];
cpFloatColV(collector, stack[ptr].colour);
-
+
/* This is done so that spothalos are properly overlayed on halos */
/* maybe we need to check the colour here... */
if(zrow[totvlak][RE_TYPE] & RE_POLY) VR_covered |= zrow[totvlak][RE_MASK];
diff --git a/source/blender/render/intern/source/zbufferdatastruct.c b/source/blender/render/intern/source/zbufferdatastruct.c
index aed5f5bf97d..78a5d29487e 100644
--- a/source/blender/render/intern/source/zbufferdatastruct.c
+++ b/source/blender/render/intern/source/zbufferdatastruct.c
@@ -70,7 +70,7 @@
/* if defined: all jittersamples are stored individually. _very_ serious */
/* performance hit ! also gives some buffer size problems in big scenes */
-// #define RE_INDIVIDUAL_SUBPIXELS
+#define RE_INDIVIDUAL_SUBPIXELS
/* ------------------------------------------------------------------------- */
@@ -185,11 +185,6 @@ void insertObject(int apteller,
RE_APixstrExt* apn = &APixbufExt[apteller];
int all_subpixels= 0;
- if(obtype==RE_POLY) {
- VlakRen *vlr= RE_findOrAddVlak( (obindex-1) & 0x7FFFFF);
- if(vlr->flag & R_FULL_OSA) all_subpixels= 1;
- }
-
while(apn) {
if(apn->t[0] == RE_NONE) {
apn->p[0] = obindex; apn->t[0] = obtype;