Luminance Rendering Without Shaders

I can’t find a way to render the luminance of the scene. The goal is to create a night vision effect that would render the luminance of the scene modulated in green. Does someone have a clue on how to achieve this without using shaders ?


Unfortunately, I can’t do that. This doesn’t modulate the luminance. If you have an object with no green component, let say a red ball, it will appear black ! I need to do something like this: G’ = L where L = xR + yG + zB, then do a colorMask( false, true, false, false ). I just don’t know how to make the hardware compute the Luminance… I need something similar to the extension GL_SGI_color_matrix.

The typical way of converting color to a luminance value is to dot the RGB color vector with (0.3, 0.59, 0.11). You can then place the resulting brightness in the green channel.

– Zeno

Ok, I agree with the theory, but can you give me more details on which methods I can use? I want this to be computed by the hardware. I know I can call glPixelTransfer and set the proper scaling factor for each of my components, but how can I put the result back in the green channel?

You should have a look at ARB_texture_env_combine and ARB_texture_env_dot3. These two extensions gives you all you need.

Follow Bob’s advice or use register combiners to perform the math. Do what Humus said to limit yourself to the green channel. Try to avoid pixel transfer if you’re want to do this real-time.

u mean like this? 3/4 way down
i think i just used readpixels (pretty quick if u do it right)
ill leave u to work out what to do with the data after youve read it (as its a nobrainer )

zed, you’ve been busy. That’s starting to look pretty darned good. Dunno if you ever saw a game called Virus on the Amiga, a very unique 3D scroller over terrain with a hover hover control using the mouse. It looks like you have a great engine for a revamp. Your screenshots are reminiscent of that game for some reason. Probably the angle of the shots and scale of the ships.

Thanks everyone! I’ve found the answer.
Using the color matrix of the imaging subset does all the job for us…

glMatrixMode( GL_COLOR );
glMultMatrixf( m );

and that’s it !

i remember that game, that was the follow up game done by the guy who done elite.
oddly IIRC it didnt get the praise it deserved cause if memory served correct it ran blindily quick (fast 3d graphics on an amiga, sure there were no textures but still a fabulous piece of programming)
one fault IIRC was it was difficult to control the spacecraft (it used quasi proper physics like lonar lander and not some gamephysics). unfortunatly im having to ‘dumb down’ the controls or else its too difficult to control.