POV-Ray : Newsgroups : povray.binaries.images : How to avoid concentric rings with spot light on flat surface Server Time
30 Apr 2024 01:21:21 EDT (-0400)
  How to avoid concentric rings with spot light on flat surface (Message 5 to 14 of 14)  
<<< Previous 4 Messages Goto Initial 10 Messages
From: clipka
Subject: Re: How to avoid concentric rings with spot light on flat surface
Date: 6 Nov 2017 08:08:15
Message: <5a005ebf@news.povray.org>
Am 05.11.2017 um 23:36 schrieb clipka:
> As a side note, the `+th` switch also enables dithering for the preview
> window, but the algorithm used there may differ from the one used in
> file output.

Just noticed that I have to correct myself: Preview is always dithered.


Post a reply to this message

From: cbpypov
Subject: Re: How to avoid concentric rings with spot light on flat surface
Date: 6 Nov 2017 08:30:03
Message: <web.5a0062da3541f8ac80db62550@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 05.11.2017 um 23:36 schrieb clipka:
> > As a side note, the `+th` switch also enables dithering for the preview
> > window, but the algorithm used there may differ from the one used in
> > file output.
>
> Just noticed that I have to correct myself: Preview is always dithered.

Yes, I noticed that.

And I have to correct myself to: the dithering is fine, but when rendering the
MP4 the effect comes back again (to a limited extent, though). Moreover, it
ruins text rendering :( So this would enforce to render the text separately,
which I don't want to do. So obviously I have to find a different solution.
Maybe I'll just change the intro scene to not show the flat silicon...

See the attachment for a short example.


Post a reply to this message


Attachments:
Download 'phc_movie_midq.mp4.mpg' (3730 KB)

From: clipka
Subject: Re: How to avoid concentric rings with spot light on flat surface
Date: 6 Nov 2017 09:12:27
Message: <5a006dcb$1@news.povray.org>
Am 06.11.2017 um 10:50 schrieb cbpypov:

> However, the dithering works great, as you suggested. BUT, only if PNG output
> format is used (JPEG stays almost unchanged!), and only using the
> Floyd-Steinberg. The Bayer dithering even increases the problem! Unfortunately,
> the Floyd-version increases the PNG file size to 1.2 MB per frame in Full HD. So
> it will be quite large if I render 5 minutes at 30 frames/s ;) But I'm fine with
> it...

Well, without dithering you do have less entropy in the image, so it can
be compressed more strongly without loss.

As for not giving an advantage with JPEG, that's intentional: Dithering
is high-frequency low-amplitude noise, which is exactly the type of
signal JPEG compression tends to throw away. With POV-Ray's standard
JPEG quality settings you wouldn't see a difference between an image
that had dithering applied and an image that didn't. You'd need
top-quality settings, at which image size probably wouldn't differ much
from a PNG. Therefore, JPEG output currently doesn't support dithering
at all (though I might change that).

Please elaborate why you say the Bayer dithering "increases" the
problem. In my own experiments I do still see concentric artifacts (*),
but IMO they're less obvious than without dithering.


(*) My guess is that this is due to gamma issues. I knew this could
theoretically be a problem, but I never thought it would be noticeable
at 8 bits per colour channel. I did already work around this issue for
the dithering algorithms based on error diffusion (such as
Floyd-Steinberg) because it was comparatively easy to solve there, but I
guess it would be quite difficult to adapt a purely pattern-based
algorithm (such as Bayer) to be equally "gamma-neutral" (except for the
special case where output is 1 bit per colour channel).


Post a reply to this message

From: clipka
Subject: Re: How to avoid concentric rings with spot light on flat surface
Date: 6 Nov 2017 09:18:56
Message: <5a006f50$1@news.povray.org>
Am 06.11.2017 um 15:12 schrieb clipka:
> As for not giving an advantage with JPEG, that's intentional: Dithering
> is high-frequency low-amplitude noise, which is exactly the type of
> signal JPEG compression tends to throw away. With POV-Ray's standard
> JPEG quality settings you wouldn't see a difference between an image
> that had dithering applied and an image that didn't. You'd need
> top-quality settings, at which image size probably wouldn't differ much
> from a PNG. Therefore, JPEG output currently doesn't support dithering
> at all (though I might change that).

As another side note, I guess passing the image data to the JPEG library
at a higher bit depth might also be able to work around the colour
banding, without requiring increased JPEG quality settings. However,
this would require compiling a custom version of the JPEG library; also,
the banding might be re-introduced later in the toolchain, depending on
viewing / post-processing software.


Post a reply to this message

From: clipka
Subject: Re: How to avoid concentric rings with spot light on flat surface
Date: 6 Nov 2017 11:59:15
Message: <5a0094e3@news.povray.org>
Am 06.11.2017 um 14:25 schrieb cbpypov:

> And I have to correct myself to: the dithering is fine, but when rendering the
> MP4 the effect comes back again (to a limited extent, though).

Yes, mpeg tends to do that, for precisely the same reason as jpeg.

> Moreover, it ruins text rendering :(

Dithering or mp4?
How so?


Post a reply to this message

From: cbpypov
Subject: Re: How to avoid concentric rings with spot light on flat surface
Date: 6 Nov 2017 14:55:00
Message: <web.5a00bd373541f8ac80db62550@news.povray.org>
I'll try to give you a substantiated answer tomorrow ... sorry I can't manage
today.


Post a reply to this message

From: cbpypov
Subject: Re: How to avoid concentric rings with spot light on flat surface
Date: 7 Nov 2017 16:40:02
Message: <web.5a02282a3541f8acf6c3a3ce0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
>
> As for not giving an advantage with JPEG, that's intentional: Dithering
> is high-frequency low-amplitude noise, which is exactly the type of
> signal JPEG compression tends to throw away. With POV-Ray's standard
> JPEG quality settings you wouldn't see a difference between an image
> that had dithering applied and an image that didn't. You'd need
> top-quality settings, at which image size probably wouldn't differ much
> from a PNG. Therefore, JPEG output currently doesn't support dithering
> at all (though I might change that).
>

Thanks for reminding me of this :) Another way of explaining this (which I'd
prefer) is that JPEG basically uses a Fourier transform, cuts at a specified
frequency (depending on the quality setting) and transforms back. Dithering
noise is of course high-frequency, causing it to be cut off. This is moreover
done separately for gray-scale and color information, as a stronger color
compression is usually not noticed by the human eye :) The latter fact causes
the chromatic noise.

I think implementing the dithering for JPEG would be labor lost. Having a
"guide" on how to achieve a good dithering using PNG output, and maybe info on
what the user needs to consider with MPEG to not restore the artifacts might be
much more useful.

> Please elaborate why you say the Bayer dithering "increases" the
> problem. In my own experiments I do still see concentric artifacts (*),
> but IMO they're less obvious than without dithering.
>

Somehow I couldn't reproduce this today, so please cancel what I said. I think
it was because I still had JPEG output enabled plus some pseudo-artifacts which
were only in my head ;)

>>
>> Moreover, it ruins text rendering :(
>Dithering or mp4?
>How so?
>

I was using a quite high setting of antialiasing to get a sharp text (for title,
subtitles and such). It is created directly in POV-Ray. But with the dithering
there is of course a noticable noise at the edges of the latters, which is
moreover not constant from frame to frame. In consequence I think dithering can
generally not be used when rendering the text directly in POV-Ray. Am I wrong?


Post a reply to this message

From: clipka
Subject: Re: How to avoid concentric rings with spot light on flat surface
Date: 7 Nov 2017 19:29:43
Message: <5a024ff7$1@news.povray.org>
Am 07.11.2017 um 22:39 schrieb cbpypov:
> Thanks for reminding me of this :) Another way of explaining this (which I'd
> prefer) is that JPEG basically uses a Fourier transform, cuts at a specified
> frequency (depending on the quality setting) and transforms back. Dithering
> noise is of course high-frequency, causing it to be cut off. This is moreover
> done separately for gray-scale and color information, as a stronger color
> compression is usually not noticed by the human eye :) The latter fact causes
> the chromatic noise.

Actually POV-Ray chooses to not use chroma subsampling in JPEG output.

> I think implementing the dithering for JPEG would be labor lost.

Not really. When I implemented dithering support, I concocted a nice
little framework for it; enabling it for JPEG output would essentially
be a one-liner.

> Having a
> "guide" on how to achieve a good dithering using PNG output, and maybe info on
> what the user needs to consider with MPEG to not restore the artifacts might be
> much more useful.

I guess the key to achieving well-dithered PNGs is to just enable
default dithering (`+th`). Ive might have a thing or two to add though.

As for MPEG, I have far too little experience to give any advice on it
at all; but I wouldn't be surprised if colour banding artifacts were
virtually inevitable there.


>>> Moreover, it ruins text rendering :(
>> Dithering or mp4?
>> How so?
>>
> 
> I was using a quite high setting of antialiasing to get a sharp text (for title,
> subtitles and such). It is created directly in POV-Ray. But with the dithering
> there is of course a noticable noise at the edges of the latters, which is
> moreover not constant from frame to frame. In consequence I think dithering can
> generally not be used when rendering the text directly in POV-Ray. Am I wrong?

Are you sure you weren't seeing JPEG/MPEG artifacts?

POV-Ray's dithering noise is at a magnitude of 0.4% in output colour
space (presuming 8 bit per colour channel). /Especially/ in the vicinity
of high contrast edges this noise should be imperceptible by human vision.


Post a reply to this message

From: cbpypov
Subject: Re: How to avoid concentric rings with spot light on flat surface
Date: 8 Nov 2017 17:45:01
Message: <web.5a0387cc3541f8acf1ae67d70@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
>
> Actually POV-Ray chooses to not use chroma subsampling in JPEG output.
>

Interesting! Why that?

> > I think implementing the dithering for JPEG would be labor lost.
>
> Not really. When I implemented dithering support, I concocted a nice
> little framework for it; enabling it for JPEG output would essentially
> be a one-liner.
>

That reason is good enough ;)

>
> Are you sure you weren't seeing JPEG/MPEG artifacts?
>
> POV-Ray's dithering noise is at a magnitude of 0.4% in output colour
> space (presuming 8 bit per colour channel). /Especially/ in the vicinity
> of high contrast edges this noise should be imperceptible by human vision.

Two things ... First, by accident I found out what I had experienced with the
Bayer dithering. (And it turned out it was _not_ in my head, but _real_.) See
the three images in the attachment, rendered without dithering and with the +th
and +thB4 methods. I am using the Gnome viewer (3.18.2), and if I have the
images full-screen (on a Fulll-HD display; but the images are only 1280x720!),
the dithered images look identical, while the undithered one looks worse.
However, if I change the window size of the viewer, causing the images to be
scaled internally (by whatever method), something interesting happens: the
undithered and the +th images do not change at all, while for the Bayer
dithering the concentric rings increase drastically at specific window sizes, --
even beyond the undithered images! It seems to be a characteristic of this
dithering when scaled. And the same has obviously happend when I played back an
MPEG rendered using the +thB4-images.

Second, I am quite sure that the artifacts on the text are from the dithering
(by POV-Ray)! I don't know your eye, but with my eyes I can see even the
slightest deviations at completely vertical/horizontal edges, as they occur with
text. I'd even say: if the dithering causes any real fluctuation at (straight)
text edges, it _will_ be noticable. Books are printed at 1200 DPI or even higher
for the same reasons. I cannot attach the video right now for because of the
size. If I have the time I'll post one, but you can believe me that the effect
is very real :) (It is absent if I render without dithering, ruling out the MPEG
artifacts).


Post a reply to this message


Attachments:
Download 'movie_midq.zip' (1024 KB)

From: clipka
Subject: Re: How to avoid concentric rings with spot light on flat surface
Date: 8 Nov 2017 18:59:37
Message: <5a039a69$1@news.povray.org>
Am 08.11.2017 um 23:40 schrieb cbpypov:
> clipka <ano### [at] anonymousorg> wrote:
>>
>> Actually POV-Ray chooses to not use chroma subsampling in JPEG output.
>>
> 
> Interesting! Why that?

To allow for the highest quality possible. Note that even if you set
quality to 100%, chroma subsampling would cause loss of information.


> However, if I change the window size of the viewer, causing the images to be
> scaled internally (by whatever method), something interesting happens: the
> undithered and the +th images do not change at all, while for the Bayer
> dithering the concentric rings increase drastically at specific window sizes, --
> even beyond the undithered images! It seems to be a characteristic of this
> dithering when scaled. And the same has obviously happend when I played back an
> MPEG rendered using the +thB4-images.

That's indeed an unsurprising characteristic of pattern-based dithering
(such as Bayer dithering), and is related to the Moiree effect. (Plus,
even if the resiting application is smart enough to avoid Moiree-like
effects, it may also be dumb enough to simply re-introduce colour banding.)

It /can/ also happen with diffusion-based dithering (such as
Floyd-Steinberg), though it is less likely. For an algorithm to be
really safe from such issues it has to be based on random noise.


Post a reply to this message

<<< Previous 4 Messages Goto Initial 10 Messages

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