Gouraud-Interpolation

Does this problem also occur with textures on quad elements? I have strange texture results on quads. I have a square with four quads. The boundary nodes have the same value. Only the one inner node has a different value. I do not get a constant distribution? How can i correct it?
Thanks

I assume you’re talking about a 1D texture here, mesh radially from the center to get better results, you need to think about the triangulation of the quads:


|\ | /|
| |/ |
|–X–|
| /|\ |
|/||

until now i have about 400000 quads and if i split them it will decrease frame rates extreme!

Yep, a quad is typically turned into two tris internally, and these may interpolate differently along the diagonal. You can correct this by using the Q texture coordinate as mentioned elsewhere on this forum.

Some things cannot be fixed using q.

This will not reduce framerates significantly if you send your tris using the correct primitives. It may even be faster if you send your quads naively now.

That means for my texture i display all elements as Tri-elements. For the overlaying mesh i display the quads. Right?

If you mean you want to draw a wireframe representation of the quads then yes drawing as quads would do that, then draw triangles for the fill.

For fill I would suggest using a trifan primitive to render the triangle version. That seems to be the most vertex efficient way to go.

For example:

v2 _v3 v4
|\ | /|
| |/ |
v9|–v1-|v5
| /|\ |
|/||
v8 v7 v6

glBegin(GL_TRIANGLE_FAN);
glVertex3fv(v1);
glVertex3fv(v2);
glVertex3fv(v3);
glVertex3fv(v4);
glVertex3fv(v5);
glVertex3fv(v6);
glVertex3fv(v7);
glVertex3fv(v8);
glVertex3fv(v9);
glVertex3fv(v2);
glEnd();

That should do (just add tcoords) until you get into vertex array rendering or whatever your preference is on your platform of choice.

How do you split the quad into four trias? If i use the gravity point, in some cases it can bee outside of the quad!

if your quad is not a quad, stop using it. bether use triangles directly… then you know where your edges are, and you know what to do…

I am reading in files, where fem-elements are defined. In some cases a quad can have very bad geometry. So that is the reason why i have to take these cases also into account!!

The quad is a quad, the problem is the interpolation of parameters, OpenGL triangulates it first. It’s a fairly common problem. Read the post.

guju, I was asumming based on your description that you have 4 quads. I have split four quads into 8 tris. I don’t know what you mean by your gravity point…hmm do you mean that the point at the common junction of the quads is teh gravity point? Yikes. You’d have to clip the edges to the bounds I suppose (depending on desired behaviour, or perhaps use stencil, but that’s just getting ugly.

[This message has been edited by dorbie (edited 06-24-2002).]

Originally posted by guju:
How do you split the quad into four trias? If i use the gravity point, in some cases it can bee outside of the quad!

The gravity point will always fall inside a convex quad. If you have quads whose gravity point is outside, then they must be concave. OpenGL doesn’t support concave quads (results are undefined), so you have to split them into two triangles manually.

I divide my quads now into four tria-elements. The color interpolation works very good, but performance goes done! I use GL_TRIANGLE_FAN’s for each quad. Can i use GL_TRIANGLE_FAN with vertex arrays?