forked from bartvdbraak/blender
Fix T44598: blender internal not giving same result on repeated texture bakes.
This commit is contained in:
parent
fb0dd596e9
commit
e73f1035d7
@ -34,6 +34,7 @@
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_rand.h"
|
||||
#include "BLI_threads.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
@ -75,6 +76,8 @@ extern struct Render R;
|
||||
|
||||
|
||||
typedef struct BakeShade {
|
||||
int thread;
|
||||
|
||||
ShadeSample ssamp;
|
||||
ObjectInstanceRen *obi;
|
||||
VlakRen *vlr;
|
||||
@ -737,6 +740,9 @@ static void bake_single_vertex(BakeShade *bs, VertRen *vert, float u, float v)
|
||||
MLoopCol *basevcol;
|
||||
MLoop *mloop;
|
||||
|
||||
/* per vertex fixed seed */
|
||||
BLI_thread_srandom(bs->thread, vert->index);
|
||||
|
||||
origindex = RE_vertren_get_origindex(bs->obi->obr, vert, 0);
|
||||
if (!origindex || *origindex == ORIGINDEX_NONE)
|
||||
return;
|
||||
@ -812,6 +818,9 @@ static void shade_tface(BakeShade *bs)
|
||||
float vec[4][2];
|
||||
int a, i1, i2, i3;
|
||||
|
||||
/* per face fixed seed */
|
||||
BLI_thread_srandom(bs->thread, vlr->index);
|
||||
|
||||
/* check valid zspan */
|
||||
if (ima != bs->ima) {
|
||||
BKE_image_release_ibuf(bs->ima, bs->ibuf, NULL);
|
||||
@ -1037,6 +1046,8 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
|
||||
|
||||
/* get the threads running */
|
||||
for (a = 0; a < re->r.threads; a++) {
|
||||
handles[a].thread = a;
|
||||
|
||||
/* set defaults in handles */
|
||||
handles[a].ssamp.shi[0].lay = re->lay;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user