Directional Light Calculating by using EV100

This topic is 1197 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Recently I implemented some punctual lights (spot and point) with everything I learned from Frostbite's course in Sig'14. By the advice of Sebastien Lagarde in his course, I used 'Luminous Power' (i.e. lm) as the measure unit for the light intensity. Everything is fine and I am so excited.

But unfortunately, I found some difficulty to implement the simplest Directional Lighting... because I couldn’t found some ‘fall-off’ term by distance. I have learned from the course that EV100 is a suitable measure for luminance, and the equation for converting the EV100 to luminance is: L=2^(EV100-3). So I just simply used this L to calculate the diffuse & specular values, without any 'fall-off' terms. My pseudo-code is shown below:

float3 L = pow(2, EV100) * 12.5f * 0.01f;  //i.e. 2^(EV100-3)

float3 l = normalize(-light.dir);  //dir to light

float NoL = dot(l, n);

float3 diffuse = L * NoL;  //without any 'fall-off' terms...because directional light DO NOT has any punctual position..

float3 specular = NormalizedBRDF(...) * L * NoL;  //The BRDF is correct and normalized. so I ommited its details here.

I have also learned from the web that in a real scene for the day-light, its typical EV100 value is something about 14. But when I directly used the EV100(14) to test my directional light, something was definitely wired…My result picture is shown below. The whole picture is obviously OVER-EXPOSURED. I don't know why I couldn't get any 'natural lighting' sense from it. For comparition purpose I also attached my result of EV100=4.

I used FP16bit RT to render the scene, all results are gamma-corrected and I have also tried some tonemapping, but little helps... What‘s wrong about it? If I missed something (such as auto-exposure etc.)?

Any suggestion would be greatly appreciated, thanks!

[sharedmedia=core:attachments:29322]
Edited by neoragex

Share on other sites
How are you exposing your scene? If you're going to use real-world luminous intensity values for your directional light, then you will not to match that with an appropriate exposure for it to look like a properly-exposed image.

Share on other sites

To further MJPs point, tonemap before gamma correction, just in case you have that backwards.

Share on other sites

How are you exposing your scene?

I didn't do any exposing in my first thread. By your advice, I have tried to do some auto-exposing?also with some manual adjustment for its parameters. What I got is shown below. I used the Erik Reinhard's method (Photographic Tone Reproduction for Digital Images, Sig'02; Equation 2.) to get this result.

But unfortunately even so I failed to calibrate the lighting exposure with its background cubemap (HDRI)... The background (and the windows) seems too dark, and the EV100 dir-lighting seems too bright. I dont know is that correct at all... In fact I am not sure this calculating method for directional lights is correct or reasonable, so I think I need some kindly suggestions indeed. I also learned from the Frostbite's course that they used an area disk light to calibrate the sunlight, instead of a directional light with EV100. So I am wondering if there is something wrong for my understanding about directional lighting calculated by EV100...

If you're going to use real-world luminous intensity values for your directional light, then you will not to match that with an appropriate exposure for it to look like a properly-exposed image.

Are you suggesting me when I used real-world luminous intensity values for my lighting I MUST use some appropriate exposure for it? But what's the appropriate exposing method for this situation (directional lighting with EV100)? and more exactly , What's the appropriate real-world measuring unit that I SHOULD use for my directional lights to help me match the natural scene more easily? Can you explain it with a little more details? I would be much appreciated for that.

Edited by neoragex

Share on other sites

To further MJPs point, tonemap before gamma correction, just in case you have that backwards.

Thank you for your kindly reply, too. Maybe I haven't express my pipeline very clearly. I have confirmed that I do the tonemap before the gamma-correction. This Over-exposing situration can only exist under the circumstances of my directional lighting with EV100. The result of my spot/point lighting seems correct and be calibrated with the scene.

Edited by neoragex

Share on other sites

The simplest exposure system is just pick a scalar that you multiply every pixel by. In your case you know that your light intensity is 2048, and so if you pick an exposure of 1/2048 then a purely white diffuse surface will end up being 1.0 after exposure. Another way you can do it is to emulate how exposure in a camera works. This makes sense in a lot of ways, since you're already using physical units thus standard camera formulas can be applied. I believe that the Frostbite paper discusses this a bit, but I would also recommend reading through Padraic Hennessy's excellent blog post on implementing physically based exposure. He even touches on how you can use the "Sunny 16" rule to pick an appropriate exposure for a sunny day.

I think the Padraic Hennessy's blog post is exactly what I need! Physical based Camera is a shining new topic for me. I haven't notice it until last year. And I did not even expect that so quickly I have to consider it. I will have some tries and post what I could get here.

Thanks for your kindly advices and I do appreciate it!

Share on other sites

Oh, I have found what's wrong with my method... because of 2 bugs in my exposing code?

BUG No.1? I clamped the minimum linear exposure value to 0.1....

In fact?just as what MJP said, if I used an EV100(14) dir-light?then I can make sure that the lambertian diffuse lighting intensity (maximum) is 2^(EV100-3)=2048, assume we only consider the diffuse lighting. If I want to expose this scene , I need some linear exposure as small as 1/2048=0.000488?Considering the additional specular lighting, I can expect the maximum luminance in the picture would be above 4000?because the fresnel reflection & PBR Specular for low roughness could be quit significant in my experience.).Then I concluded that I need some linear exposure as small as 1/4000=0.0002 to expose this single-light scene appropriately. My former clamped minimum exposure for 0.1 is absolutely not enough!

BUG No.2?In my model viewer, the environment cube DOES NOT receive the significant directional-light (EV100=14). Only the model receives the light.

But unfortunately the environment cube occupies a large area on the screen, even larger than the model does. I have used a simple full-screen log-avg method to get the avg. Luminance. This situration implies here is that the cube which does not receive the dir-lighting even has more effects on the value of avg Luminance than the model in focus, because I used log-avg here, instead of linear-avg. So I realized that I got a wrong avg. Luminance at all, and I should restrict the log-avg. caluculation in the screen area that the model occupies, even though this will inevitably lead to an unbalanced exposing for the cube at the same time.

After fixing above 2 bugs, I finally got some exposing that at least visually better than the formers that I have posted.

Edited by neoragex

• What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• 15
• 11
• 9
• 38
• 16
• Forum Statistics

• Total Topics
634128
• Total Posts
3015693
×