View Full Version : Blended Triangles with one vertex out of the viewport
07-06-2007, 06:10 AM
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?
07-06-2007, 08:03 AM
Describe "badly rendered".
07-06-2007, 09:14 AM
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.
07-06-2007, 10:26 AM
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.
07-07-2007, 05:29 AM
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.
07-07-2007, 06:34 AM
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?
07-07-2007, 06:39 AM
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.
07-10-2007, 02:40 AM
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?
07-10-2007, 04:01 AM
Yes guys, it was the damned 1.1 Microsoft Generic OpenGL implementation. Now, with the right driver everything looks fine.
Thanks so much again,
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.