|
Technical Information
home | technical information | RMF format |
hlfix currently performs three phases of geometry correction:
Tesselating non-planar faces
Figure 1.1 shows a brush with a non-planar face. Vertices 1, 2 and 3 of the face are in the indicated plane but vertex 4 is not.
The tesselation procedure works like this:
In order for this algorithm to work, the projected polygon must be a simple polygon. This means that its boundary cannot intersect itself.
If the projected polygon is not simple, hlfix will abort with the error "Can't tesselate non-planar face". It's also important for the
modeler to make sure that the tesselation of a non-planar face will not intersect other faces of the brush it's part of. This error will not be
detected during the tesselation phase but will cause problems during later phases.
If two non-planar faces on two different brushes are coincident i.e. they share all of their edges, they will be tesselated the same way.
This assures that tesselated brushes that touch each other will "fit" together snugly with no overlap or gaps.
Figure 2.1 shows a non-convex brush. The highlighted edge is "reflex" meaning it points inwards.
hlfix eliminates reflex edges by cutting the brush along the plane of one of the faces adjacent to the edge, creating two or more new brushes.
The plane that contains the most reflex edges
is chosen for the cut. If the resulting brushes also contain reflex edges, the same procedure is used to cut them. This process continues
recursively until all brushes are convex.
When a brush is cut, new faces must be generated in the cutting plane. hlfix does it's best to determine the texture information for these faces
however this is not always possible. For example, the brush in figure 2.3 has two faces in the cutting plane but after decomposition, the
corresponding surface area is covered by only one face.
In these cases, if the faces have different texture information, hlfix will give the warning
"Found multiple textures for generated face"" and pick one of the textures randomly. To avoid this situation, don't put
coplanar faces with different textures on the same brush unless you are certain that they won't be united in this way.
At this point, all brushes are convex and so any coplanar faces on a brush must also be adjacent. Since the hlxxx compile tools don't allow this,
hlfix simply unites all coplanar faces on a brush into a single face. If the faces being united don't all share the same texture information,
hlfix will give the warning "Uniting faces with different texture info" and choose one of the textures at random.
hlfix may fail with solids that "pinch" i.e. the inner surface touches itself at any point.
However, it's ok for the outer surface to touch itself. Figure 2.4 shows some examples of valid and invalid brushes.

Figure 1.1: Brush with non-planar face

Figure 1.2: Two possible tesselations of the face in figure 1.1

Figure 1.3: Brush with many non-planar faces and it's tesselation
Decomposing non-convex solids

Figure 2.1: Non-convex brush

Figure 2.2: Decomposed brush

Figure 2.3: The original brush has two faces (red and green) in the cutting plane.
These faces become a single face (purple) after decomposition.
Uniting coplanar faces
Invalid input
| Message | Cause | Fix |
| WARNING: Uniting faces with different texture info | Two adjacent and coplanar faces on the same brush have different texture info | The brush must be manually split so that the offending textures are on separate brushes |
| WARNING: Found multiple textures for generated face | A face generated during decomposition contains multiple original faces with different texture info | The brush must be manually split so that the offending textures are on separate brushes |
| ERROR: Could not tesselate non-planar face | A non-planar face can't be triangulated probably because it's projection is not a simple polygon | Brush geometry is invalid and must be modified |
| ERROR: Attempt to assemble incomplete edge cycle | This error occurs during the decomposition phase and is normally the result of an invalid brush | Brush geometry is invalid and must be modified. If you believe your geometry is valid, this may be the result of a bug in hlfix. |
| ERROR: Inner edge cycle generated with no containing outer cycle | This error occurs during the decomposition phase and is normally the result of an invalid brush | Brush geometry is invalid and must be modified. If you believe your geometry is valid, this may be the result of a bug in hlfix. |
| ERROR: Orphaned face # [texture] with normal (# # #) | This error occurs during the decomposition phase and is normally the result of an invalid brush | Brush geometry is invalid and must be modified. If you believe your geometry is valid, this may be the result of a bug in hlfix. |
| ERROR: Incomplete solid | This error occurs during the decomposition phase and is normally the result of an invalid brush | Brush geometry is invalid and must be modified. If you believe your geometry is valid, this may be the result of a bug in hlfix. |
| ERROR: Attempt to cut outer/inner edge cycle which lies entirely within cutting plane | This error should never occur and is probably the result of a bug in hlfix | |
| ERROR: Odd number of front/back intersection points | This error should never occur and is probably the result of a bug in hlfix |