Compute average luminance of current display.

about everything
  • Author
  • Message
Offline
User avatar
*blah-blah-blah maniac*
Posts: 17440
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: Compute average luminance of current display.

Don't think that you will notice performance drop on such math at all, because cycles with them required to see difference or very long code. But always pay attention to low performance math which is log, pow, normalize, /, sqrt, exp, dot and of course texture reading.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
*blah-blah-blah maniac*
Posts: 565
Joined: 05 Apr 2014, 10:29
Location: Taiwan

Re: Compute average luminance of current display.

uhh, sorry to bump this,
but can any confirmed ENB adaptation is log-avg? or is it already scaled with middle gray for postprocess??
_________________
Intel Xeon L5639 6C12T @3.96GHz | Gigabyte ga-x58a-ud3r | MSI GTX680 4G | 48G RAM | Intel 760p Nvme w clover bootloader
Flickr
YouTube

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17440
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: Compute average luminance of current display.

I've never said about log or middle gray. If you don't understand, the only thing left is math of pixel shader:

Code: Select all

float3 average;
float3 maximum;
float3 current=tex2D(sampler, uv);
for (i=0; i<pixelcount; i++)
{
    float3 temp=tex2D(sampler, offset[i] + uv);
    average+=temp;
    maximum=max(current, temp);
    pixelcount++;
}
average/=pixelcount;
result=lerp(average, maximum, AdaptationSensitivity);
result=max(result, AdaptationMin);
result=min(result, AdaptationMax);
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
*blah-blah-blah maniac*
Posts: 565
Joined: 05 Apr 2014, 10:29
Location: Taiwan

Re: Compute average luminance of current display.

Cool, thanks for the quick reply.
good to know this kinds of stuff.
_________________
Intel Xeon L5639 6C12T @3.96GHz | Gigabyte ga-x58a-ud3r | MSI GTX680 4G | 48G RAM | Intel 760p Nvme w clover bootloader
Flickr
YouTube

Offline
User avatar
*master*
Posts: 229
Joined: 21 Feb 2013, 03:21
Location: Los Angeles, CA

Re: Compute average luminance of current display.

Phinix wrote:Thanks for the help guys!
Helios Double Six (number 6?)
Two different people.
_________________
i7-4970K 4.8ghz, 16gb ram, Geforce Titan X 12gb vram, win7
Post Reply