Luminous intensity calculation

Hello!

This might be a terribly dumb question, but I’ve been searching for a while and unable to find an answer. On the Light documentation page it states that:

In physically correct mode, the product of color * intensity is interpreted as luminous intensity measured in candela.

What is the formula used for multiplying color by intensity? Specifically, what format are the color values converted to in that equation (an example would be extremely helpful).

I’m working with a gltf model that was made in Blender by another designer, and threejs is loading in the intensity as the Watt values that are used in Blender which is blowing out the image. I’m trying to get the scene as close to the original designer’s intent as possible, and being able to make the accurate calculation would probably help.

Thank you!

First I would check that you have correct color management settings. I’m not too familiar with recreating blender scenes in three.js, but as long as those settings are correct I would expect lighting intensity to be similar.

I will definitely go back and triple check the color spaces of the blender and threejs files, but surprisingly as noted in this github issue:

Blender currently uses watts as its standard light measurement whereas gltf (and threejs) uses the candela as its measure. One of the posters in the github issue generously posted some of the conversion formulas, but the numbers I was getting weren’t lining up with the visuals. I then went back to the documentation and noticed that the luminous intensity (candela) figure I needed was not just the intensity value of the light, but the intensity multiplied by the color. So in order to calculate the values I need, I think I need the rest of the formula. Does that sound right? Let me know if I’m off somewhere.

Thanks!

1 Like

And just to add, I’m coming from more of a design background than a programming background so my math abilities/knowledge probably aren’t where they would need to be in order to make some of the more advanced calculations (matrices mostly). —Thank you!

Ah, until they fix that bug I guess you’ll have to perform the conversion yourself. If you put Φe = 1 (watts) in the point light conversion calculations you get a ratio:

candela_{point} = \frac{683}{4\pi} = 54.35

So, to convert a point light intensity in watts to candela, divide by 54.35.

Looking like the calculation for spot lights requires some integration, but at a guess you might get decent results by replacing the 4pi in the above equation by the spotlight angle. So if the spotlight has an angle of 90 degrees (pi radian), the equation becomes:

candela_{spot90} = \frac{683}{pi} = 217.4

Or in other words, for a spotlight with an angle of 90 degrees, 1 watt = 217 candela. Note this is a guess, I would test a simple export with one spotlight from blender to see if it gives a decent result. If not, you’ll have to study the linked PDF from that issue to figure out the correct formula.

I’m also not sure what you need to do for directional lights. I guess first figure out what units Blender uses for them and then try to find a conversion formula.

Hello! I just wanted to follow up with my findings on this issue in case it could help out anybody else in the future. Before I posted initially, I just tried to eyeball the correct intensity values for the lights that were imported from the Blender GLTF.

I found that a value of about 10% of the original “Watts” value from Blender was pretty close. But I wanted it to be as close to the original as possible since this 3d implementation was going to be only one of the uses across multiple platforms.

So, as I mentioned above and as @looeee helped me out with, I found some conversion formulas in a github post that discussed this issue. But unfortunately the formula that @looeee provided seemed to still be missing something when I tried to implement it. So I tinkered around a bit and finally found something that seemed to make it work. Here’s how it went:

Base values:
KV = 683 – This is a constant related to the modern definition of the candela
Watts – Unit of light measurement used in blender
Lumens – This seems to be an unnecessary intermediary conversion, but it keeps the formulas simpler
Candela – Unit of light measurement used by GLTF
Color – According to Threejs documentation part of the formula for candela calculation
Intensity – Unit of light measurement used by Threejs, second part of the threejs candela calculation

Base formulas:
Watts * 683 = Lumens
Lumens / 4π = candela
Color * intensity = candela

So after combining the formulas into a single equation, I got:

Color * Intensity = \frac{683 * W}{4π}

So to get the intensity value I needed for threejs:

Intensity = \frac{683*W} {color *4π}

My problem was: what the heck was “color”? After some more looking around and testing, I guessed that “color” might be the actual light wavelength of the source light. My light was white (6500K) and to get that wavelength, I averaged the top and bottom numbers on this converter and I came up with:

WhiteLight = approx. 570nm.

Substituting that in, I could get the calculation:

Intensity = \frac{683 * W}{570 *4π}

Multiplying it out I got

approx. 0.0954 * W

is the intensity value needed to correct for the numbers coming out of Blender (for white light specifically). It’s so close to my estimation of 10% that it makes me wonder if it was even worth all the time I spent figuring it out.

Honestly? It looked absolutely perfect when I applied that multiplier. Am I sure that 570 was the right number to use? Not totally, but it seemed to work.

Sorry for the overblown narrative, I hope this helps someone else. Thanks!

1 Like

That looks good, I was missing color from my equations.

The constant 683 is chosen based on a wavelength of 555nm (green) since that’s where human vision is most sensitive. You should probably use this throughout the calculation, but in any case the difference will be pretty small compared to 570nm.