Automatic brightness adjustment (exposure) #3786

Open
HybridDog opened this Issue Aug 17, 2016 · 5 comments

Projects

None yet

3 participants

@HybridDog
HybridDog commented Aug 17, 2016 edited

l don't know if it's implemented already but l doubt it.
The light intensity recorded by a camera (or the eye) is not equal to the real intensity, there's exposure.

There's a simple explanation about exposure and it's impact on the image:
http://web.archive.org/web/20160305200308/http://freespace.virgin.net/hugo.elias/graphics/x_posure.htm

In reality light is not a value inside ℤ ∩ [0; 255] but ℝ⁺, isn't it?
You could say n photons arrive in t seconds, the photocell counts them and then the value is multiplied that the final image is not too bright (sunshine) or too dark (night).
t is the time the shutter is open and n has to do with the intensity

l don't know how to explain this correctly.
light = (1 - exp(-reallight * b)) * a;

If the values are inside [0; 1], this can be used on each pixel:

/*
average_brightness  b     a

0.1  6.9216142999862      1.0009872101959
0.2  3.2812798961849      1.0390475388339
0.3  1.8010717753886      1.1977795369103
0.4  0.82216323430739     1.7840574297201
0.5  8.1838768211219e-12  122191161173.47
0.6  -0.82216323430739    -0.78405742972006
0.7  -1.8010717753886     -0.1977795369103
0.8  -3.2812798961849     -0.039047538833918
0.9  -6.9216142999862     -0.00098721019590494
*/
    float b = 1.8010717753886 ;
    float a = 1.1977795369103;
    col.rgb = (vec3(1.0) - pow(vec3(e), -col.rgb * b)) * a;

average_brightness is the previous delta brightness, the new one is 0.5
So if you see the sun on the screen, the stars are hardly visible, and if you look into free space, they become brighter and maybe even far galaxies can be seen.

@impaktor
Member
impaktor commented Aug 17, 2016 edited

light is not a value inside ℤ ∩ [0; 255]

for your monitor on which you play pioneer, I expect it is.

So you want space to be black when you look at the sun? There already is a halo of light around the sun, "blinding" you, and obscuring the stars.

I don't think of this as a bug.

@HybridDog

So you want space to be black when you look at the sun? There already is a halo of light around the sun, "blinding" you, and obscuring the stars.

l would like the stars to become darker not just because there's a halo. If you are near the sun and watch it so it's on your screen the delta brightness is high and you should see the sun surface (the patches etc.) but if you are far away from the sun and it's just a dot on the screen the delta brightness is rather low and the sun should be very bright in comparison to the space.

@HybridDog

l saw that giftbot at wikipedia links missing pages to an archived version, the exposure page is there:
http://web.archive.org/web/20160305200308/http://freespace.virgin.net/hugo.elias/graphics/x_posure.htm

@fluffyfreak
Contributor

I suppose you could do that as post-process effect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment