POV-Ray : Newsgroups : povray.advanced-users : Lightsys IV and SpectralRender yield different light levels : Lightsys IV and SpectralRender yield different light levels Server Time
3 May 2024 00:54:20 EDT (-0400)
  Lightsys IV and SpectralRender yield different light levels  
From: Cousin Ricky
Date: 25 Jul 2016 14:20:00
Message: <web.5796572fda17689bb484452a0@news.povray.org>
Not satisfied with the lighting options in SpectralRender, I decided write a
module that would prepare arbitrary spectra for SpectralRender.  I also decided
to match the luminance of renders in preview and spectral modes, which meant
forsaking the hardwired normalization of CIE.inc::Emissive2xyz().  I wrote my
own normalization procedures to sync the 2 modes, and that's when things started
to get weird.

If I normalized on xyz (as Emissive2xyz() does), the preview rendered as
expected, but the spectral render was way too bright.  If I tried to normalize
the spectrum itself or left it unnormalized, the spectral render was perfect,
but the preview was way too dim.

I would like to add my module to the Object Collection, and this one issue is
holding it up.

After some investigation, it seems to me that there is some discrepancy between
CIE.inc and SpectralComposer.pov in the way they convert spectral curves to xyz,
although I lack the expertise in color theory to find it.

The difference is illustrated by the following scene:

----------[BEGIN CODE]----------
#version 3.7;

#declare LEVEL = 0.5;

#if (clock_on)

  #include "spectral.inc"

  global_settings { assumed_gamma 1 }

  #declare Illuminant = array[36]
  #for (I, 0, 35)
    #declare Illuminant[I] = LEVEL; // Illuminant E
  #end

  background { SpectralEmission (Illuminant) }

#else

  #declare FName = "light_level"
  #include "SpectralComposer.pov"

  #declare Acc = <0, 0, 0>;
  #for (I, 0, 35)
    #local Wl = 380 + I * 10;
    #declare Acc = Acc + CMF_xyz (Wl) * LEVEL; // Illuminant E
  #end
  #declare C = Acc / 36;
  #debug concat ("xyz <", vstr (3, C, ", ", 0, 4), ">\n")
  #debug concat ("rgb <", vstr (3, xyz2RGB (C), ", ", 0, 4), ">\n")

#end
-----------[END CODE]-----------

The text output is:

xyz <0.1484, 0.1484, 0.1483>
rgb <0.1788, 0.1408, 0.1347>

However, a sampling of the output image yields:

rgb <0.6436, 0.5068, 0.4851>

The difference is a factor of about 3.6.  Is this just the way it's supposed to
be, or did I miss something?


Post a reply to this message

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