Problem with polygon offset

I am having a bit of a problem with the polygon offset of a model I’ve created. I’ve made an urban model and I’m trying to display all the windows on top of the walls without having to cut out the windows. But somehow the offset function it isn’t working like I thought. I think it has something to do with the size of the objects. All the windows are one big object as are the walls. No matter which values I enter (from sensible ones to extremely large ones) there’s still some stitching occurring. There’s also some correlation with the distance between the viewpoint and the objects’s polygon offset behavior. For instance, when I find a value that works fine moving closer to the object makes stitching appear again (in a way that looks like the window is coming out of the wall at an angle).
In my opinion it has something to do with the size of the object. When I tried it with an object consisting of several planes and another object consisting of several planes in the same plane, the polygon offset function works like a charm. But this model with a bunch of windows which are not in the same plane is much more 3D than two flat objects. It is like the offset function is not calculating the values per polygon, but rather per object.
Am I using the offset function incorrectly? Or am I using it for something it wasn’t designed for? Any help would be greatly appreciated!

…small kick…

Nobody has any ideas? I still don’t have a clue as to where to look for a solution.

You don’t have the “enter” key on your keyboard?

I think my post is pretty well written. Did I violate some forum rule?

But back on topic: What could the solution be? Or is this more a question for the expert section?

Well your post is hard to read, so it means that volunteering for helping you needs a lot more motivation than usual…

I believe you already read this thoroughly :
http://www.opengl.org/resources/faq/technical/polygonoffset.htm

Something like this usually works well in a lot of cases :
glPolygonOffset(1.0, 1.0);

Be sure to apply it to the windows only, and not to the buildings.

Screenshots from near, medium, and far range please ?

And relevant code ?

Correction, I think I had that reversed : apply it to the buildings only, and not to the windows.

Yeah, it’s hard to explain a visual problem with just text. I made a small movie of the problem, you can find it here: http://archidimex.com/downloads/PolygonOffset.wmv
Together with my opening post it should be clear now what happens, although I’m still puzzled.

A polygon offset of -1,-1 does not seem to do the trick (applying 1,1 to the buildings results in the same effect). I’m not programming in OpenGL, but in Vizard (which uses OpenGL). However there is a command in Vizard, which applies the glPolygonOffset to an object. When I make a test script with just two squares the polygon offset works like a charm.

It is not very clear in the video, but you seem to only change the first parameter ‘factor’.
Try large offset values for both terms, ‘factor’ and ‘units’.

Are you using an extreme case of very small near clipping plane and and very large far clipping plane ? That would also decrease the z precision.

The two sliders are factor and units. The clipping planes are set at 0.1 and 5000 meters, so that isn’t that’s extraordinary. Large values like -1000,-1000 result in much better behavior, but -1,-1 should work. I am sure the window planes are in the same plane as the wall…
I’m also puzzled by the fact that the window plane seems to come out of the wall at an angle.

small kick…

I’ve been playing around with some values, but with no improvements. Maybe it has to do with some OpenGL behavior about objects and subjects? Does anybody have an idea where to look next?

I guess it has more to do with how your hardware rasterize polygons.