[Bf-committers] Dithering

Goran Kocov gkocov at yahoo.com
Tue Nov 2 01:40:34 CET 2004


I noticed a couple of problems with the changes made
to the dithering code in shadepixel_short()
(rendercore.c): 

- I'm not sure about this (lack of experience with
C/C++), but I think that the dither_value should be of
signed short type, not just short (short goes from 0
to 65535, so it can't have negative values, right?). 

- The if statements should use the && (AND) operator,
not the II (OR) operator (using OR resulted in serious
underflows and overflows).

Here's a patch correcting the problems: 

http://www.geocities.com/gkocov/misc/rendercore.patch.txt

--- Ton Roosendaal <ton at blender.org> wrote:
> - You applied the dither in the old renderer before
> color was gamma  
> corrected. That results in total loss of the dither
> then. I've added it  
> after, and nicely with shorts.

Are you certain about this? I tested my dithering code
that adds the dithering before the gamma correction
and I'm pretty sure there's no loss of the dithering.
I mention this because the noise artifacts are much
more noticable now that the dithering is applied after
the color values are converted from float to short, so
I think it would be better to use the old calculation.


Goran



		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 



More information about the Bf-committers mailing list