POV-Ray : Newsgroups : povray.newusers : diference between render window and PNG output Server Time
23 Nov 2024 20:26:15 EST (-0500)
  diference between render window and PNG output (Message 1 to 7 of 7)  
From: crowbait
Subject: diference between render window and PNG output
Date: 23 Feb 2012 09:30:00
Message: <web.4f464ca4196b9b8deb9e10ac0@news.povray.org>
Hello,

I use POV-Ray 3.7RC4 on Windows.
I made a simple scene

// from here
#version 3.7;
#include "colors.inc"
global_settings {
  assumed_gamma 1.0
  max_trace_level 12
}
camera {
  angle 35
  location <0,1.4,-6>
  look_at <0,0.8,0>
}
light_source {
  <-2,10,-20>
  White
}
plane {
  y, 0
  pigment { Gray10 }
}
// to here

and rendered with [640x480, No AA] preset.

This is screenshot of render window.
http://blogimg.goo.ne.jp/user_image/69/3c/83e31ff151644d9a6a6c3f89583d54e9.png

And this is the output file.
http://blogimg.goo.ne.jp/user_image/57/ce/dcf2d63a98a4e0f8fd0c682d3d90b290.png

The output gets color bands that haven't been in render window.
3.7RC3 makes bands too.

How could I get output that is equal to render window?
Advice appreciated.
Thank you very much.


Post a reply to this message

From: Warp
Subject: Re: diference between render window and PNG output
Date: 23 Feb 2012 09:59:55
Message: <4f46546b@news.povray.org>
crowbait <cro### [at] mailgoonejp> wrote:
> This is screenshot of render window.
> http://blogimg.goo.ne.jp/user_image/69/3c/83e31ff151644d9a6a6c3f89583d54e9.png

> And this is the output file.
> http://blogimg.goo.ne.jp/user_image/57/ce/dcf2d63a98a4e0f8fd0c682d3d90b290.png

  I see no difference.

-- 
                                                          - Warp


Post a reply to this message

From: crowbait
Subject: Re: diference between render window and PNG output
Date: 23 Feb 2012 11:45:01
Message: <web.4f466bffc3045517eb9e10ac0@news.povray.org>
Hello,

This is enhanced picture of difference of two PNGs.
http://blogimg.goo.ne.jp/user_image/47/c5/40505ea58ad7836db90f822b52a8fb66.png

Maximum difference of pixel blightness is 1/256, very small,
so I almost agree you.
But in my another project, on a flat plane,
color bands gets more insistent.

Warp <war### [at] tagpovrayorg> wrote:
> crowbait <cro### [at] mailgoonejp> wrote:
> > This is screenshot of render window.
> > http://blogimg.goo.ne.jp/user_image/69/3c/83e31ff151644d9a6a6c3f89583d54e9.png
>
> > And this is the output file.
> > http://blogimg.goo.ne.jp/user_image/57/ce/dcf2d63a98a4e0f8fd0c682d3d90b290.png
>
>   I see no difference.
>
> --
>                                                           - Warp


Post a reply to this message

From: clipka
Subject: Re: diference between render window and PNG output
Date: 23 Feb 2012 12:48:44
Message: <4f467bfc$1@news.povray.org>
Am 23.02.2012 15:28, schrieb crowbait:

> This is screenshot of render window.
> http://blogimg.goo.ne.jp/user_image/69/3c/83e31ff151644d9a6a6c3f89583d54e9.png
>
> And this is the output file.
> http://blogimg.goo.ne.jp/user_image/57/ce/dcf2d63a98a4e0f8fd0c682d3d90b290.png
>
> The output gets color bands that haven't been in render window.
> 3.7RC3 makes bands too.

With 3.6, the render window would show the same color banding.

The reason is that 3.6 preview & file output (and 3.7 default file 
output) does not use any dithering, so you get color-aliasing due to the 
limited bit depth, resulting in visible banding of some "shallow" gradients.

> How could I get output that is equal to render window?

POV-Ray 3.7 supports dithering, but it's enabled only for render window 
output by default, as it might cause undesired effects when printing an 
output image (or so I am told). You can use "+th" (for "diTHer") or 
"Dither=yes" on the command line or in the INI file to enable 
Floyd-Steinberg dithering.

You can also choose a different dither method by specifying 
"Dither_Method=XX" or "+thXX", where XX is any of the following:

B2..B4: Bayer pattern dithering using a 2x2, 3x3 or 4x4 pattern

D1, D2: simple 1- or 2-dimensional error diffusion dithering

FS: Floyd-Steinberg dithering (the default).

(Reder window output always uses some Bayer pattern dithering; don't 
know off the top of my hat whether it's 2x2 or 4x4.)


Alternatively, you could use 16-bit output (not available with all 
output file formats), or the OpenEXR high dynamic range image format 
(Radiance HDR doesn't quite cut it, as it has color banding problems of 
its own.); both use a high enough precision to avoid color banding 
altogether. It would then depend on the image viewing software whether 
you see color banding or not (the image viewing software would have to 
use dithering itself in that case).


Post a reply to this message

From: Le Forgeron
Subject: Re: diference between render window and PNG output
Date: 23 Feb 2012 13:28:03
Message: <4f468533$1@news.povray.org>
Le 23/02/2012 15:59, Warp nous fit lire :
> crowbait <cro### [at] mailgoonejp> wrote:
>> This is screenshot of render window.
>> http://blogimg.goo.ne.jp/user_image/69/3c/83e31ff151644d9a6a6c3f89583d54e9.png
> 
>> And this is the output file.
>> http://blogimg.goo.ne.jp/user_image/57/ce/dcf2d63a98a4e0f8fd0c682d3d90b290.png
> 
>   I see no difference.
> 

Internal data from png shows:
Render image is saved as Grey PNG, with a palette of 32 entries, with a
depth of 8 bits per channel (3: rgb).
Rendered on Windows with 3.7RC4;

I do not know the windows specific code, but the general code of povray
would push for 16 bits per channel in case of Gray output. That does not
seems to be the case in your render. (hint: try it as option from
command-line box ?)

Note on palette: it's compact (excepted for black, the 31 other entries
cover 26 to 56 values.
What you might be observing is a side effect of computation: The png
writing get the float value (0 to 1 usual range) into an integer (0 to
255 for 8 bits) via a gamma curve, whereas the preview/display get the
pixel colour probably in a different way (from the same float anyway).

You might want to (either or both):
 * Use deeper PNG (+FN16 is the max)
 * experiment with dithering (+TH or +THfs or +THB2 or +THB3 or +THB4 or
+THD1 or +THD2 )
 * try the wrath of gods by playing with FILE_GAMMA setting.

From your picture view, the png file you got is correct and cannot
perform better due to the compact values used with +FN8 and the gamma
you specified for file (or its default of 2.2);


Post a reply to this message

From: clipka
Subject: Re: diference between render window and PNG output
Date: 23 Feb 2012 13:52:25
Message: <4f468ae9@news.povray.org>
Am 23.02.2012 19:28, schrieb Le_Forgeron:

> I do not know the windows specific code, but the general code of povray
> would push for 16 bits per channel in case of Gray output. That does not
> seems to be the case in your render. (hint: try it as option from
> command-line box ?)

No; that's only the case for heightfield output.

> Note on palette: it's compact (excepted for black, the 31 other entries
> cover 26 to 56 values.
> What you might be observing is a side effect of computation: The png
> writing get the float value (0 to 1 usual range) into an integer (0 to
> 255 for 8 bits) via a gamma curve, whereas the preview/display get the
> pixel colour probably in a different way (from the same float anyway).

No, the gamma curve is (by default) the same for both file output and 
preview. But the preview is dithered by default; it would be quite 
difficult to emulate the artifacts created by the various file formats 
in the preview, so the current strategy is to show the image in the best 
possible quality (which is somewhat consistent with POV-Ray 3.6, which 
also didn't emulate the effects of reducing color depth to 5 bits, for 
instance.)

> You might want to (either or both):
>   * Use deeper PNG (+FN16 is the max)

You might still get color banding there depending on the image viewer.

>   * experiment with dithering (+TH or +THfs or +THB2 or +THB3 or +THB4 or
> +THD1 or +THD2 )

Yep, probably the best approach.

>   * try the wrath of gods by playing with FILE_GAMMA setting.

Might help with some images (and the God of PNG has a rather liberal 
attitude about File_Gamma), but with the average image you may just 
exchange color banding in dark regions for color banding in bright 
regions. Plus, color banding might be introduced again by the image viewer.

>  From your picture view, the png file you got is correct and cannot
> perform better due to the compact values used with +FN8 and the gamma
> you specified for file (or its default of 2.2);

Indeed. (Given that no dithering is performed, that is.)

(BTW, File_Gamma and Display_Gamma default is actually the sRGB transfer 
formula. Close enough to a power-law transfer function with a gamma of 
2.2 for many practical purposes, but not exactly the same.)


Post a reply to this message

From: crowbait
Subject: Re: diference between render window and PNG output
Date: 24 Feb 2012 19:00:01
Message: <web.4f48238fc3045517760c9f0@news.povray.org>
Sirs,

Thank you for all informative advices.

> >  From your picture view, the png file you got is correct and cannot
> > perform better due to the compact values used with +FN8 and the gamma
> > you specified for file (or its default of 2.2);
>
> Indeed. (Given that no dithering is performed, that is.)

I should have known it when difference is 1/256.
Please forgive my bonehead.

> > You might want to (either or both):
> >   * Use deeper PNG (+FN16 is the max)
>
> You might still get color banding there depending on the image viewer.
>
> >   * experiment with dithering (+TH or +THfs or +THB2 or +THB3 or +THB4 or
> > +THD1 or +THD2 )
>
> Yep, probably the best approach.

I will try dithering. It's likely appropriate for my project.

> >   * Use deeper PNG (+FN16 is the max)
>
> You might still get color banding there depending on the image viewer.

But I would like to paint 16 bits deep rich darkness someday...

Thanks again,


Post a reply to this message

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