POV-Ray : Newsgroups : povray.binaries.images : LightsysIV spectrum : LightsysIV spectrum Server Time
5 May 2024 07:58:41 EDT (-0400)
  LightsysIV spectrum  
From: Cousin Ricky
Date: 3 Oct 2012 22:05:01
Message: <web.506cede343e4d6085de7b680@news.povray.org>
No, this has nothing to do with spectral rendering.  Sorry to disappoint.
______________________________________________________________________

#include "CIE.inc"

#declare SHORTEST = 378;
#declare LONGEST = 826;
#declare STEP = 2;

#declare Max = 0;
#declare c_Values = array [(LONGEST - SHORTEST) / STEP + 1]
#local I = 0;
#for (Wl, SHORTEST, LONGEST, STEP)
  #declare c_Values[I] = MapGamut (Wavelength2RGB (Wl));
  #declare Max = max (Max, c_Values[I].x, c_Values[I].y, c_Values[I].z);
  #local I = I + 1;
#end

#declare cm_Spectrum = color_map
{ #local I = 0;
  #for (Wl, SHORTEST, LONGEST, STEP)
    [Wl/1000 rgb c_Values[I] / Max]
    #local I = I + 1;
  #end
}

#declare p_Spectrum = pigment { gradient x color_map { cm_Spectrum } }
______________________________________________________________________

P.S.  Macro MapGamut() has the same pass-by-reference issue that CH2RGB() used
to have.  (See "CH2RGB somehow causes infinite loop" in p.general.)


Post a reply to this message


Attachments:
Download 'ls4_spectrum_montage1.png' (16 KB)

Preview of image 'ls4_spectrum_montage1.png'
ls4_spectrum_montage1.png


 

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