PDA

View Full Version : PolygonOffset and triangles Normals



devdept
02-08-2006, 06:14 AM
Hi All,

The question is very simple.

Is glPolygonOffset affected by triangles normal?

The offset is done in the normal direction? Importing models with flipped normal result in hidden triangles edges?

If it is true, does anybody knows the remedy?

Thanks so much,

Alberto

jide
02-08-2006, 06:48 AM
It's just an offset regarding the depth value of the polygon fragments. It happens in eye space and results depend on how the polygon is inclined regarding the view. And it has nothing to do with normals. Hope that helps.

devdept
02-08-2006, 06:56 AM
Thanks jide,

I am wondering now, why just flipped triangles have missing borders.

I have 2 models, one with homogeneous normals and one with some normals toward the inside and some toward the outside.

The first render perfectly the second has edges only on correcly oriented normals triangles...

Mmmm........... :confused:

Relic
02-08-2006, 06:57 AM
>>It happens in eye space<<
No, further down in the pipe in window space.

jide
02-08-2006, 07:02 AM
Originally posted by Relic:
>>It happens in eye space<<
No, further down in the pipe in window space.Yes you're right.

Back to the problem, I guess it's due to polygon orientation. Did you tried out to disable face culling ?

Relic
02-08-2006, 07:05 AM
Originally posted by devdept:
Thanks jide,

I am wondering now, why just flipped triangles have missing borders.

I have 2 models, one with homogeneous normals and one with some normals toward the inside and some toward the outside.

The first render perfectly the second has edges only on correcly oriented normals triangles...

Mmmm........... :confused: If you mean that you render wireframe edges with glPolygonMode(GL_LINE) and some don't render, that could either be culling or lighting.
Try these experiments: disable culling, toggle glFrontFace, switch off lighting and set a different color for the edges than for the faces.

If your polygon winding is not in line with the normal's direction, that is, the normal must always be specified on the front face in OpenGL, then all bets are off.

devdept
02-08-2006, 08:08 AM
Yes Relic,

Disabling face culling the triangles disappear.

So do you think that glFrontFace and face Normal are not in agreement?

I'll check!

Thanks a lot for the moment!

Alberto