Article View: comp.graphics.api.opengl
Article #78Re: Gamma & color blending
From: Angus Dorbie
Date: Sun, 23 Nov 1997 00:00
Date: Sun, 23 Nov 1997 00:00
76 lines
3737 bytes
3737 bytes
Michael Harrison wrote: > > On Tue, 18 Nov 1997 11:23:53 -0600, Steve Baker <sbaker@link.com> > wrote: > > >Michael Harrison wrote: > >> > >> I hope you'll pardon these two newbie questions, but since I'm new to > >> OpenGL... > >> > >> I am trying to add gamma correction to our opengl renderer and I > >> haven't found a good way to do this. For our software renderer I > >> simply change the current palette but under OpenGL I'm running in > >> 16bit color mode and don't actually have a palette. > >> > >> I also need to add color alpha-blending (say, to make every specified > >> rendered poly a little more red or green or whatever). With a > >> palette, it's simple. > > > >Gamma correction is not an issue for OpenGL - it's a function of > >your windowing system. The problem is that OpenGL only operates > >in the domain of a single window - and Gamma correction must be > >applied to the entire screen (with most existing hardware > >implementations). > > Unfortunately I live in the realm where most users don't understand > this or just can't change the gamma on their systems. Because of this > I need a gamma control (really just a brightness control) in my > program so they can lighten what may be a dark image on their system. > > If I can't affect the gamma (brightness) of the final output with I'll > just have to live with that. > > Any ideas on the color mixing? I could put an alpha poly over the > entire viewing area but that seems particularly inelegant. > Unfortunately this won't work, Steve is right, it's really a video level thing. There's a lot of ignorance w.r.t gamma even in expert circles. Ideally you'd like to render in some perceptually uniform space, with a gamma of .45 and let the typical CRT gamma of ~2.5 bring you back to linear brightness with perceptually uniform increments of brightness. But this is difficult, linearity is required for anti-aliasing, blending, accumulation etc. To get around this problem you need to render linearly in high precision, and gammawarp the image before it is sent to the DACs in the video HW and if you have enough precision Bobs your uncle. Another approach is to gamma warp your textures in the application and this will allow you to render some stuff in perceptually unioform increments of brightness but expect stuff like anti-aliasing to suffer if you use it. Gamma correction needs to be handled all the way from the database textures, lighting video HW & display device. Some video HW on the PC has no gamma adjustment which means you have to try and render non linearly to get anywhere. For the colour modulation I suggest you use either lighting or polygon colours and a modulate texture environment, for gamma correction in the renderer the only practical way is to adjust your textures (but this isn't card GFX card HW gamma). You can do some clever stuff with texture colour tables on SGI machines using the GL but video gamma is a separate issue. You can even adjust the video gamma table using a video API, but this isn't via OpenGL. Cheers,Angus.
Technical Details
Message-ID:
<3478C05E.167E@asd.sgi.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<64q9ai$66o$1@gte1.gte.net> <890D05DEBDDB08B8.981B135BEAAA47C8.415D6C2C9FAF35B7@library-proxy.airnews.net> <64t97p$eih$1@gte1.gte.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 100291,344bb75021d541c6 X-Google-Attributes: gid100291,public X-Google-Thread: f65bb,344bb75021d541c6 X-Google-Attributes: gidf65bb,public From: Angus Dorbie <dorbie.nospam@asd.sgi.com> Subject: Re: Gamma & color blending Date: 1997/11/23 Message-ID: <3478C05E.167E@asd.sgi.com> X-Deja-AN: 291959562 References: <64q9ai$66o$1@gte1.gte.net> <890D05DEBDDB08B8.981B135BEAAA47C8.415D6C2C9FAF35B7@library-proxy.airnews.net> <64t97p$eih$1@gte1.gte.net> Organization: Silicon Graphics Newsgroups: comp.graphics.api.opengl,3dfx.opengl