Jump to content

  • Log In with Google      Sign In   
  • Create Account


Calculate average luminance of image with mips


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 B_old   Members   -  Reputation: 659

Like
0Likes
Like

Posted 04 January 2013 - 02:57 PM

What do people use nowadays to calculate the average luminance for an image (e.g. for use with tonemapping)?

 

Right now I'm just generating the mips for a luminance map of my scene, starting from whatever the image resolution is. Most of the time those are non-power-of-2 resolutions, so I guess the results could get a bit funky. Indeed I sometimes notice very different behavior for different resolutions that I cannot account to anything else.

 

One approach that I have seen is to render the luminance map into a square, power-of-2 target before generating the mips. But won't the average luminance be too high in that case, if the original image has a common 16/10 or 16/9 ratio? Could this error be minimized by using a 2/1 luminance map?

 

Or is it better to simply calculate the average in one step (e.g. with a GPGPU-API)?

 



Sponsor:

#2 MJP   Moderators   -  Reputation: 10949

Like
1Likes
Like

Posted 04 January 2013 - 04:44 PM

If you can use compute shaders the best way to do it (IMO) is with a parallel reduction. You still have to do multiple passes, but less passes than generating a full mip chain. If you download the demo from here you can see how I do it.



#3 B_old   Members   -  Reputation: 659

Like
0Likes
Like

Posted 07 January 2013 - 02:58 AM

Thanks, I'll take a look at that.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS