3
$\begingroup$

I have noticed that the blackbody node has a 'scale by luminance' in its OSL code.

This is the code:

/* Scale by luminance */
    float l = luminance(rgb);
    if (l != 0.0)
        rgb /= l;
    Color = rgb;

What does luminance have to do with the blackbody node?

$\endgroup$
  • $\begingroup$ Can you give a source/link for that code? The blackbody code that I'm finding in the Cycles kernel doesn't say anything about luminance. $\endgroup$ – Scott Milner Oct 18 '17 at 1:30
  • $\begingroup$ @ScottMilner I am not sure if the source code is available on Github or anywhere else. I downloaded it from blender.org. You can find the code in intern/cycles/kernel/shaders $\endgroup$ – Casanova Oct 18 '17 at 5:19
  • $\begingroup$ Actually >We don't want lights that are lit at varying temperatures to be perceived as brighter or darker than the others Isn't actually this exactly what you want? Warmer lights should be brighter.. Or at least is there a way of turning this on? I am gonna have to learn to code to create what I want I think $\endgroup$ – Andrew Brown Jan 17 '18 at 0:41
  • $\begingroup$ @AndrewBrown Color temperature does not directly correspond to the heat of the light source emitting it. According to Wikipedia, color temperature is temperature of an ideal black-body radiator that radiates light of a color comparable to that of the light source. For example, the sky has a color temperature of 15000K+, but definitely isn't that hot. $\endgroup$ – Scott Milner Jan 17 '18 at 23:34
3
$\begingroup$

Let's look at what Luminance means:

Luminance...is a measure to describe the perceived brightness of a color.

Source

Since luminance is the perceived brightness, not all hues with the same saturation will have the same luminance. The website linked above has a useful image:

enter image description here

From the image above, we can see that even though all of the colors have 100% saturation, their luminance varies a lot. Yellow light (2,800 K) has a luminance of 94%, while blue light (10,000 K) only has a luminance of 57%.

This becomes a problem with the Blackbody node, since its usual purpose is to provide color for Emission shaders and lamps. We don't want lights that are lit at varying temperatures to be perceived as brighter or darker than the others. We'd rather control this on our own with the Emission node.

All of the colors coming from the Blackbody node are divided by their own luminance as a kind of normalization, so that they all have the same perceived brightness.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.