Automatic Light System for POV-Ray, Version 4c
- Jaime Vives Piqueres: Wrote the first simplistic macros, test & demo scenes, compilation of spectral databases, package preparation & distribution.
- Ive : Teaching Jaime some color science, writing the color space macros, demo and test scenes, compilation of spectral databases.
- Philippe Debar : Donated and helped integrating Skylight.inc, betatesting.
Back in 2002, I started to write an include file to automate the task of creating a light source, specifically the aspects about color, intensity and fading. I was tired of always having to find by trial and error the right combination of these factors for each light_source.
I had in mind a set of macros wich will allow to automatically calculate the color, intensity and fading based on a few fixed rules, as light must behave always the same on real world situations. I started then learning about light on the Internet, searching with google and surfing link after link. After some time, I ended up with some basic principles to apply as rules for POV-Ray light sources creation:
Fading follows inverse square law
First of all, light follows the famous inverse square law. So, fade_power must be set to 2. The fade_distance is set to have an arbitrary and fixed value, because the intensity implementation already uses lumen values with an implicit area. However, there is a global variable to fake an exposure control wich affects the light fading parameters.
High range intensity and proportional brightness
Light intensity must be very high, to achieve a high range of lighting levels across the scene (this is also the reason for the very small value for fade_distance). The actual intensity is not that important, but to have realistic proportions between the different light sources.
So, I decided to simply use the "real" lumen value of the real light as a sort of intensity multiplier, using a global variable to allow increasing or decreasing "brightness" equally for all lights on the scene.
Realistic light colors for the light sources
In real world, (light) color is the perception of a spectrum, and as any perceptual matter, it is very subjective. However, scientists of course developed numerical systems to represent the color of a spectrum, being the CIE XYZ Tristimulus model the scientific standard.
Starting it as a replacement for my former spectral macros, Ive created an amazing set of macros to manage CIE XYZ color space with the SDL, which I inmediately adopted as Lightsys default. This gives Lightsys an accurate and very proportional way to calculate the rgb colors for light spectrums, based on the human eye perception. Ive done all the CIE XYZ color space implementation by himself, and I've only acted as betatester and later adapted Lightsys to use it (this also helped me a lot to start understanding this color mess).
Additionally, I provide also a global variable to act as a typical "color correction filter". Although this is more a "photography thing", I have implemented it for completeness.
There are some images to illustrate the purpose and behavior of the system, all created with the test and demo scenes included on the zip.
There are some more demo scenes on the package, showing other posible uses for the Lightsys and CIE macros, as well for the auxiliar tools and spectral databases.
Assorted test scenes:
Here are a some images from the test scenes, to show a bit the internals of the system and how it works.
Emissive SPD Reflective SPD Line Spectra Radiator macros Philips Mastercolor 3K Pantone Orange 21 c Sulfur (absorption) Blacbody() vs. Daylight()
Cornell box test scene:
This one is the classic Cornell Box test, using the geometry from the scene "cornell.pov", by Kari Kivisalo (included with POV-Ray 3.5). I used the spectrums for light and materials from the original Cornell Box data, and the system settings were tweaked assuming a sRGB camera balanced for daylight, which produced the closest results.
The zip archive contains both my Lightsys includes and the CIE XYZ Color Space includes by Ive, as well as the spectral databases, and the demo and test scenes:
08/11/09 : Updated to version 4c (the only change is the removal of all the unnecessary #version statements, to avoid confusions with POV-Ray 3.7 warnings).
Unzip it somewhere and it will create a "LightsysIV" folder containing all the files. After reading the help files, you may want to copy all the ".inc" files to one of your POV-Ray library paths, or add one more path for the "LightsysIV" folder to your POVRAY.INI or .povrayrc (recommended).
Additional light (emissive) spectrums collected by users of SU2POV, a POV-Ray exporter for SketchUp. These were sent to me by SU2POV user Clipi, and I just translated them to the spline format used by Lightsys 4. It contains several ANSI luminaries and some real lamps from MAZDA.
Additional wide-gamut color spaces, with values taken from Bruce Lindbloom web site. Added after an interesting email exchange with Daniel Richard G., who made me aware that these color spaces existed. The zip includes an include file with two new color space systems, and a little demo scene to visualize the color space.
Comments and criticism are welcome, as usual.
For more than a year, I've been "researching" a lot on the web, collecting a huge amount of bookmarks more or less related to light, color, photography and other topics. From all that mess I've extracted a few introductory links, as a starting point for the curious. Look at the readme files and even the code comments for more links to concrete resources.
light Measurement Handbook.
Gernot Hoffman: useful information on the CIE Color Space