POV-Ray : Newsgroups : povray.text.scene-files : Something weird with gamma and the camera : Re: Something weird with gamma and the camera Server Time
18 May 2024 06:37:17 EDT (-0400)
  Re: Something weird with gamma and the camera  
From: clipka
Date: 24 Jan 2016 10:52:49
Message: <56a4f351$1@news.povray.org>
Am 24.01.2016 um 13:15 schrieb Mike Horvath:

> Why are the colors so different between the two renders?

Because you're not paying attention to the parse warnings ;)

------ (camera_eye=-1)
Parse Warning: assumed_gamma not specified, so gamma_correction is
turned off for compatibility with this pre POV-Ray 3.7 scene. See the
documentation for more details.
Parse Warning: This scene did not contain a #version directive. Please
be aware that as of POV-Ray 3.7, unless already specified via an INI
option, a #version is expected as the first declaration in a scene file.
POV-Ray may apply settings to some features that are
intended to maintain compatibility with pre-3.7 scenes. You are strongly
encouraged to add a #version statement to the scene to make your intent
clear. Future versions of POV-Ray may make the presence of a #version
statement mandatory.
------

In other words: Your scene has no "#version" statement at all => POV-Ray
now presumes a legacy scene, so you get 3.6 gamma handling defaults
(which is no gamma handling).


------ (camera_eye=0)
Possible Parse Error: assumed_gamma not specified in this POV-Ray 3.7 or
later scene. Future versions of POV-Ray may consider this a fatal error.
To avoid this warning, explicitly specify 'assumed_gamma 1.0' in the
global_settings section. See the documentation for
more details.
Parse Warning: This scene had other declarations preceding the first
#version directive. Please be aware that as of POV-Ray 3.7, unless
already specified via an INI option, a #version is expected as the first
declaration in a scene file. If this is not done, POV-Ray
may apply compatibility settings to some features that are intended to
make pre-3.7 scenes render as designed. You are strongly encouraged to
add a #version statement to the scene to make your intent clear. Future
versions of POV-Ray may make the presence of a
#version mandatory.
------

In other words: Your scene has a belated "#version 3.7" statement => you
get 3.7 gamma handling defaults (which is "assumed_gamma 1.0").


"But where does this '#version 3.7' statement come from?" you might ask.

The secret lies in the inclusion of "transforms.inc", which you only
pull in for camera_eye=0 or 1:

As is customary for library include files, it does specify its own
"#version" statement, so that future versions of POV-Ray may invoke
backward compatibility mode for that paticular file in case they
introduce some breaking changes to functionality. However, in order to
not break the main scene's "#version" choice, it needs to revert the
change at the end of the file; this is done using the following
construct (which also acts as a guard against double inclusion):

    #ifndef(FOO_INC_TEMP)
    #declare FOO_INC_TEMP = version;
    #version 3.5; // for example

    // include file content goes here

    #version FOO_INC_TEMP
    #end

Enter a quirk of the version handling as of version 3.7: As you can
infer from the warning you get, as long as you don't specify a
"#version" directive the /effective/ SDL version will be 3.6, because we
presume that anything without a "#version" statement is a legacy scene.
*But* the "version" pseudo-variable will return 3.7 (or whatever is the
actual version of the POV-Ray binary you are running) in this case.

This is to allow scenes to have "#version" as their very first statement
(which is officially a mandatory requirement for 3.7 and later scenes),
but still be able to adapt to the actual version used, by employing a
construct like the following:

    #version version;
    #if (version >= 3.70)
      #version 3.7; // use 3.7 features if we can have them
      #declare Subsurface_On = yes;
    #else
      #version 3.6; // need at least 3.6
      #declare Subsurface_On = yes;
    #endif

Thus, if you don't explicitly specify a "#version" directive, you'll get
3.6 behaviour by default, but including any standard include file will
effectively set "#version 3.7" at the end of that include.


Post a reply to this message

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