# Sutherland-Hodgman 3d Clipping Limitations

This topic is 4839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I think I may be misunderstanding what this can be used for so I'm just looking for ideas and opinions on my predicament. I'm trying to implement clipping routines that will clip 3d polygons to an arbitrary frustum. I keep reading that S-H algorithm can easily be extended to 3d but my problem is this: I store 3d polygons as a list of vertices and a list of faces (that store indexes into the vertex array). If I have a pyramid with the apex facing right through a right clip plane, then the resulting clipped polygon will be a truncated pyramid. I see how the algorithm will create the correct vertices but an extra face will also be created. This algorithm is going to know nothing about the creation of a new face. so.... Is this not the way most people store their polygons (I need normals of faces so it seems natural to break the polygons into faces) ? Should/Could I be testing if new points lie on a common plane to create new faces (seems a bit over complicated) Have I misread the capabilities of the algorithm ? Does anybody have any experience/ideas about this problem ? Any help/pointers at all would be greatly appreciated. Thanks DC

##### Share on other sites
I'm a little confused about how you're using some of the terms, but it sounds to my like you're interested in mesh clipping, whereas S-H is a polygon clipping algorithm. Filling in the missing face of the pyramid is a problem related to but separate from the actual clipping.

As for solving this problem, it's fairly straightforward for convex meshes, and difficult for arbitrary meshes. I know of a good paper on the subject, but it's fairly deep - if you're interested, I can post a link.

##### Share on other sites
First off thanks for taking the time to reply. I may well be using terms incorrectly as I'm far from an expert in 3d graphics (as you may have gathered :)).

I guess I am talking about mesh clipping - if by that you mean clipping a 3d object that is defined by polygons that make up its outer surfaces.

Basically all I want to do is have a pyramid. Defined by four trangles and a square base. Then I want to be able to clip the top off the pyramid. Which will result in an extra surface to the object.

I can see how the algorithm will create the vertices of the new surface and I am aware that it will create a new surface on the clip plane. I am confused in regards to forming this new surface in my clipping, i.e. how do I know there is a new surface? How do I know what order the new vertices of the surface must be drawn in?

All I'm trying to do is write a very basic 3d engine. I've read countless tutorials almost all of which refer to S-H as a clipping method. It just seems that having these vertices is useless if I don't know how to draw them. I feel this should be (relatively) straight-forward and that I am missing something.

I'd be glad to take a look at the paper you talk about although from your description it sounds like it might drive me further towards insanity.

If you/anybody feels I can clarify the problem further just let me know.

Thanks

DC

##### Share on other sites
Quote:
 I'd be glad to take a look at the paper you talk about although from your description it sounds like it might drive me further towards insanity.
Just in case you want to risk it: Clipping A Mesh Against a Plane :-)

I haven't implemented mesh clipping, so the following is speculative. Clipping a closed convex object (such as your pyramid) against a plane will leave an opening in the mesh; this opening is itself convex. The edges of the opening are those edges in the mesh which are only referenced by one triangle (in a closed manifold mesh all edges are referenced by two triangles).

As for finding these edges, you can do it as a post-processing step (using connectivity information), or during clipping. Once you have them, sort the edge vertices CCW or CW as desired with respect to the plane normal. (I recently described how to do this in this thread.) The sorted vertices now form a convex polygon (which can be triangulated if necessary) that closes the mesh.

As is usually the case, if you know something about the context you can probably come up with an easier special-purpose solution. In your case, if you always know that the top of the pyramid is going to be clipped off, you could take some shortcuts. The above is a more general solution, though.

Even at it's simplest, closing a clipped mesh requires a bit of work.

1. 1
Rutin
27
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633313
• Total Posts
3011319
• ### Who's Online (See full list)

There are no registered users currently online

×