POV-Ray : Newsgroups : povray.text.tutorials : How To do Proper Gamma in POV-Ray 3.7 : How To do Proper Gamma in POV-Ray 3.7 Server Time
18 Sep 2021 01:03:11 EDT (-0400)
  How To do Proper Gamma in POV-Ray 3.7  
From: clipka
Date: 17 Jun 2009 20:50:00
Message: <web.4a398f2555c7683545339cfa0@news.povray.org>
Gamma handling is still a difficult issue; here's how to approach it *properly*:

(1) MATCH YOUR DISPLAY

Make sure you have your Display_Gamma set to properly. The following test scene
may help:

// Render with +w800 +h600 +am2 +r3 +a0.1

#if (version <= 3.6) global_settings { assumed_gamma 1.0 } #end

camera {
  location  <0.0, 0.0, -4.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0, 0.0>
}

background { rgb 0.5 }

plane { -z, -1
  texture {
    pigment { checker color rgb 1 color rgb 0 scale .02 }
    finish { ambient 1 diffuse 0 specular 0 }
  }
  rotate x*45
}

sphere { 0.0, 1
  texture {
    pigment { color rgb 0.5 }
    finish { ambient 1 diffuse 0 specular 0 }
  }
}


(2) DO *NOT* ADJUST OUTPUT GAMMA IN YOUR SCENE FILE

Do not make use of the global "assumed_gamma" statement (or set it to 1.0 in
versions prior to 3.7).


(3) CHOOSE A PROPER OUTPUT FILE GAMMA

Choose a suitable output file gamma pre-correction; 2.20 is a very good choice,
because it is a quasi-standard in the internet (being a compromise between
typical PC and Mac display gamma values). Otherwise, choosing the same as your
Display_Gamma is not a bad idea either, but be prepared for other people to
complain about your shots being too dark or too washed-out.

1.00 (no gamma pre-correction) would seem like a good choice theoretically, but
it's actually bad from a dynamics point of view.


(4) FIX YOUR COLORS

Make sure *all* your individual color values are *NOT* gamma pre-corrected, but
linear - which means that you usually will have to "fix" colors from external
sources (e.g. colors picked from an image in Photoshop or the like). A macro
should do the job (I didn't throw one together yet, because I usually do color
tweaking in POV anyway).


(5) FIX YOUR TEXTURES

This is the trickiest part: By specifying File_Gamma, not only will POV-Ray
create output files with the corresponding gamma pre-correction, but it also
affects POV-Rays gamma handling of all *input* files! Unfortunately, there's
currently no mechanism to override this. Worse yet: Even a file created with
POV-Ray itself may not work properly as an input file, even if created with the
same File_Gamma settings!

The good news is, the issue can be worked around as follows:

- Identify all the *color* texture files you're working with. (Don't bother
about bump maps, specular maps or transparency maps; I guess they should be
ok.)

- Load each texture in HDRShop, which will prompt you for a gamma value
("display curve"); choose the same value as your File_Gamma!

- Save the file in HDR format.

- In POV-Ray, use the HDR file instead of the original one.

I'm not sure what *exactly* this does, but it works; when placed in a scene with
ambient 1, the texture will now be output exactly as it was input. At last.


Post a reply to this message

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