Download

Lighting - Exposure and intensity units confusion

I’m very confused of how should I set physically correct values for the lights that I’m using. If I use manual metering mode with default camera settings it seems like the lux intensity that I put in directional light is physically correct so I can get a lux sunlight chart from the internet and ie. copy the value of 10752 lux into directional light to make it sunny just like the chart says. The problem here is that one unreal tutorial from epic games says that big intensity values that have to be set with manual metering mode may cause lightmass problems.

But then if I use auto exposure histogram metering mode, lighting changes drastically, even tho values are unchanged, and it still uses the same lux units which is very confusing.

So my question, is there any mathematical formula that I can use so I can always set a physically correct light if I want a sunny day or maybe an overcast etc? Or maybe I’m approaching it all wrong? Right now for me it seems like those values have to be eyeballed because that’s what every lighting tutorial does.

And second question, is any of ue4 metering modes the one that is usually used in photorealistic graphics throughout the entire project or does it change heavily?

Where did you read this? This is the first I’ve heard of it.

Yes… sort of. In that, it is possible to calculate an exposure value given the luminance of the scene, this is what the auto exposure metering modes do. But normally you will want some artistic control over the result.

When working with physical lighting values you will want to enable “extend default luminance range” in the project settings. UE4 uses EV100 for exposure, by default defining a value of 9.91 apparently. Not sure why. According to wikipedias Exposure Value article, 10,752 Lux would correspond to an EV100 value of roughly 12. Which given the default of 9.91, is an exposure compensation of -2.09. Which from my quick test seemed reasonable.

If you’re talking only about light intensity, I think you’ll have to eyeball it (for the sun at least). Using a chart is probably a useful starting point though.

The documentation covers the difference between them, but in general the primary difference between Auto and Manual is that with manual exposure you have to set it yourself, auto exposure dynamically adjusts the exposure according to the luminance of what is on screen.

Typically, if the user has free control over the camera such as in an FPS or TPS game, you will want to use auto exposure because the desired exposure can change drastically depending on what direction the camera is looking. In my experience, in order to get good results out of auto exposure in scenes with strong lighting changes you will usually need to set up a compensation curve and min/max limits, you’ll want to read the docs to understand how to set this up. Fair warning, it can be a bit tedious. In areas where the screen luminance isn’t changing very much you can often get away with just using a fixed compensation value and min/max limits without a curve.

If you’re this is a cinematic, or you have a relatively fixed camera, or any other situation where the player does not have free reign of where to point the camera, it is usually much faster/easier to just set your exposure manually.

Here are two timestamps:

So understanding that intensity of atleast directional light is pretty much an eyeball, if I’m using auto exposure instead of manual in the enviroment which doesn’t have a complex lightning and doesn’t need compensation curves. is the “Exposure compensation” also an eyeball/ more of an artistic control?

The statement about fog not working correctly with extended values for physical units is wrong. Fog works perfectly fine, but by default it’s limited to the display range of 0 - 1. You’ll need to manually set the color’s value higher so that it’s within range of the scene’s luminance. Just think of it as an emissive source, which is measured in cd/m². Using the Pixel Inspector to sample an HDRI skybox’s horizon Scene Color(also in cd/m²) can get you 90% there for a fog color that is both in the necessary luminance range as well as relatively similar color to the skybox(give or take, depending on how complex the environment is in the HDRI).

I’m not going to say the Lightmass comment is wrong, but I personally haven’t had any Lightmass-specific issues since the physical units improvements of ~4.20(or .21?) and I’ve been baking almost exclusively.

Directional Light intensity is not entirely Lux, although it’s a common occurrence with renderers. Lux is a unit of illuminance, which is the measurement of light falling onto an area. Unless you can block out all ambient light from the sky, the Lux measurement you get from an illuminance meter is not the sun light intensity - it’s the combined intensity of sun and sky(plus any bounce light or occlusion from nearby surfaces). Use the meters in the Eye Adaptation viewmode to measure illuminance, but do it on a diffused, white plane(in most cases horizontally placed in the scene). It’ll provide EV scaled for 18% gray(so similar to a spot meter), in which you can set the manual exposure or auto exposure to cover. Or, if you want the nominal EV(as provided by log2(illuminance / 2.5)) I have the modified shader that includes both for 4.26, and just nominal EV for older versions here: CustomUE4/Shaders at master · bleleux/CustomUE4 · GitHub

Extended luminance is a must if you’re working with physical lighting units since it allows exposure to be expressed with physical units(EV) as well, otherwise the min/max values need to be scaled much higher, such as a max value of 10,000+. With EVs and auto exposure, you just need to set the min/max value accordingly to your scene. There’s charts that provide examples of where certain EVs are commonly used, but you can use the meter mentioned above to get your exact values. Manual metering is no different since it all converts to EV, but it limits you to a fixed exposure.

I believe that I measuared EV Grey properly just like you described: Exposure Value and using your shader it gives me a EVGRY of ~2.05. I don’t understand what should I do with it now, how much exposure should I compensate based on this value? And I also expected that when I start moving exposure compensation then EVGRY will also start changing but it didn’t.

And even after figuring out the exposure compensation value for this one scene how do I blend this together with all different scenes/ light scenarios which will end up with a different EV Grey and in theory the exposure compensation value should be different?

The exposure doesn’t change the EV outputs because they’re the lighting/surfaces *before *exposure. The EVGRY(EV100 if using the default UE4 shader) and EVLUX values are the specific exposure values you can use based on the measured surface and lighting. EV is covered here Exposure value - Wikipedia and how it correlates to the amount of light in the scene Exposure value - Wikipedia

If measuring on a white card, EVLUX tells you the nominal exposure value necessary for the amount of light hitting that card. You would place the card in an area where you want to expose for(in direct light, in shadow, etc). This is the behavior of an incident light meter used in film/photography where you expose for the light and not necessarily the surface.

EVGRY will provide the exposure value to use to make the surface middle gray. If measuring something brighter than 18% gray, this can have the side effect of making it dim and conversely if measuring something below 18% gray becoming brighter - just like a real camera’s auto-exposure. So ideally this value is only used if measuring an 18% gray card. This is the behavior of a spot meter, where you’re exposing for the surface based on the lighting.

Once you have that EV, you plug it into your Post-Process Volume, camera, or viewport. The PPV/camera will default to not expressing exposure in EVs, so you need to have Extended Luminance Range enabled in the project settings.

So, let’s say with the EV of 2, you might use a min/max EV of 1/3 respectively, or if you measured in shadow and got a -2, you could do -2/2. It’s up to you how much you want to under/over expose, but the provided EV values are the “correct” exposure depending on what you measure.

There’s no simple way to blend unfortunately. You just rely on the PPV blending or use a wide enough range to allow adaptation in most situations without the need for adjustments.

And exposure compensation defaults to 1 in 4.26, it should just be set to 0 unless you specifically want to add an additional compensation value.

Go the extra candela and toss a material parameter collection scalar in there.
Then set the MPC value as the same value obtained directly from whatever component during the construction script.

I assume, you could also go the extra lux and pull the table / use the value in engine by searching the table.

Also, taking it one step further… since this only needs to happen editor side as you set the scene up.
what about a bluetility that reads the exact value off a render target?

Basically you make an actor that you toss in the scene, click the bluetility button, and it adjusts the MPC for you automagically…

the BP would have to “clone” the scene camera for the settings (might need to be a variable you select for games since you have many and possibly even nested cameras. Potentially child actors, so its not overly simple).
and then render the scene to a RT.

… they made this quite easy. You don’t even have to cast and loop the BP for variables, or set up an endless pin connection.
https://docs.unrealengine.com/en-US/…ure/index.html

The RT can probably render just the test card. Which is also “disabled in game”.

The pixel reading is C++ only. But there is a function in the Rama’s Extra Node plugin, so basically you don’t even need to bother coding anything…

… sort of makes you wonder why Epic hasn’t just made their own system for this?