Introduction

I implemented an editor for hierarchical B-splines which were first presented in [1] by Forsey and Bartels. I also referred to [2], Forsey's PhD thesis, as additional detail was presented. Like Forsey, I also used uniform cubic b-spline tensor product patches. Uniform knots allow for a convenient matrix formulation of the b-spline basis functions.

I tesselated the surfaces and drew them with OpenGL's glDrawArrays(). I also used the GLM library, mostly for coordinate transformations, and its vector class. The Eigen library was also used for computing the b-spline surfaces, as it supports matrices of arbitrary dimension, and has convenient block indexing.

Features

Startup

A 4x4 patch is created by default, with a 16x16 resolution per patch (eg. number of triangles in a patch is 16x16x2).

image

New

The user is free to press new at anytime. They will be prompted (by the console) for new patch dimensions and resolution. This resets the editing session and allows for arbitrary patch sizes >= 4x4.

Loading/Saving

The user can load a previously saved editing session from file by pressing load and entering the file name in the console. An editing session is saved by pressing save and entering the file name in console.

Surface Editing

The user left-clicks a point to select it, turning the point red. The user can then left-click and drag the point. Screen coordinates are converted to model coordinates with help from glm::unProject.

image

Edit Points

Edit points allow the user to directly interact with the surface. Selection and interaction is done as for control points.

image

Refinement

The key feature of the editor. User first selects a point and presses S to add a layer of refinement around that point. An area of refinement can be designated by selecting a second point using LEFT_CONTROL while left clicking.

image

Grey coloured control points cannot be moved, and are set by the parent surface to maintain continuity with the child surface. The keys PAGE UP and PAGE DOWN can be used to navigate refinement levels. This allows for easier selection of desired control points. In the image below the level is one above the parent level (now the first child).

image

Hierachical Refinement

Of course refinement can be done multiple times on one patch and one layer of refinement can have multiple siblings.

image

Offset Referencing

When the control points of a parent are moved the child patch needs to still maintain continuity with the parent. Therefore all control points are exressed in terms of a reference (determined by the parent) and an offset (determined by editing at the respective level). The base surface is edited from the previous figure. As seen below, the child patches move with the parent, while still retaining their own details.

image

Colours

Every patch can be assigned a unique colour using the on-screen menu. Only colours of the currently selected refinement level are shown.

image

Patch Merging

Patches of the same refinement level can be merged. This is necessary when refining the parent would cause one of the inactive (grey) points of a child to become active. Start with two children of the same level. They are independent of each other since three control points serve to enforce a continuous boundary. Note these children have children of their own and have been edited. The editors patch merging is free of any restrictions. The algorithm traverses all child nodes and updates their information.

image

I switch to the parent's level and select a point that if refined, would cause conflict with the existing children.

image

I refine that point, and the editor deletes the two children and creates one larger patch that contains all their information. Note that the surface has not changed.

image

Other Features

Learning

Models

I couldn't resist recreating the famous graphics dragon in my editor. See the results below.

image image
image image

You can see the mess of points this creates, thankfully I actively used my method of selecting levels. More importantly, notice the density of points increases around key areas such as the nose and ears. In a regular b-spline editor this density of points would have to be constant requiring extra computation.

image

References

[1] David R. Forsey, Richard H. Bartels. Hierarchical B-Spline Refinement. SIGGRAPH 1988, Atlanta.

[2] David R. Forsey. Motion control and surface modeling of articulated figures in computer animation. Thesis. University of Waterloo, Department of Computer Science, 1990.