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.
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user