Results 1 to 9 of 9

Thread: Blended Triangles with one vertex out of the viewport

  1. #1
    Senior Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    659

    Blended Triangles with one vertex out of the viewport

    Hi All,


    Do you know why when I zoon in my blended triangle and one vertex goes out of the viewport the triangle becomes badly rendered?

    Is there a way to avoid this?


    Thanks,

    Alberto

  2. #2
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,450

    Re: Blended Triangles with one vertex out of the viewport

    Describe "badly rendered".

  3. #3
    Senior Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    659

    Re: Blended Triangles with one vertex out of the viewport

    A white triangle blended at 50% it is rendered nice close to in-viewport vertices and from the vertex outside the viewport a dark shade start toward the middle of the triangle.

    This is very unpleasant on big triangles.

    BTW, I saw it in some famous commercial application too.

    Thanks in advance for your help.

    Alberto

  4. #4
    Senior Member Regular Contributor
    Join Date
    May 2003
    Location
    New York
    Posts
    194

    Re: Blended Triangles with one vertex out of the viewport

    I'm going to take a wild guess.

    When you say "a white triangle blended at 50%," I'm guessing your triangle is white, 50% transparent, and more importantly, rendered with flat shading turned on. Tell me if I'm wrong.

    The thing about flat shading is that it only uses one of the three triangle vertices for the color. The other two could be any color and you'd never know it, unless perhaps if that one vertex gets clipped or clipping changes which of the three is used.

    If the clipping microcode still interpolates the colors (along with position, texture, etc..) for a newly created vertex, then that might explain the effect you're seeing. I would hope that clipping code would be smart about flat-shade mode, but I don't remember if that's in the spec.

    Anyway, here's the easy way to test: make sure all three vertices of your triangle are set to your 50% transparent white color and run it again.

    I could be barking up the wrong tree. But it's easy enough to test.

  5. #5
    Senior Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    659

    Re: Blended Triangles with one vertex out of the viewport

    Hi Cyranose,

    No, we use smooth shading all the time.

    I add one more detail, the view is clipped using gluPickMatrix, therefore the triangle lays on a uniform bigger background. I don't see the reason why it should be rendered wrong.

    If you a little back and all the three vertices come again inside the viewport everything lokks fine again...

    Mmmm... really I don't understand why.

    Alberto

  6. #6
    Senior Member Regular Contributor
    Join Date
    May 2003
    Location
    New York
    Posts
    194

    Re: Blended Triangles with one vertex out of the viewport

    gluPickMatrix is meant for rendering in selection mode, I believe. I don't see why it wouldn't work normally, but who knows? Can you try rendering without gluPickMatrix and just using scissoring?

    Just out of curiosity, since you saw this behavior on another program, what hardware is it? And are you running the latest drivers?

  7. #7
    Senior Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    659

    Re: Blended Triangles with one vertex out of the viewport

    ATI Radeon X1800, but all the graphics card in our history presented this issue. I don't think it is hardware related.

    gluPickMAtrix is used also to restrict the rendering region.

    Not sure about drivers now. I am on windows vista and can't install the latest.

  8. #8
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,450

    Re: Blended Triangles with one vertex out of the viewport

    but all the graphics card in our history presented this issue.
    If it always happenend with any OpenGL implementation I would say it's this:
    The triangle is clipped at the viewing frustum resulting in a quad which is drawn as two triangles. If the color interpolation is not completely planar in color space over the whole quad you will experience banding issues at the inner edge between the two triangles.
    Color interpolation would also have to be perspectively correct to make that work.

    If you say this occured on all graphics boards in the past, does this imply different hardware vendors as well?
    I am on windows vista and can't install the latest.
    What does glGetString() return on your Vista installation then? OpenGL 1.1, Microsoft GDI Generic?

  9. #9
    Senior Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    659

    Re: Blended Triangles with one vertex out of the viewport

    Yes guys, it was the damned 1.1 Microsoft Generic OpenGL implementation. Now, with the right driver everything looks fine.

    Thanks so much again,

    Alberto

Similar Threads

  1. Replies: 3
    Last Post: 10-21-2010, 04:51 AM
  2. Triangles or strips? Vertex array/VBO
    By Sarah22 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-28-2010, 07:08 AM
  3. viewport dimensions in vertex shader
    By thinks in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-25-2009, 05:31 PM
  4. Indirection from <triangles>-input to vertex data
    By msteinberg in forum COLLADA
    Replies: 1
    Last Post: 12-20-2007, 03:22 PM
  5. triangles in vertex array
    By rilestyle in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 12-24-2003, 12:53 PM

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