JPatch 0.3 - Introduction to patch modeling
by Sascha Ledinsky
Version 1 - September 29, 2004
Table of contents
- Patch vs. polygon based modeling
- Adding curve segments
- How JPatch creates patches
Patch vs. polygon based modeling
JPatch is a spline based modeler. Models are made of patches that represent curved surfaces. These patches are build up by drawing their outline as a "spiderweb" of curves (see how JPatch creates patches).
Modeling with curves and curved surface patches is quite different to modeling with lines and polygons:
To approximate a curve, a relatively large number of line segments is needed.
On the other hand, the same curve can be appoximated by using just three curve segments, each of which is a bicubic curve (spline).
This concept can be extended to surfaces as well. Many polygons are needed to approximate a curved surface (like a sphere in the image below), but only 8 patches are necessary to represent the same sphere.
Polygons approximate curved surfaces, patches are curved surfaces.
The approximation is better the more polygons are used. This is true for polygon based models, but it is not necesarily true for patch based models:
Both, a polygon based model of a sphere and a polygon based model of a human head will need about the same number of polygons. On the other hand, the sphere shown above uses only 8 patches, while a patch based model of a human head will certainly need a lot more patches:
A patch based model will need more patches in areas of high detail, but only a few patches in areas of low detail, no matter how "curved" the surface is (in opposite to polygon based models, which need a high number of polygons to approximate any curved survace, independent of the level of detail).
TIP: Keep the models as simple as possible (use as few patches as possible, or when drawing a curve, use as few controlpoints as possible to get the desired shape). This will not only save CPU cycles when editing (to keep JPatch responsive) or rendering (to keep rendering-times low), the models will actually look better: If too many patches are used it will be cumbersome to manually tweak each controlpoints position to remove bumps in the surface. The less patches used, the smoother the look of the resulting surface will be.
Adding curve segments
By pressing the A key or clicking on the "Add point" button JPatch switches to add point mode. A single curve segment can be added by pressing the left mousebutton at the start point, moving the mouse pointer to the end point and releasing the left mouse button. JPatch will automatically switch back to the default mode after releasing the mouse button. If this is not desired, the "Add multiple points" (SHIFT-A) feature can be used.
To move controlpoints, switch to default mode (by clicking on the "default tool" button or pressing the ESC key), select it (by moving the mouse pointer over it and pressing the left mouse button) and move it (with the left mouse button still down).
To append to an existing curve segment, simply move the mouse pointer over an end of the existing curve and add the new segment. To join two segments later, simply move one point over another one and, with the left mouse button still pressed, click the right mouse button.
How JPatch creates patches
As mentioned above, modeling is done by drawing a "spider-web" of curves (the mesh). JPatch will automatically detect all 3- and 4-sided loops and create patches if (and only if) the loop is formed by more than one spline.
The following images show examples of valid 3- and 4-sided patches:
The 3-point-patch on the left side is made of 3 individual splines, the one in the middel of 2 individual splines. The loop on the right side consists of only one spline, thus it is not recognized as a patch.
The 4-point-patches on the left side are made of 4, 3 or 2 individual splines, respectively. The loop on the right side consists of only one spline, thus it is not recognized as a patch. There's one more exception. The mesh in the image below is recognized as two 3-point patches, no 4-point patch is formed:
JPatch can also handle 5-sided patches, but they are not built automatically. A five point patch can be created by selecting its five corner points and clicking on the "make five point patch" button:
For a patch to be valid, its boundary must be made of at least two individual splines. Thus a method to attach splines is needed. Two controlpoints can be attached by moving one over the other and clicking the right mousebutton.
Points can be detached by selecting them and clicking on the "detach points" button.
TIP: Although only two individual splines are needed to form a valid patch, it is highly recommended to always use 3 individual splines for 3-sided patches, 4 for 4-sided and 5 for 5-sided ones (see
how to avoid creases).
NOTE: To tell JPatch to automatically create the patches, click on the "compute patches" button or press the F5 key. To see the patches, show patches must be activated in the popup menu.
Controlpoints are displayed in different shapes/colors:
- yellow diamonds for unattached contolpoints
- red squares for attached controlpoints
- large orange squares for controlpoints attached to more that one other controlpoints. This may be desired, but in most cases it is by accident and should be corrected
- green squares for all selected controlpoints