POV-Ray : Newsgroups : povray.binaries.images : Dithered Output Server Time
31 Jul 2024 00:34:57 EDT (-0400)
  Dithered Output (Message 1 to 8 of 8)  
From: clipka
Subject: Dithered Output
Date: 4 Dec 2010 09:29:22
Message: <4cfa5042@news.povray.org>
Okay, so I could no longer keep my restless fingers under control... 
here it is, dithered output directly from POV-Ray.

To showcase the effect, I chose a bit depth of 5 bit (the lowest you can 
get with PNG), but the algorithm works perfectly fine with other bit 
depths as well.

First image shows the original in 8 bit (no dithering applied; if you 
look /very/ closely, you may still see some banding in the sky). All 
other images use 5 bits per colour channel:

(off) 5 bit image without dithering (I guess I don't need to mention the 
banding).

(b2) Bayes dithering using a 2x2 pattern

(b4) Bayes dithering using a 4x4 pattern

(d1) 1-dimensional error diffusion dithering (propagating all the error 
to the next pixel to the right)

(d2) 2-dimensional error diffusion dithering (propagating half of the 
error to the next pixel to the right, and a quarter, respectively, to 
the pixels below and below right)

(fs) the famous Floyd-Steinberg dithering (another error diffusion 
dithering)

I didn't bother to implement random dithering, as I don't think it gives 
real added value at the bit depths typically used. (b2), (b4) and (d1) 
have the advantage of using (almost) no additional memory (I implemented 
(d2) and (fs) using an additional 2-pixel-row buffer to avoid messing 
with the original data), while (fs) probably gives the best results. 
I'll probably drop (d2) as it doesn't seem to add much value either.

A point I'd like to emphasize is that I implemented the diffusion 
dithering methods to propagate the error /before/ gamma 
encoding/pre-correction. (One reason why dithered black-and-white images 
typically lose quite some "depth" is that they are implemented without 
attention to gamma.) Not that it will probably matter much with the 
typical bit depths, but you know - I just had to do this right ;-)


Post a reply to this message


Attachments:
Download 'dither_off_8bit.png' (129 KB) Download 'dither_off.png' (80 KB) Download 'dither_b2.png' (113 KB) Download 'dither_b4.png' (132 KB) Download 'dither_d1.png' (299 KB) Download 'dither_d2.png' (326 KB) Download 'dither_fs.png' (331 KB)

Preview of image 'dither_off_8bit.png'
dither_off_8bit.png

Preview of image 'dither_off.png'
dither_off.png

Preview of image 'dither_b2.png'
dither_b2.png

Preview of image 'dither_b4.png'
dither_b4.png

Preview of image 'dither_d1.png'
dither_d1.png

Preview of image 'dither_d2.png'
dither_d2.png

Preview of image 'dither_fs.png'
dither_fs.png


 

From: Jim Holsenback
Subject: Re: Dithered Output
Date: 4 Dec 2010 12:09:35
Message: <4cfa75cf$1@news.povray.org>
On 12/04/2010 10:28 AM, clipka wrote:
> Okay, so I could no longer keep my restless fingers under control...
> here it is, dithered output directly from POV-Ray.

ha-ha ... what coding machines you guys are! between you and Le Forgeron
i'm having a time of it keeping up ;-) btw: nice!


Post a reply to this message

From: "Jérôme M. Berger"
Subject: Re: Dithered Output
Date: 4 Dec 2010 13:43:27
Message: <4cfa8bcf@news.povray.org>
clipka wrote:
> (b2) Bayes dithering using a 2x2 pattern
> 
> (b4) Bayes dithering using a 4x4 pattern
> 
	I assume you meant "Bayer"?

	You probably already know it, but for others who may not here are a
couple of points to keep in mind:
 - Dithering may cause very visible moire artifacts when the images
are printed;
 - There is probably no point in using this if you intend to convert
your images to JPEG since the conversion will cause fine details
like the dither pattern to disappear anyway...

		Jerome
-- 
mailto:jeb### [at] freefr
http://jeberger.free.fr
Jabber: jeb### [at] jabberfr


Post a reply to this message


Attachments:
Download 'us-ascii' (1 KB)

From: Le Forgeron
Subject: Re: Dithered Output
Date: 4 Dec 2010 13:51:41
Message: <4cfa8dbd$1@news.povray.org>
Le 04/12/2010 18:09, Jim Holsenback nous fit lire :
> On 12/04/2010 10:28 AM, clipka wrote:
>> Okay, so I could no longer keep my restless fingers under control...
>> here it is, dithered output directly from POV-Ray.
> 
> ha-ha ... what coding machines you guys are! between you and Le Forgeron
> i'm having a time of it keeping up ;-) btw: nice!

Hopefully for you, I have finished my documentation updates today and as
I have to get my main computer off for unknown time (memory issue: one
component is dead, must return all of them... ), you will be safe from
my coding for some time. (from coding, not other participations)

I hope we can all test & validate most issues soon (at least the
non-windows' ones).
(I think I will, personally, postpone any change for fs#9 to the solving
of the gamma handling; It should not stop anyone from doing it if you
can, it's just that it is more and more looking like a photoshop rather
than a renderer and I wonder more and more about that a bit.)

fs#170 is the last one really bothering me so far, but I have no clue.


Post a reply to this message

From: clipka
Subject: Re: Dithered Output
Date: 4 Dec 2010 13:54:10
Message: <4cfa8e52$1@news.povray.org>
Am 04.12.2010 19:43, schrieb "Jérôme M. Berger":
> clipka wrote:
>> (b2) Bayes dithering using a 2x2 pattern
>>
>> (b4) Bayes dithering using a 4x4 pattern
>>
> 	I assume you meant "Bayer"?

Oops, yes - I've been struggling with that name the whole day ;-)

> 	You probably already know it, but for others who may not here are a
> couple of points to keep in mind:
>   - Dithering may cause very visible moire artifacts when the images
> are printed;

Hm, I didn't think of that. Actually I'd expect it to improve print quality.
I also guess it depends on the dithering algorithm; maybe that's where a 
benefit of random dithering can be found? Printers should be quite 
immune to random noise in images to be printed I guess.

>   - There is probably no point in using this if you intend to convert
> your images to JPEG since the conversion will cause fine details
> like the dither pattern to disappear anyway...

JPEG and OpenEXR output will not support dithering (nor will Radiance 
HDR for the time being - though it could be of use there - as it is not 
as straightforward as with classic low dynamic range images).


Post a reply to this message

From: scott
Subject: Re: Dithered Output
Date: 6 Dec 2010 08:25:23
Message: <4cfce443@news.povray.org>
> Okay, so I could no longer keep my restless fingers under control...
> here it is, dithered output directly from POV-Ray.

I remember I asked for this two years ago as an idea for POV4 (at the time I 
had a sky scene that gave horrible banding and had to do it "by hand"). 
Great work getting it in 3.7 :-)


Post a reply to this message

From: "Jérôme M. Berger"
Subject: Re: Dithered Output
Date: 6 Dec 2010 15:10:25
Message: <4cfd4331$1@news.povray.org>
clipka wrote:
> Am 04.12.2010 19:43, schrieb "Jérôme M. Berger":
>>     You probably already know it, but for others who may not here are 
a
>> couple of points to keep in mind:
>>   - Dithering may cause very visible moire artifacts when the images
>> are printed;
> 
> Hm, I didn't think of that. Actually I'd expect it to improve print
> quality.
> I also guess it depends on the dithering algorithm; maybe that's where 
a
> benefit of random dithering can be found? Printers should be quite
> immune to random noise in images to be printed I guess.
> 
	The problem is that the printer will also use a dither algorithm
when printing and you can have unwanted interactions between the
two. However, since you implemented both Bayer dithering and error
diffusion it should be possible to avoid the issues by choosing the
other method than the printer. However, this is something to keep in
mind when rendering because you don't want to realize you made the
wrong choice after a one week high resolution render ;)

		Jerome
-- 
mailto:jeb### [at] freefr
http://jeberger.free.fr
Jabber: jeb### [at] jabberfr


Post a reply to this message


Attachments:
Download 'us-ascii' (1 KB)

From: leTigreBleu
Subject: Re: Dithered Output
Date: 8 Dec 2010 16:45:00
Message: <web.4cfffa33fd5e50d9a5e507bf0@news.povray.org>
Good evening,
You may want to test another dithering algorithm: its is entitled "A Simple and
Efficient Error-Diffusion Algorithm" and it is available on this web page:
http://www.iro.umontreal.ca/~ostrom/publications/abstracts.html

A source code is also provided. (There are also more recent publications about
error diffusion on the same page).

Another recent work that I am aware of, with some pictures to have an idea of
the result:
http://people.scs.carleton.ca/~hli1/publication/Contrast-Aware-Halftoning/CAHalftoning.htm

As mentioned by other people, I would suggest to avoid the "it took 3 days to
render and I have used the wrong dither method" effect. My proposals are:
1. If the user wants a dithered output, then POV-Ray outputs the original image
AND ALL the dithered images (using ALL the available algorithms). It would be up
to the user to select the one the user likes. A "more than 8 bits per component"
image would always be saved "just in case".
2. Add the dither as a postprocessing step, for instance calling POV-Ray with a
"--dither" argument. It would process an existing picture, and it would not
render anything new.

I hope this helps,
Lionel


=?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger@free.fr> wrote:
> clipka wrote:
> > Am 04.12.2010 19:43, schrieb "Jérôme M. Berger":
> >>     You probably already know it, but for others who may not here are
> a
> >> couple of points to keep in mind:
> >>   - Dithering may cause very visible moire artifacts when the images
> >> are printed;
> >
> > Hm, I didn't think of that. Actually I'd expect it to improve print
> > quality.
> > I also guess it depends on the dithering algorithm; maybe that's where
> a
> > benefit of random dithering can be found? Printers should be quite
> > immune to random noise in images to be printed I guess.
> >
>  The problem is that the printer will also use a dither algorithm
> when printing and you can have unwanted interactions between the
> two. However, since you implemented both Bayer dithering and error
> diffusion it should be possible to avoid the issues by choosing the
> other method than the printer. However, this is something to keep in
> mind when rendering because you don't want to realize you made the
> wrong choice after a one week high resolution render ;)
>
>   Jerome
> --
> mailto:jeb### [at] freefr
> http://jeberger.free.fr
> Jabber: jeb### [at] jabberfr


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.