Jump to content
  • Advertisement
Sign in to follow this  
Silverlan

3D How to use Lux as unit for directional light intensity?

Recommended Posts

I would like to use Lux as the unit for light intensity values of the directional lights in my engine, but I'm not sure how that would actually work. Lux describes the light intensity for an area, but how would I translate that to the light intensity for a fragment? As far as I know, both Unity and Unreal use Lux as unit, and the glTF light source specification uses it as well, so it's obviously possible somehow? I can't find any references on this topic whatsoever.

I assume I have to calculate the size of a fragment in world units? If so, how would one do that?

Share this post


Link to post
Share on other sites
Advertisement

Lux is basically the photometric equivalent of irradiance: they're both units of flux density. For a punctual directional light computing irradiance/illuminance is really simple: you multiply the intensity of the directional light by N dot L. This means your dirlight intensity is essentially "Illuminance on a surface that's perpendicular to the directional light". 

If you then want to apply physical camera exposure values to your rendered luminance values in an HDR framebuffer, you can follow through this blog series.

Share this post


Link to post
Share on other sites
8 hours ago, MJP said:

Lux is basically the photometric equivalent of irradiance: they're both units of flux density. For a punctual directional light computing irradiance/illuminance is really simple: you multiply the intensity of the directional light by N dot L. This means your dirlight intensity is essentially "Illuminance on a surface that's perpendicular to the directional light".

Thank you, although I'm not quite sure I understand.

The intensity of my directional light source is defined in Lux. Or, to be more precise, the directional light source doesn't actually have an intensity, I'm just defining the illuminance of all surfaces being lit by the light source in Lumen per square-meter. That means I already have the illuminance, but I'm not sure what to do with it.

For spot- and point-lights I define the intensity in Lumen, then convert that to Candela and multiply that with my light color. I'm not 100% sure that's correct, but the results seem to match what I'd expect it to look like.

Now for directional light sources, I could convert the Lux to Candela as well:

cn = lx /sr

(cn = candela, lx = lux, sr = steradians)

The sun is a sphere, so the solid angle should be 4πsr. That means for 100 Lux, I end up with cn = 100 /4π = 7.96 Candela. For 10,000 Lux, I get 795.77 Candela. I suppose that does sound like it may be correct, but I'm not sure.

Am I on the right track, or am I completely off?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!