glTF light intensity requires unit conversion #91035

Closed
opened 2021-08-29 19:29:31 +02:00 by Pete Chown · 15 comments

System Information
Operating system: Ubuntu Linux 20.04
Graphics card: RTX 2080 Ti

Blender Version
Broken: 2.93.3
Worked: None as far as I know

Short description of error

When point lights are exported to a glTF file, it looks as though the intensity is supposed to be expressed in candela . In Blender, the intensity is expressed in watts; presumably it's the amount of illumination you are supposed to get from an incandescent bulb of that power. Unfortunately no unit conversion takes place during export, so for example a 100W bulb in Blender will be exported as a glTF light of intensity 100 candela.

Exact steps for others to reproduce the error

  1. Open Blender with the default scene.
  2. Select the light and observe that the power is 1000W.
  3. Export as glTF. Select Format/glTF Embedded and Include/Punctual Lights.
  4. Examine the glTF file in a text editor and observe that the intensity is 1000 under extensions/KHR_lights_punctual.

I hope this is helpful. If you need anything else please let me know, and thank you for your hard work on Blender!

**System Information** Operating system: Ubuntu Linux 20.04 Graphics card: RTX 2080 Ti **Blender Version** Broken: 2.93.3 Worked: None as far as I know **Short description of error** When point lights are exported to a glTF file, it looks as though the intensity is supposed to be [expressed in candela ](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual#light-shared-properties). In Blender, the intensity is expressed in watts; presumably it's the amount of illumination you are supposed to get from an incandescent bulb of that power. Unfortunately no unit conversion takes place during export, so for example a 100W bulb in Blender will be exported as a glTF light of intensity 100 candela. **Exact steps for others to reproduce the error** 1. Open Blender with the default scene. 1. Select the light and observe that the power is 1000W. 1. Export as glTF. Select Format/glTF Embedded and Include/Punctual Lights. 1. Examine the glTF file in a text editor and observe that the intensity is 1000 under extensions/KHR_lights_punctual. I hope this is helpful. If you need anything else please let me know, and thank you for your hard work on Blender!
Author

Added subscriber: @PeteX-2

Added subscriber: @PeteX-2
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Added subscriber: @scurest

Added subscriber: @scurest

There is also a report on the addon's tracker: https://github.com/KhronosGroup/glTF-Blender-IO/issues/564

There is also a report on the addon's tracker: https://github.com/KhronosGroup/glTF-Blender-IO/issues/564

Added subscriber: @Grady

Added subscriber: @Grady

How is the conversion handled for non-point lights?
Sun lights, area lights, spot lights, what units should they be expressed in?

How is the conversion handled for non-point lights? Sun lights, area lights, spot lights, what units should they be expressed in?
Point candela (lm/steradian)
Spot candela (lm/steradian)
Sun/Directional lux (lm/m^2)
Area doesn't exist in KHR_lights_punctual, the exporter just skips these
| Point | candela (lm/steradian) | -- | -- | | Spot | candela (lm/steradian) | Sun/Directional | lux (lm/m^2) | Area | doesn't exist in KHR_lights_punctual, the exporter just skips these

Added subscriber: @donmccurdy

Added subscriber: @donmccurdy

Taking point lights as an example, I believe the conversion ought to go like this:

watts = blender_lamp.energy
LUMENS_PER_WATT = 683
PI = 3.14159
candela = watts * LUMENS_PER_WATT / (4 * PI)

For a 20W Point light, this produces 1087 cd. However, I've tested three different engines that all claim to do point lights in units of candela, and they're all consistently overexposed compared to the original Blender scene. In the test case I've got, 1cd produces a result much closer to the Blender original. But I don't have any way of knowing whether I'm just off by a constant factor here. I'm also a bit confused that the conversion table in the Blender documentation (see https://docs.blender.org/manual/en/dev/render/lights/light_object.html#power-of-lights) does not appear to use anything like the conversions above. It states that a candle is comparable to a 0.05 W point light in Blender. But the expression above yields .05 * 683 / (4*PI) = 2.71 cd. Any idea I'm missing here?

Taking point lights as an example, I believe the conversion ought to go like this: watts = blender_lamp.energy LUMENS_PER_WATT = 683 PI = 3.14159 candela = watts * LUMENS_PER_WATT / (4 * PI) For a 20W Point light, this produces 1087 cd. However, I've tested three different engines that all claim to do point lights in units of candela, and they're all consistently overexposed compared to the original Blender scene. In the test case I've got, 1cd produces a result much closer to the Blender original. But I don't have any way of knowing whether I'm just off by a constant factor here. I'm also a bit confused that the conversion table in the Blender documentation (see https://docs.blender.org/manual/en/dev/render/lights/light_object.html#power-of-lights) does not appear to use anything like the conversions above. It states that a candle is comparable to a 0.05 W point light in Blender. But the expression above yields .05 * 683 / (4*PI) = 2.71 cd. Any idea I'm missing here?

Added subscriber: @WCN

Added subscriber: @WCN

It states that a candle is comparable to a 0.05 W point light in Blender. But the expression above yields .05 * 683 / (4*PI) = 2.71 cd.

About this specifically, I think that's a red herring. "0.05" feels like the kind of number that's meant to give a ballpark estimate more than an exact definition. It might just be a big candle— Or a candle meant to show up better in renders that will inevitably be shown on low-dynamic-range monitors. Actually, if anything, I'd be inclined to interpret the fact that the conversion shifts the value by three (Base-10) orders of magnitude and still ends up at roughly one candela as a sign that the conversion ratio of 683 is appropriate for Blender.

May be worth pointing out too that the values in that table also all have vastly different conversion ratios from each other. The lowest ratio is 227, and the highest is 556. Even between lights of the same type there is significant variation. To me that feels like an artist at the Blender Institute/Foundation arrived at those exact values through trial and error and copied and pasted them from their personal notes as a rule-of-thumb guide when they were writing the documentation.

> It states that a candle is comparable to a 0.05 W point light in Blender. But the expression above yields .05 * 683 / (4*PI) = 2.71 cd. About this specifically, I think that's a red herring. "0.05" feels like the kind of number that's meant to give a ballpark estimate more than an exact definition. It might just be a big candle— Or a candle meant to show up better in renders that will inevitably be shown on low-dynamic-range monitors. Actually, if anything, I'd be inclined to interpret the fact that the conversion shifts the value by three (Base-10) orders of magnitude and still ends up at *roughly* one candela as a sign that the conversion ratio of 683 *is* appropriate for Blender. May be worth pointing out too that the values in that table also all have vastly different conversion ratios from each other. The lowest ratio is `227`, and the highest is `556`. Even between lights of the same type there is significant variation. To me that feels like an artist at the Blender Institute/Foundation arrived at those exact values through trial and error and copied and pasted them from their personal notes as a rule-of-thumb guide when they were writing the documentation.
Member

Added subscriber: @JulienDuroure

Added subscriber: @JulienDuroure
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Julien Duroure self-assigned this 2022-10-21 21:24:56 +02:00
Member

Fixed by 9d903a93f0

Fixed by 9d903a93f03b
Sign in to join this conversation.
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#91035
No description provided.