(This is a long-winded post. Sorry, but I don’t think I have the verbal skill to convery the situation in just a few words).
I am seeing some sort of weird periodic mesh that has got me beat.
The situation: I am using Vega for missile simulation, and I have three windows (bear with me…)
Missile view of target and synthetic greyscale cloud background, using a generic motion model. Nothing fancy. All done in Vega.
A “Reference Window” that has a parasitic observer, i.e. this is basically what the missile would see if it were zoomed up to X metres from the target, but no zooming is used. The pixels of this window are read to memory by glReadPixels( ). No specific background, it’s just black.
An “Operational window”, where I take a supersampled version of the Reference Window and paste it onto a copy of the background as used in 1). I perform the supersampling by taking the pixels read in by glReadPixels( ), applying glScalef( ) and then applying glTranslatef( ), so the result is placed exactly where the target should be, and of exactly the same size.
Now, since there is no background in the Reference Window, the pixels that have no red, green or blue components are assigned 100% transparency so they don’t obscure the clouds when the scaled and translated pixels from glReadPixels( ) are drawn in the Operational Window.
When the missile is shot, and attention is focussed on the “Operational Window”, whenever the target passes in front of the clouds, it is clear that the transparency modification doesn’t seem to work since you can clearly see the target is inside a little black square. It gets weird from here though…
Imagine that your household flyscreen has ten times less spacing than it actually does. From a distance, the screen would appear black. But, when you get close enough, you can start to see through it, and see any sort of pattern that exists. This is what happens here. The missile gets closer and closer, and when it is pretty damn close (subtends 2/3 or more of the window), structure becomes apparent (the periodic mesh) and eventually you can see through the screen. It’s easy to tell that you are looking right through just one of the holes in the mesh because the structure has gone, however the Operational Window is really heavily tinted black. When the missile stops and the target moves away, the periodic mesh comes back in a hurry and quickly grows until it is dense enough to represent solid black surrounding the target: again the target appears to be inside a little black square.
(The pixels read in from the Reference Window are scaled from down to subpixel size when the target is a long way away, right up to full window size when it is in your face). I have adjusted my clipping planes back to 0.1m (minimum allowable in Vega), and the effect is still there. I use a symmetric frustum with 7.5 degrees FOV in both horizontal and vertical planes. I have been using an SGI Onyx2. I use 48-bit RGBA, so there’s plenty of “room” for alpha. I use 8-bits of Stencil, 4 multisamples and double buffering.
I am at a loss as to what is going on: is this a bug or a legitimite graphics problem?! I can only guess that glScalef( ) or glTranslatef( ) is partly to blame, but that is only the thought of a moderately experienced user. A problem with declared pixel range in glReadPixels( ) maybe? I use gluByte for my results since I only want 8-bit colour for the time being.
At a loss and hoping someone can even drop a suggestion!!