POV-Ray : Newsgroups : povray.binaries.images : What about repeat and offset with image / bump maps? : Re: What about repeat and offset with image / bump maps? Server Time
18 Apr 2024 22:02:10 EDT (-0400)
  Re: What about repeat and offset with image / bump maps?  
From: William F Pokorny
Date: 5 Mar 2023 17:36:22
Message: <64051966$1@news.povray.org>
On 3/5/23 15:41, Kenneth wrote:
...

Linear(c).

> It's just that, in my own way of
> thinking, an image from the internet that is typically encoded(??) with a gamma
> of 2.2 or sRGB is what I call non-linear (rightly or wrongly.)

For the typical jpeg and png formats on the web, yes.

> And when used for
> a height_field in POV-ray, it needs 'gamma 1' added, to reconstruct the intended
> linear nature of the image's brightness values-- so that we get a nice linear HF
> slope from the black-to-white brightness values.

Maybe, kinda.

Unless mangling the image file for effect(b), you want to read the image 
file with the same gamma correction(a) used when it was created to get 
again the same, internal, linear rgb values that existed prior to the 
image being written.

There is no 're-construction' when using a gamma correction of 1.0. At 
'gamma 1.0' you are reading (or writing) the image doing no gamma 
correction(a) at all. The values internal to the image file are directly 
transferred to POV-Ray's internal, linear rgb space - whether they were 
written to the image file with gamma correction or not.

Again. The up front rule is to read image files using the same gamma as 
was used when they were written/created(b).

Bill P.

(a) - Where the gammas involved are other than 1, on image read/input we 
are actually applying the inverse gamma correction to that used during 
write to get back to the linear, rgb space internal to POV-Ray.

(b) - Other than mangling for effect, there is one other time you might 
want to apply the 'preview display gamma' correction on an image read... 
Suppose you've written an image file from POV-Ray with file_gamma=1.0.
When you view this file with whatever viewing tool outside of POV-Ray it 
will appear darker than it appeared in POV-Ray's preview window. POV-Ray 
gamma corrects with the display gamma setting prior to preview as it 
would correct prior to writing to a file using the file_gamma value.

If you want to see this image in POV-Ray's preview window in the same 
way other image viewers will display it, you need to apply the display 
window's gamma correction (the default is srgb) during the image 
read/input. What we are really doing is applying the inverse gamma srgb 
to an as written linear gamma file - so the forward, srgb, preview 
window gamma correction ends up back in the linear color space as you 
preview it in POV-Ray... :-)

(c) - For what happens typically with respect to images used with 3d 
models, it's just my impression from a relatively limited set of 
personal experiences. I've certainly not done an exhaustive survey! ;-)


Post a reply to this message

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