POV-Ray : Newsgroups : povray.general : how (if at all) can i change the wavelength of light in pov? : Re: how (if at all) can i change the wavelength of light in pov? Server Time
13 Aug 2024 15:29:53 EDT (-0400)
  Re: how (if at all) can i change the wavelength of light in pov?  
From: Thomas Willhalm
Date: 18 Aug 1998 05:20:53
Message: <qqmyasmn1jv.fsf@goldach.fmi.uni-konstanz.de>
"Philippe Debar" <phi### [at] hotmailcom> writes:


> >um... subject kinda says it all.  i remember way back when, there being
> >the whole question of modelling a sparkling diamond.  the proposed
> >answers hinted at rendering the scene 3 times.  once with a red light,
> >once a green, and once a blue.  then composite them.  of course, each
> >render would see the light's wavelength altered such that the images
> >would be different.  unfortunately, i don't remember how this could (or
> >IF it could) be accomplished
> >
> 
> You could try rendering the scene three times, each with a differently
> colored
> light (rgb <1,0,0> ; <0,1,0> and <0,0,1> would be favorite) and a different
> IOR
> for the diamond - and the composite the images.
> 
> A finer approach would be, with the animation clock variable:
> (1) vary the color of lighting according to the light spectrum
>      to simulate different wavelengths;
> (2) at the same time, vary the ior value, according to the real
>      ior(wavelength law);
> (3) composite the resulting images (as many as you want)
> 
> Don't ask me about how to get a monochromatic wavelenght
> in rgb color space, 

But you can ask me:

// --- frequency.inc ----
// Tho### [at] uni-konstanzde
// usage:
//  #declare wavelength= ...
//  #include "frequency.inc"
//
pigment { color rgb
#if (wavelength<440)
  <(440-wavelength)/60,0,1>
#end
#if ((wavelength>=440)&(wavelength<490)) 
  <0,(wavelength-440)/50,1>
#end
#if ((wavelength>=490)&(wavelength<510))  
  <0,1,(510-wavelength)/20>
#end
#if ((wavelength>=510)&(wavelength<580))  
  <(wavelength-510)/70,1,0>
#end
#if ((wavelength>=580)&(wavelength<645)) 
  <1,(645-wavelength)/65,0>
#end
#if (wavelength>=645)
  <1,0,0>
#end

#if (wavelength>700)
    *(0.3+0.00875*(780-wavelength))
#else 
  #if (wavelength<420)
    *(0.3+0.0175*(wavelength-380))
  #end
#end
}
// --- end of frequency.inc ---

It is only a linear interpolation, but I hope it helps.

Thomas

-- 
http://www.fmi.uni-konstanz.de/~willhalm


Post a reply to this message

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