|
|
|
|
|
|
| |
| |
|
|
From: clipka
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 3 Sep 2009 15:15:28
Message: <4aa015d0@news.povray.org>
|
|
|
| |
| |
|
|
Warp schrieb:
> What kind of color correction do I need when I'm rendering an image to
> be later used to generate a heightfield?
>
> The answer is: None.
No, the answer is "that depends on the software reading the heightfield".
> When I specify a color of 0.5, I expect a value
> which is exactly half of the pixel component value range to be written
> to the image file so that when the image is later used to create a
> heightfield, that pixel will produce a height which is exactly half of
> the maximum height.
What you expect is a color of 0.5 being halfway between 0% height and
100% height of the height field - and that the absolute vertical
resolution is independent of the absolute height.
The question, however, is what the software reading the height field
interprets as 50%:
(a) A brightnes of 50%? (That would appear to me the most "official" way
to handle PNG files for height fields, and leave you with the option of
setting File_Gamma any way you like.)
(b) A "framebuffer value" of 127? (That would appear to me the most
stupid way to handle PNG files for height fields, and leave you with a
problem indeed.)
(c) An encoded value of 127? (That would appear to me the most
/reasonable/ way to handle PNG files for height fields, and leave you
with the option of setting File_Gamma=1.0 to get the desired result,
even though you might not be aware that it would make a difference.)
Note that in cases (a) and (c) you'd be fine with File_Gamma=1.0, which
would also ensure a uniform vertical resolution across all heights.
In case (b) however you'd be better off with a different file format,
because such an encoding would run contrary to the way the PNG file
format tries to handle gamma.
Post a reply to this message
|
|
| |
| |
|
|
From: Warp
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 3 Sep 2009 15:34:11
Message: <4aa01a33@news.povray.org>
|
|
|
| |
| |
|
|
clipka <ano### [at] anonymousorg> wrote:
> The question, however, is what the software reading the height field
> interprets as 50%:
> (a) A brightnes of 50%? (That would appear to me the most "official" way
> to handle PNG files for height fields, and leave you with the option of
> setting File_Gamma any way you like.)
You seem to assume that all programs which can create heightfields from
image files are actually creating heightfields from *images*, not from the
raw values stored in the image file. In other words, that they are not
considering the image file to be just a storage format for the height
values, but that it is really an image which should be "interpreted"
somehow.
Granted, if the image in question is RGB rather than grayscale, and the
pixels have different values for R, G and B, then the program must indeed
handle it as an image rather than a height data storage file, and decide
what to do with those RGB values. I suppose one common technique is to
convert the RGB values to grayscale, ie. get the luminance component of
the image, and create the heightfield from that. In that case gamma
correction might make sense.
However, I am talking about a situation where the image file is *not*
considered to contain an image, but "abused" as a storage format for raw
height data. Optimally it would thus be a 1-channel (ie. "grayscale") image,
where each pixel represents directly and linearly the height at that point.
(It could be an 8bpp or 16bpp "grayscale" image.)
Especially if using 8 bits per pixel, you really don't want the pixels
to be gamma-corrected when written to the file, because that would lose
significant information. You want completely linear values. 0.5 should
mean a pixel value of 127 and nothing else.
Even if using 16 bits per pixel it still wouldn't make much sense to
gamma-correct the pixels before writing them to the file. There would still
be loss of information (even though less significant), for no good reason.
Unless I'm mistaken, if you specify in a POV-Ray heightfield a grayscale
image as input, POV-Ray will interpret the values as they are in the file,
without any modification. I think that's the way it should be.
(Maybe alongside the assumed gamma correction of image maps, it could be
a good idea to be able to specify such an assumed gamma correction with
heightfields created from an image as well.)
Of course an interesting question is what happens if the input file is
a PNG and its gamma metadata is saying that the pixels should be
gamma-corrected before usage. We are not displaying the image in this
case, so there's no need to gamma-correct the pixels for proper display. We
are using the pixels to create heights. Should they still be gamma-corrected
or not?
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Thu, 03 Sep 2009 21:34:11 +0200, Warp <war### [at] tagpovrayorg> wrote:
> However, I am talking about a situation where the image file is *not*
> considered to contain an image, but "abused" as a storage format for raw
> height data. Optimally it would thus be a 1-channel (ie. "grayscale")
> image, where each pixel represents directly and linearly the height
> at that point.
> (It could be an 8bpp or 16bpp "grayscale" image.)
>
> Especially if using 8 bits per pixel, you really don't want the pixels
> to be gamma-corrected when written to the file, because that would lose
> significant information. You want completely linear values. 0.5 should
> mean a pixel value of 127 and nothing else.
Then specify a File_Gamma of 1.0.
> Of course an interesting question is what happens if the input file is
> a PNG and its gamma metadata is saying that the pixels should be
> gamma-corrected before usage. We are not displaying the image in this
> case, so there's no need to gamma-correct the pixels for proper display.
> We are using the pixels to create heights. Should they still be
> gamma-corrected or not?
Every image must be adjusted for gamma, regardless of how it is displayed.
A height-field is really just another form of display; the linear response
means it has a gamma of 1.0.
Note that if you consistently use a gamma-aware format (like PNG), the
whole thing "just works". File_Gamma then only affects the distribution of
precision throughout the tonal range. Matching the gamma value of the
intended display means that one less gamma-adjustment is needed, thus
improving both precision and performance.
--
FE
Post a reply to this message
|
|
| |
| |
|
|
From: Warp
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 3 Sep 2009 16:47:43
Message: <4aa02b6f@news.povray.org>
|
|
|
| |
| |
|
|
Fredrik Eriksson <fe79}--at--{yahoo}--dot--{com> wrote:
> > Of course an interesting question is what happens if the input file is
> > a PNG and its gamma metadata is saying that the pixels should be
> > gamma-corrected before usage. We are not displaying the image in this
> > case, so there's no need to gamma-correct the pixels for proper display.
> > We are using the pixels to create heights. Should they still be
> > gamma-corrected or not?
> Every image must be adjusted for gamma, regardless of how it is displayed.
But that's the point. This is not an image. We are simply using an image
file format to store height data. We could just use some raw file format
for the same purpose. (Existing image formats are more useful because they
have more software support and are often compressed, conserving disk space.)
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Thu, 03 Sep 2009 22:47:43 +0200, Warp <war### [at] tagpovrayorg> wrote:
> Fredrik Eriksson <fe79}--at--{yahoo}--dot--{com> wrote:
>> Every image must be adjusted for gamma, regardless of how it is
>> displayed.
>
> But that's the point. This is not an image. We are simply using an
> image file format to store height data. We could just use some raw
> file format for the same purpose. (Existing image formats are more
> useful because they have more software support and are often
> compressed, conserving disk space.)
Then use a File_Gamma of 1.0, thus specifying your intent to later
interpret the values linearly.
--
FE
Post a reply to this message
|
|
| |
| |
|
|
From: clipka
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 3 Sep 2009 17:06:05
Message: <4aa02fbd@news.povray.org>
|
|
|
| |
| |
|
|
Warp schrieb:
>> The question, however, is what the software reading the height field
>> interprets as 50%:
>
>> (a) A brightnes of 50%? (That would appear to me the most "official" way
>> to handle PNG files for height fields, and leave you with the option of
>> setting File_Gamma any way you like.)
>
> You seem to assume that all programs which can create heightfields from
> image files are actually creating heightfields from *images*, not from the
> raw values stored in the image file. In other words, that they are not
> considering the image file to be just a storage format for the height
> values, but that it is really an image which should be "interpreted"
> somehow.
Warp, this is a point where I must again ask you: Are you really reading
my postings? Or do you just read them up to the first point that you
deem worth arguing against?
If you did read my whole posting, then you will have noticed that I
mentioned /all three/ possible ways of interpreting the content of a PNG
file with gAMA chunk. Hence the (a), (b) and (c). That's actually the
opposite of assuming any particular way of doing it.
What you refer to as creating height fields from "raw values stored in
the image file" appears to be exactly what I described as (c), which
happens to be what I would find most reasonable, too.
Note however that...
(1) The PNG file format was designed to store /images/, not arbitrary
data over 2D space, and therefore the variant (a) would appear the "more
official" way to do it, even if I'd agree that it is less reasonable.
(2) While a program creating heightfields may evaluate the raw values in
the file, an image viewing program would still have to interpret the
data as an image. So if there is a gAMA chunk present saying "this is
all linear brightness data, no gamma correction has been performed
whatsoever", the viewing program would be mandated to perform gamma
correction to compensate for display gamma - something that the
heightfield-generating program may refrain to do. So two files that look
identical in an image-viewing program - one generated with
File_Gamma=1.0 and the other with File_Gamma=2.0 - may still result in
different height fields.
> Of course an interesting question is what happens if the input file is
> a PNG and its gamma metadata is saying that the pixels should be
> gamma-corrected before usage. We are not displaying the image in this
> case, so there's no need to gamma-correct the pixels for proper display. We
> are using the pixels to create heights. Should they still be gamma-corrected
> or not?
That's a matter of definition. Unless I'm perfectly mistaken, the PNG
specification makes no statements about how to interpret the data when
it is misused for storing height fields.
I'd say pop a warning if gAMA is present and says something different
than 1.0, and then just do /something/ (which should of course be
documented), with the option to override whatever the gAMA chunk claims,
by specifying "gama 1.0" (to get the raw data) or "gamma 2.2" (to get
the linear brightness represented by the data in the file) for that
particular file.
Post a reply to this message
|
|
| |
| |
|
|
From: Nicolas Alvarez
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 8 Sep 2009 13:38:31
Message: <4aa69696@news.povray.org>
|
|
|
| |
| |
|
|
Warp wrote:
> If I want a program to write the value 12345 to a file, then I expect
> the program to write 12345 to the file, not some other value. Why should
> the program try to guess what I "really want"?
>
> One reason can be that I want to match exactly the image pixel values
> with
> HTML colors. If I want the color scheme of an image to match, for example,
> the background color of a HTML page, I should be able to do that.
Wouldn't the browser do gamma correction according to the gAMA chunk anyway?
Post a reply to this message
|
|
| |
| |
|
|
From: Nicolas Alvarez
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 8 Sep 2009 13:53:01
Message: <4aa699fd@news.povray.org>
|
|
|
| |
| |
|
|
clipka wrote:
> Nicolas Alvarez schrieb:
>> I have an LCD monitor, and the checkerboard looked *green*. Quite
>> strange.
>
> Do you use an analog or digital connection?
Analog, unfortunately. My graphics card has a DVI connector but my monitor
doesn't.
Post a reply to this message
|
|
| |
| |
|
|
From: clipka
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 8 Sep 2009 14:38:54
Message: <4aa6a4be$1@news.povray.org>
|
|
|
| |
| |
|
|
Nicolas Alvarez schrieb:
>> One reason can be that I want to match exactly the image pixel values
>> with
>> HTML colors. If I want the color scheme of an image to match, for example,
>> the background color of a HTML page, I should be able to do that.
>
> Wouldn't the browser do gamma correction according to the gAMA chunk anyway?
Yes, but Warp's problem was that HTML "50% grey" (#7F7F7F) is /not/
POV.Ray 0.5 grey.
Browser gamma correction will make sure POV-Ray 0.5 grey is properly
converted to 50% /brightness/, but HTML "50% grey" is 50% /voltage/ (at
the VGA output of a typical PC), equaling 22% brightness.
Post a reply to this message
|
|
| |
| |
|
|
From: clipka
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 8 Sep 2009 14:50:15
Message: <4aa6a767$1@news.povray.org>
|
|
|
| |
| |
|
|
Nicolas Alvarez schrieb:
>>> I have an LCD monitor, and the checkerboard looked *green*. Quite
>>> strange.
>> Do you use an analog or digital connection?
>
> Analog, unfortunately. My graphics card has a DVI connector but my monitor
> doesn't.
In that case your display quality may suffer from the A/D-D/A conversion
between your graphics card and display, as well as parasitic inductance
and/or capacitance of the analog connection; if that differs for the
color channels, or if the channels are not sampled synchronously, color
shift may occur at sharp dark-to-bright or bright-to-dark transitions.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|