RE: [Algorithms] un/re gamma (was: Mipmap generation)
Brought to you by:
vexxed72
From: Jack M. <ja...@re...> - 2003-04-25 20:17:31
|
Some of it is explained here (there's other resources, it's one of the first I found on google :-) ): http://www.poynton.com/PDFs/Mac_gamma.pdf Basically, to get it into linear, it's: pow ( ( x + 0.099 ) / 1.099, 1.0 / 0.45 ) (where x is between 0 and 1) and to get it back: ( 1.099 * pow ( x, 0.45 ) - 0.099 ) That's assuming a monitor gamma of 2.22 (1/0.45) So for our box filter, we just go: out = gamma_correct_up ( ( gamma_correct_down ( pixels[0] ) + gamma_correct_down ( pixels[4] ) + gamma_correct_down ( pixels[bytestride] ) + gamma_correct_down ( pixels[bytestride+4] ) ) / 4.0 ); and that gave us much better results for mipmaps. Jack -----Original Message----- From: Stephane Etienne [mailto:set...@sa...] Sent: Friday, April 25, 2003 1:47 PM To: gda...@li... Subject: RE: [Algorithms] un/re gamma (was: Mipmap generation) How do you un-gamma and re-gamma an image? -----Original Message----- From: gda...@li... [mailto:gda...@li...] On Behalf Of Tom Forsyth Sent: Friday, April 25, 2003 3:23 AM To: gda...@li... Subject: RE: [Algorithms] Mipmap generation Depends how you generate your mipmaps. If you just use a box-filter, then the two will give exactly the same results (ignoring loss-of-precision problems). If you use a fancier type of filter, then you probably want to do it from the top level each time. It's obviously slower though. It's been mentioned in a couple of places that ideally you should un-gamma your texture, then do the mipmap generation, then re-gamma the texture. This means you do your filtering in linear space (where the maths actually makes sense) rather than gamma-corrected space. Tom Forsyth - Muckyfoot bloke and Microsoft MVP. This email is the product of your deranged imagination, and does not in any way imply existence of the author. > -----Original Message----- > From: Jakes Mo [mailto:Mojo@MagentaSoftware.com] > Sent: 25 April 2003 12:10 > To: GDAlgorithms (gda...@li...) > Subject: [Algorithms] Mipmap generation > > > Is better to generate a mipmap from the previous-level mipmap > or from the > top-level mipmap? I suspect that the former is better for > anti-aliasing and > the latter is better for detail, so it depends on what I'm trying to > achieve, or am I totally out of my depth here? ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ GDAlgorithms-list mailing list GDA...@li... https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=6188 ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ GDAlgorithms-list mailing list GDA...@li... https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=6188 |