Skip to main content
GameDev.net gamedev.net
🔒 Locked

GL_LUMINANCE8 performance

Started by Tree Penguin Jan 6, 2007 at 5:18 PM 1 replies 2.3k views
Original Post
Tree Penguin
Tree Penguin
Hi, i am trying to render a colored scene to grayscale. What i'm doing now is rendering the scene, copying it to a GL_LUMINANCE8 texture and drawing that texture to the framebuffer. This works great but GL_LUMINANCE8 gives me very bad performance, i get about one tenth the framerate i get when i just use gl_rgb8. I guess this is because of the per pixel luminance calculation. Is there a way around this problem, or is there a cheaper way to create greyscale? The code has to run without the use of pixelshaders. I don't really care about the greyscale quality, as long as it's 8 bit and roughly (r+g+b)/3, it doesn't have to be some official luminance calculation.
Tree Penguin
Tree Penguin
Thanks, didn't think of that yet.

By the way, the colors in the texture must be in the 0.5-1.0 range for the dot product to work.

EDIT: same for the primary color, (0.5+0.5*0.30, 0.5+0.5*0.59, 0.5+0.5*0.11) works great.

[Edited by - Tree Penguin on January 6, 2007 8:27:47 PM]
bakery2k1
bakery2k1
Rather than giving equal weight to each of the RGB channels in your greyscale conversion, you'll probably get better results if you give green the highest weight, followed by red, then blue. This more accurately reflects the way the human eye responds to color.

Generally, the coefficients used are (0.30, 0.59, 0.11). You can use these in your current setup by simply changing your primary color to (0.30, 0.59, 0.11, 1.0).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.