PDA

View Full Version : Antialiasing + depth offset



maximian
02-29-2004, 08:23 AM
I am getting visual problems when I use depth offset + antialiasing with blending. Separately their fine. I tried using my offset function, as described in Mathematics for 3D Game... but I do not get good results. Here is the code(simple)

glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);

//Draw offset
glColor4fv( black.color );
geometry[i]->DrawWireframe();
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset( 1.0, 1.0 );
glColor4fv( scolor );
geometry[i]->Draw();
glDisable(GL_POLYGON_OFFSET_FILL);

zeckensack
02-29-2004, 12:32 PM
You should draw the solid geometry first.

The transparent parts of your smooth wireframe lines will fill the z buffer, and this will block rendering of some fragments belonging to the filled geometry.

You also currently don't blend those smooth edges with your solid geometry, but most likely with the clear color. This isn't terribly correct http://www.opengl.org/discussion_boards/ubb/wink.gif

maximian
02-29-2004, 02:32 PM
I followed your advice. Still the same problem.
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset( 1.0, 1.0 );
geometry[i]->Draw();
glDisable(GL_POLYGON_OFFSET_FILL);
glColor4fv( black.color );
geometry[i]->DrawWireframe();
glColor4fv( scolor );//model color

maximian
03-02-2004, 02:08 PM
The problem seems to stem when I enable polygon offset AND GL_LINE_SMOOTH. As I move/rotate the object, the solid model, shows through the wireframe, with the part showing through increasing, decreasing in size and shape changing depending on the orientation of the model.
Any more ideas? Thanks.