Fall break at college means more time for Unreal Engine 4 patches! There are still a few rough edges here and there that I've got to iron out before I submit a pull request, but I got blackbody color working for lights:
Gotta go bake some baklava but let me know what you guys think or if you have any suggestions.
Replies
Currently the normalize color temperature checkbox does nothing. The next thing I want to do is make it so that if that's unchecked, color temperature affects brightness and color of the lamp, and if it's checked, color temperature affects color only.
It's not my original algorithm; I just stole the code from the MaterialTemplate.usf shader file and translated it to C++. Will probably do a bit of refactoring of what I've written as well when I get around to it.
Anyways! How about some comparisons? All screenshots are done with the tonemapper at an exposure fixed at log 0.
Here is a standard UE4 directional light, with intensity 10 and a color of 255, 255, 255.
Here's a duplicate of that directional light, which I tweaked the color temperature of. Now it has an intensity of 45.947937 and a color of 132, 125, 132. (This is as close to white as you can actually get in the color temperature computation I use.) The intensity is automatically increased to compensate for the darker light color.
Note how they look almost exactly the same. (The color temperature one is a little bit purple, but that's OK.) So, now let's try a lower color temperature and see if the brightness of the light changes.
That was quite yellow, but if I take it into Krita and desaturate it according to luminosity, you'll see that it's actually the same brightness as before!
Let's try a really hot light now. I'm going to take this one's temperature over 9000:
Here it is desaturated in Krita again:
A little brighter than the yellow one was desaturated, but closer to the original two.
Of course if you uncheck the normalize color temperature checkbox the color temperature will also affect the light's intensity realistically. For most lights this results in really bright lights with UE4's default intensity at a color temperature over about 5000 or so. This property is more meant to be used for creating dynamic lights that go with explosions and such... I think I will move it to advanced properties before I submit my pull request.
Just for fun here's the same directional light with normalization turned off and bloom turned back on.
So, expect my pull request to be submitted by ... oh, probably Wednesday or so, and expect it to be merged whenever Epic's rendering team takes a break from their daily bear and lion wrestling routine