Bugfix
[#6861] Black dots when using small lamps on Mirror materials in 2.44 and 2.43. some values were not initialized properly, for example, the window coordinates for reflections, this caused NAN color values for some pixels, (may also fix plumiferos bad pixel problem from last bconf)
This commit is contained in:
@@ -2148,8 +2148,16 @@ static void displace_render_face(Render *re, VlakRen *vlr, float *scale)
|
||||
{
|
||||
ShadeInput shi;
|
||||
|
||||
/* Warning, This is not that nice, and possibly a bit slow,
|
||||
however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */
|
||||
memset(&shi, 0, sizeof(ShadeInput));
|
||||
/* end warning! - Campbell */
|
||||
|
||||
/* set up shadeinput struct for multitex() */
|
||||
shi.osatex= 0; /* signal not to use dx[] and dy[] texture AA vectors */
|
||||
|
||||
/* memset above means we dont need this */
|
||||
/*shi.osatex= 0;*/ /* signal not to use dx[] and dy[] texture AA vectors */
|
||||
|
||||
shi.vlr= vlr; /* current render face */
|
||||
shi.mat= vlr->mat; /* current input material */
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "BLI_arithb.h"
|
||||
|
||||
/* External modules: */
|
||||
@@ -130,6 +131,12 @@ static void render_lighting_halo(HaloRen *har, float *colf)
|
||||
|
||||
if(lar->mode & LA_TEXTURE) {
|
||||
ShadeInput shi;
|
||||
|
||||
/* Warning, This is not that nice, and possibly a bit slow,
|
||||
however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */
|
||||
memset(&shi, 0, sizeof(ShadeInput));
|
||||
/* end warning! - Campbell */
|
||||
|
||||
VECCOPY(shi.co, rco);
|
||||
shi.osatex= 0;
|
||||
do_lamp_tex(lar, lv, &shi, lacol);
|
||||
|
||||
@@ -409,6 +409,11 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo
|
||||
float ref[3], maxsize=RE_ray_tree_max_size(R.raytree);
|
||||
float dist_mir = origshi->mat->dist_mir;
|
||||
|
||||
/* Warning, This is not that nice, and possibly a bit slow for every ray,
|
||||
however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */
|
||||
memset(&shi, 0, sizeof(ShadeInput));
|
||||
/* end warning! - Campbell */
|
||||
|
||||
VECCOPY(isec.start, start);
|
||||
if (dist_mir > 0.0) {
|
||||
isec.end[0]= start[0]+dist_mir*vec[0];
|
||||
@@ -430,13 +435,13 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo
|
||||
shi.osatex= origshi->osatex;
|
||||
shi.depth= 1; /* only used to indicate tracing */
|
||||
shi.thread= origshi->thread;
|
||||
shi.sample= 0;
|
||||
//shi.sample= 0; // memset above, so dont need this
|
||||
shi.xs= origshi->xs;
|
||||
shi.ys= origshi->ys;
|
||||
shi.lay= origshi->lay;
|
||||
shi.passflag= SCE_PASS_COMBINED; /* result of tracing needs no pass info */
|
||||
shi.combinedflag= 0xFFFFFF; /* ray trace does all options */
|
||||
shi.do_preview= 0;
|
||||
//shi.do_preview= 0; // memset above, so dont need this
|
||||
shi.light_override= origshi->light_override;
|
||||
shi.mat_override= origshi->mat_override;
|
||||
|
||||
@@ -1231,16 +1236,22 @@ static void ray_trace_shadow_tra(Isect *is, int depth, int traflag)
|
||||
float d= 1.0f;
|
||||
/* we got a face */
|
||||
|
||||
/* Warning, This is not that nice, and possibly a bit slow for every ray,
|
||||
however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */
|
||||
memset(&shi, 0, sizeof(ShadeInput));
|
||||
/* end warning! - Campbell */
|
||||
|
||||
shi.depth= 1; /* only used to indicate tracing */
|
||||
shi.mask= 1;
|
||||
shi.osatex= 0;
|
||||
|
||||
/*shi.osatex= 0;
|
||||
shi.thread= shi.sample= 0;
|
||||
shi.lay= 0;
|
||||
shi.passflag= 0;
|
||||
shi.combinedflag= 0;
|
||||
shi.do_preview= 0;
|
||||
shi.light_override= NULL;
|
||||
shi.mat_override= NULL;
|
||||
shi.mat_override= NULL;*/
|
||||
|
||||
shade_ray(is, &shi, &shr);
|
||||
if (traflag & RAY_TRA)
|
||||
@@ -1300,6 +1311,12 @@ int ray_trace_shadow_rad(ShadeInput *ship, ShadeResult *shr)
|
||||
|
||||
if(RE_ray_tree_intersect(R.raytree, &isec)) {
|
||||
float fac;
|
||||
|
||||
/* Warning, This is not that nice, and possibly a bit slow for every ray,
|
||||
however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */
|
||||
memset(&shi, 0, sizeof(ShadeInput));
|
||||
/* end warning! - Campbell */
|
||||
|
||||
shade_ray(&isec, &shi, &shr_t);
|
||||
fac= isec.labda*isec.labda;
|
||||
fac= 1.0f;
|
||||
|
||||
@@ -296,7 +296,7 @@ static void lamphalo_tile(RenderPart *pa, RenderLayer *rl)
|
||||
long *rd= pa->rectdaps;
|
||||
int x, y, *rz= pa->rectz;
|
||||
|
||||
shade_input_initialize(&shi, pa, rl, 0);
|
||||
shade_input_initialize(&shi, pa, rl, 0); /* this zero's ShadeInput for us */
|
||||
|
||||
for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
|
||||
for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, rz++, pass+=4) {
|
||||
|
||||
@@ -1187,7 +1187,9 @@ void shade_input_set_shade_texco(ShadeInput *shi)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* else {
|
||||
Note! For raytracing winco is not set, important because thus means all shader input's need to have their variables set to zero else in-initialized values are used
|
||||
*/
|
||||
}
|
||||
|
||||
/* ****************** ShadeSample ************************************** */
|
||||
|
||||
Reference in New Issue
Block a user