I’ve written a python module that will convert a Kelvin color temperature to an RGB value (based on another Kelvin value for the reference, e.g. 3200K or 5500K). I have it working with as a CGI script, but I’d like to tie it into Blender with the proper GUI and hooks to lights in a given scene. My question is, “Is there interest for this?” I’ll probably wind up doing it anyway just for kicks, but if there’s a fair amount of enthusiasm for it, it’ll light a fire under me to do it.
For those new to Kelvin w/r/t lighting, most (incandescent) light is somewhere along the color spectrum from more orange to more blue, with white being right in between. Indoor film uses 3200 as it’s base for “white”, so lightbulbs (3000K) appear slightly yellow while outdoor light (5-6000 or more) appears bluish. Outdoor film sets white at 5500, so direct sun at noon appears white.
I figured this might be useful for people doing compositing or for folks (like me) who are just curious about the effect and want to model lighting “realistically”.
As for night, actually, you could really just use heavily blue tinted light to fake night-time lighting. It would have the effect of desaturating human (warm brown) skin, thus making it look like night, while also matching with the industry conventions of using blue to simulate night.
As for fire, that’s probably around 1700K-1900K as far as color. The actual RGB depends on the reference color. For more info, I HIGHLY recommend Jeremy Birn’s Digital Lighting and Rendering, particularly chapter 6.
Next time I post back, I’ll try to have a basic slider bar and RGB value working for Blender 2.33a. Anyone interested in the CGI can go here:
There are two files in that zip. You’ll need to open both of them in Blender or put kwrgb.py in your python path (kelvin.py, the gui file, needs to import it).
The script will pull up a list of Lamps you have in your blend. Assign a value for the light temperature (higher is bluer) and the reference temperature (5500 is reasonably “white” outdoors) and hit the button. The selected Lamp will get the proper light color.
Hope this helps folks! This is my first script for Blender, so suggestions on making it better are HIGHLY appreciated.
Also, I’d really like to have a square GL polygon appear on the interface so that you could see the color before you apply it to the lamp, but I couldn’t get it to render properly. Suggestions for that are needed desperately, especially since I want to make this script as good a competitor to other 3D apps as I can.
Also also, how do I get this script tucked away in the Python Script menu? I haven’t really used it much, so I’m curious as to how that all works. Plus, any other tips on good Blender/Python integration are welcome–I’ve used Python a bunch outside of Blender, and I’m getting fairly good with Blender itself, but I’m still new at bridging the gap.
Heh, okay, I resolved a MAJOR issue with the script that caused it to constantly redraw and suck up all available processing power. Duh. Also, I added a preview color swatch on the GUI that you can look at before you change the lamp color.
Just tried this. Pretty cool. Now I have to did up my copy of Jeremy Birn’s rendering book. It would be nice if you had some kind of presets for different types of lighting or course with the ability to change them like you have now. But thanks for doing this, very useful.
Paradox
Yeah, the presets are definitely the next thing I want to do. I’ll have to figure out how I want to handle that–probably a pulldown for Inside/Outside to handle the reference and a a pulldown for various light sources/times of day to handle the light temp.