Bugfix, own collection:
Random seeding is still not perfect in render, especially lack of good thread support still. - VectorBlur node was calling seed for each exec, causing other nodes to get fixed random too. - added seed in non-OSA main loop for render - use BLI_srandom, is better than BLI_srand
This commit is contained in:
@@ -1640,7 +1640,7 @@ static void do_render_composite_fields_blur_3d(Render *re)
|
||||
bNodeTree *ntree= re->scene->nodetree;
|
||||
|
||||
/* INIT seeding, compositor can use random texture */
|
||||
BLI_srand(re->r.cfra);
|
||||
BLI_srandom(re->r.cfra);
|
||||
|
||||
if(composite_needs_render(re->scene)) {
|
||||
/* save memory... free all cached images */
|
||||
|
||||
@@ -3026,7 +3026,7 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
|
||||
od= offs;
|
||||
|
||||
for(x=pa->disprect.xmin+crop; x<pa->disprect.xmax-crop; x++, rd++, rf+=4, od++) {
|
||||
BLI_thread_srandom(pa->thread, seed+x);
|
||||
BLI_thread_srandom(pa->thread, seed++);
|
||||
|
||||
ps= (PixStr *)(*rd);
|
||||
mask= 0;
|
||||
@@ -3098,7 +3098,6 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
|
||||
rectf+= 4*pa->rectx;
|
||||
rectdaps+= pa->rectx;
|
||||
offs+= pa->rectx;
|
||||
seed+= pa->rectx;
|
||||
|
||||
if(y&1) if(R.test_break()) break;
|
||||
}
|
||||
@@ -3368,7 +3367,10 @@ void zbufshade_tile(RenderPart *pa)
|
||||
|
||||
if(rl->layflag & SCE_LAY_SOLID) {
|
||||
float *fcol= rl->rectf;
|
||||
int x, y, *rp= pa->rectp, *rz= pa->rectz, offs=0;
|
||||
int x, y, *rp= pa->rectp, *rz= pa->rectz, offs=0, seed;
|
||||
|
||||
/* we set per pixel a fixed seed, for random AO and shadow samples */
|
||||
seed= pa->rectx*pa->disprect.ymin;
|
||||
|
||||
/* irregular shadowb buffer creation */
|
||||
if(R.r.mode & R_SHADOW)
|
||||
@@ -3376,6 +3378,8 @@ void zbufshade_tile(RenderPart *pa)
|
||||
|
||||
for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++, rr->renrect.ymax++) {
|
||||
for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, rz++, rp++, fcol+=4, offs++) {
|
||||
BLI_thread_srandom(pa->thread, seed++);
|
||||
|
||||
shadepixel_sky(&shpi, (float)x, (float)y, *rz, *rp, 0);
|
||||
QUATCOPY(fcol, shpi.shr.combined);
|
||||
|
||||
|
||||
@@ -2237,12 +2237,13 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
|
||||
{
|
||||
ZSpan zspan;
|
||||
DrawBufPixel *rectdraw, *dr;
|
||||
float jit[16][2];
|
||||
static float jit[16][2];
|
||||
float v1[3], v2[3], v3[3], v4[3], fx, fy;
|
||||
float *rectvz, *dvz, *dimg, *dvec1, *dvec2, *dz1, *dz2, *rectz, *minvecbufrect= NULL;
|
||||
float maxspeedsq= (float)nbd->maxspeed*nbd->maxspeed;
|
||||
int y, x, step, maxspeed=nbd->maxspeed, samples= nbd->samples;
|
||||
int tsktsk= 0;
|
||||
static int firsttime= 1;
|
||||
char *rectmove, *dm;
|
||||
|
||||
zbuf_alloc_span(&zspan, xsize, ysize);
|
||||
@@ -2420,8 +2421,11 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
|
||||
|
||||
antialias_tagbuf(xsize, ysize, rectmove);
|
||||
|
||||
BLI_initjit(jit[0], 16);
|
||||
|
||||
/* has to become static, the init-jit calls a random-seed, screwing up texture noise node */
|
||||
if(firsttime) {
|
||||
firsttime= 0;
|
||||
BLI_initjit(jit[0], 16);
|
||||
}
|
||||
|
||||
/* accumulate */
|
||||
samples/= 2;
|
||||
|
||||
Reference in New Issue
Block a user