Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KHR_lights_punctual: Support intensity #18

Closed
Moguri opened this issue Sep 3, 2019 · 1 comment
Closed

KHR_lights_punctual: Support intensity #18

Moguri opened this issue Sep 3, 2019 · 1 comment

Comments

@Moguri
Copy link
Owner

Moguri commented Sep 3, 2019

Support intensity property for KHR_lights_punctual

@Moguri
Copy link
Owner Author

Moguri commented Sep 9, 2019

This can be multiplied into the color value. Blender 2.7x was using watts for power already and blendergltf was just multiplying this into the color value. In other words, for spot and point lights, if we convert the luminous intensity (candela) value back to power, we can then multiply that value with the color. This snippet found in this Blender glTF IO issue should help:

- Kv (683) - maximum spectral luminous efficacy of radiation for photoscopic vision,
  for 555 nm wavelength, that is most perceptually efficient for human vision
- Φe - radiant flux [watts]
- Φv - luminous flux [lumens]
- Iv - luminous intensity [lm/sr or candela], what KHR_punctual_lights mandates for point lights
--
Φv = Kv * Φe
Iv = Φv / 4PI
=>
Lv = Kv * Φe / 4PI // for point light source

In other words, we want to multiply color by Φe, which we get by:

Φe = Lv * Ω / KV
Where Ω is the solid angle of the shape:
  * 4PI for sphere
  * 4PI * sin^2(θ/2) for a cone with an angle of θ
Where Φe is 683

For directional lights and KHR_lights/Blender 2.7, we would multiply the Irradiance (watt/m2) against the color. I am not sure how accurate this is, but it seems like as good a place as any to start. KHR_lights_punctual gives us an intensity value for directional lights in lux (lm/m2) that we need to convert into watts/m2. To get watts from lumens (lm) is Φe = Φv / Kv, which I think should also work for getting watts/m2 from lux (i.e., using a conversion factor of 1/Kv).

Another note, this all assumes 100% luminous efficiency, which is probably okay.

@Moguri Moguri closed this as completed in 2b36a10 Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant