Results 1 to 4 of 4

Thread: Antialiasing + depth offset

  1. #1
    Senior Member Regular Contributor
    Join Date
    Nov 2003
    Location
    Michigan, USA
    Posts
    184

    Antialiasing + depth offset

    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);

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Feb 2002
    Location
    Bonn, Germany
    Posts
    1,633

    Re: Antialiasing + depth offset

    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

  3. #3
    Senior Member Regular Contributor
    Join Date
    Nov 2003
    Location
    Michigan, USA
    Posts
    184

    Re: Antialiasing + depth offset

    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

  4. #4
    Senior Member Regular Contributor
    Join Date
    Nov 2003
    Location
    Michigan, USA
    Posts
    184

    Re: Antialiasing + depth offset

    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.

Similar Threads

  1. Depth buffer doesnt work when using Multisampled Antialiasing
    By McStones in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 08-17-2017, 02:55 AM
  2. Transparency Antialiasing/CSAA with Depth Stencil
    By BionicBytes in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 08-21-2010, 06:14 PM
  3. Antialiasing and depth peeling
    By MalcolmB in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 06-15-2009, 01:43 PM
  4. VBO and offset
    By V-man in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 04-17-2008, 03:51 AM
  5. Line Antialiasing + Polygon offset
    By maximian in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 03-13-2004, 04:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean