Small tweak in dithering; the noise varies around 0.0 now.
Value 'dithering' in buttons can go to '2', for extra noise. 1.0 defaults to exact 1.0/256.0 noise.
This commit is contained in:
@@ -221,7 +221,7 @@ void RE_sky_char(float *view, char *col)
|
|||||||
float f, colf[3];
|
float f, colf[3];
|
||||||
float dither_value;
|
float dither_value;
|
||||||
|
|
||||||
dither_value = (BLI_frand()*R.r.dither_intensity)/256.0;
|
dither_value = ( (BLI_frand()-0.5)*R.r.dither_intensity)/256.0;
|
||||||
|
|
||||||
RE_sky(view, colf);
|
RE_sky(view, colf);
|
||||||
f= 255.0*(colf[0]+dither_value);
|
f= 255.0*(colf[0]+dither_value);
|
||||||
@@ -2859,11 +2859,11 @@ void shadepixel_short(float x, float y, int vlaknr, int mask, unsigned short *sh
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(R.r.dither_intensity!=0.0) {
|
if(R.r.dither_intensity!=0.0) {
|
||||||
short dither_value = (short)(BLI_frand()*R.r.dither_intensity*256.0);
|
short dither_value = (short)((BLI_frand() -.5)*R.r.dither_intensity*256.0);
|
||||||
/* no dither for color 254/255, is OK. intensity is <= 2.0 */
|
/* no dither for color 0 or 255, is OK. intensity is <= 2.0 */
|
||||||
if( shortcol[0] < 65000) shortcol[0]+= dither_value;
|
if(shortcol[0]>255 || shortcol[0] < 65280) shortcol[0]+= dither_value;
|
||||||
if( shortcol[1] < 65000) shortcol[1]+= dither_value;
|
if(shortcol[1]>255 || shortcol[1] < 65280) shortcol[1]+= dither_value;
|
||||||
if( shortcol[2] < 65000) shortcol[2]+= dither_value;
|
if(shortcol[2]>255 || shortcol[2] < 65280) shortcol[2]+= dither_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1346,7 +1346,7 @@ void std_transFloatColV2CharColV( RE_COLBUFTYPE *buf, char *target)
|
|||||||
float fval;
|
float fval;
|
||||||
float dither_value;
|
float dither_value;
|
||||||
|
|
||||||
dither_value = (BLI_frand()*R.r.dither_intensity)/256.0;
|
dither_value = ((BLI_frand()-0.5)*R.r.dither_intensity)/256.0;
|
||||||
|
|
||||||
/* alpha */
|
/* alpha */
|
||||||
if((buf[3]+dither_value)<=0.0) target[3]= 0;
|
if((buf[3]+dither_value)<=0.0) target[3]= 0;
|
||||||
|
|||||||
@@ -1040,7 +1040,7 @@ static void render_panel_output(void)
|
|||||||
uiDefButS(block, TOG|BIT|4, 0, "Extensions", 250, 10, 60, 20, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Adds extensions to the output when rendering animations");
|
uiDefButS(block, TOG|BIT|4, 0, "Extensions", 250, 10, 60, 20, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Adds extensions to the output when rendering animations");
|
||||||
|
|
||||||
/* Dither control */
|
/* Dither control */
|
||||||
uiDefButF(block, NUM,B_DIFF, "Dither:", 205,31,105,19, &G.scene->r.dither_intensity, 0.0, 1.0, 0, 0, "The amount of dithering noise present in the output image (0.0 = no dithering)");
|
uiDefButF(block, NUM,B_DIFF, "Dither:", 205,31,105,19, &G.scene->r.dither_intensity, 0.0, 2.0, 0, 0, "The amount of dithering noise present in the output image (0.0 = no dithering)");
|
||||||
|
|
||||||
/* Toon shading buttons */
|
/* Toon shading buttons */
|
||||||
uiBlockBeginAlign(block);
|
uiBlockBeginAlign(block);
|
||||||
|
|||||||
Reference in New Issue
Block a user