Shading Curves: Vector‐Based Drawing With Explicit Gradient Control

A challenge in vector graphics is to define primitives that offer flexible manipulation of colour gradients. We propose a new primitive, called a shading curve, that supports explicit and local gradient control. This is achieved by associating shading profiles to each side of the curve. These shading profiles, which can be manually manipulated, represent the colour gradient out from their associated curves. Such explicit and local gradient control is challenging to achieve via the diffusion curve process, introduced in 2008, because it offers only implicit control of the colour gradient. We resolve this problem by using subdivision surfaces that are constructed from shading curves and their shading profiles.


Introduction
Vector graphics provides a powerful framework for drawing compelling 2D imagery. An important aspect of such drawing is to be able to control colour gradients [OBW*08, FSH11]. Currently, there are three ways to manually manipulate colour gradients: diffusion curves (DCs) [OBB*13], the linear gradient tool and the gradient mesh tool. The last two tools are found in vector drawing applications like Adobe Illustrator and CorelDRAW (gradient mesh is called 'mesh fill' in Corel DRAW).
Our approach is related to the DC primitive. A DC is a free-form curve (modelled as a B-spline curve) that is associated with colours on each side of the curve. These colours are smoothly propagated, or diffused, filling the entire image. Its advantage is that it is associated with a natural type of input while supporting smooth propagation of colours [OBB*13]. By contrast, the linear gradient tool does not support smooth propagation of colours (although it can be associated with free-form curves) and the gradient mesh tool is restricted to rectangular control meshes and does not support free-form curves as input (although it produces smooth propagation of colours). However, a limitation of DCs is that they do not support explicit control of the colour gradient (Sections 3 and 6).
To achieve explicit control of the gradient of the colour that is related to the curve, instead of performing diffusion, we associate shading profiles to each side of the curve. Figure 1 (top) shows how shading of two rings can be achieved with such shading profiles. First, the boundary curves are drawn, defining the shapes of the objects. A bounded region can be associated with a colour, resulting in a flat-shaded image with a colour defined in each region. In addition, each side of a curve is associated with a luminance or colour adjustment value. This value specifies the modification in luminance (or colour) of the underlying colour of the flat-shaded image. Then, a shading profile, which can be manually adjusted, represents the resulting profile of the luminance (or colour) adjustment in the perpendicular direction to the curve. Figure 2 shows the influence of shading profiles on the resulting image. While our primitive can be employed in many artistic settings, it is particularly motivated by the problem of drawing shade and light (Section 3). We therefore refer to our primitive as a shading curve.
It is not clear how one could use diffusion to propagate colours in accordance with shading profiles (Section 6). First-order DCs [OBW*08] are restricted to (colour) value constraints and do not natively support manipulation of the colour gradient. By contrast, second-order DCs [FSH11], support first-derivative constraints to alter the colour gradient in a given direction. However, these firstderivative constraints are restricted to zero derivatives, which cannot represent a general shading profile. For that reason, we chose to use a method different from diffusion and employ Catmull-Clark  Our shading curve supports manipulation of shading profiles, which dictate how the colour, associated with a shading curve, propagates out from the curve. Such shading profiles can give rise to a wide range of effects. In (a) and (b), the colouring related to an S-shaped curve is largely controlled via shading profiles. In (c), the extent of a cast shadow is controlled principally by moving the enlarged control point. In (d), a specular highlight is created with a bell-like profile. We also refer to the Supporting Information Video S1, which demonstrates interactive manipulation of shading profiles.
subdivision surfaces constructed from shading curves and their associated profiles. Catmull-Clark subdivision is related to several attractive properties, such as the local convex hull property and local support [dB78], [PR08], which have enabled us to demonstrate explicit and local control of the colour gradient. A challenge faced with this approach is to convert the shading curve primitive to control meshes for Catmull-Clark subdivision. A robust solution to this problem is presented in Section 4.2.
In summary, our contributions are a new way to define smooth gradient profiles for vector graphics and a robust solution for determining the locations of control points for subdivision surfaces from free-form curves.

Related Work
As mentioned earlier, controlling colour gradients is currently achieved with three approaches: DCs, the linear gradient tool and the gradient mesh tool. In Section 6, we compare our approach with all of these three methods. In this section, we describe previous solutions proposed in the literature to alter the colour gradient with DCs and alternative methods to achieve shading effects with vector graphics.
First-order DCs are rasterized via Laplacian diffusion [OBW*08] [thus solving the partial differential equation (PDE) f = 0]. The Dirichlet boundary conditions associated with the PDE (specifying values of the unknown function) correspond to the colours associated with each side of the free-form curve drawn by the artist. That is, Laplacian diffusion is performed by diffusing colours specified at curves to the image domain, which produces a harmonic colour function.
Laplacian diffusion does not natively support manipulation of the colour gradient. However, several extensions have been suggested to achieve some degree of manipulation: Gaussian blurring can be used to smooth the sharp transition across the curve [OBW*08], weights for rational harmonic functions can be utilized to alter the relative influence of a boundary condition [BEDT10] and diffusion barriers c 2015 The Authors Computer Graphics Forum published by John Wiley & Sons Ltd. have been proposed to limit the extent of the colour propagation [BEDT10] (Figure 3, top).
Gradient control can be achieved by higher order interpolation. To this end, the DC primitive has been extended to second-order interpolation with the bi-Laplacian operator [FSH11,BBG12] (thus solving the PDE 2 f = 0). Curves and points related to Neumann boundary conditions (derivatives of the unknown function) can be specified. Derivative curves constrain the first derivative to zero either along the curves or across the curves [BBG12].
While the zero-derivative constraints provide a way to manipulate the gradient of the colour function [FSH11,BBG12], they do not achieve explicit colour gradient control. We have found these constraints to have two types of behaviour on the colour function, as demonstrated in Figure 3 (bottom). The first type of behaviour suppresses the propagation of colour. This can be seen in the top portion of the example, where the black colour is suppressed (red-dashed region). This is because there are only white point constraints located normal to the derivative curve; the other black point constraints are occluded by tear curves (the boundary of the apple). The colour of the white point constraint located normal to the curve is therefore propagated to the zero-derivative curves. In the bottom portion of the image, however, both black and white constraints are located normal to the zero-derivative curves, without being occluded by tear curves. In this scenario, the derivative curves give rise to a wavyshaped colour profile (blue-dashed region). As a consequence of these two different types of behaviours, zero-derivative constraints can give rise to unpredictable behaviour because their influence on the colour gradient depends on the spatial configuration of neighbouring colour constraints. By contrast, our approach lets the user manipulate the colour gradient out from curve locations explicitly without being influenced by neighbouring curves, as demonstrated in the Video S1 and in Figure 2.
An alternative way to shade vector-based drawings is to convert the image into a pseudo-3D representation (that is, a normal vector is associated with each pixel) or a full 3D representation (with depth coordinates and normal vectors). Standard 3D shading techniques can then be used to shade the image. If normal vectors have been extracted, a local shading model, like Phong shading, is suitable [WTBS07, WOBT09,SBSS12] and if depth information has been extracted, global rendering methods, like path tracing, can be used [SKČ*14].
We decided not to pursue this line of research. The rationale for this decision is that estimating normal vectors and depth information in the general setting of 2D images is challenging and therefore prone to give a result other than that desired by the artist. A manual method, like ours, provides the user with a type of input that is directly associated with the resulting image: the input colours are associated with the colours of the objects and the shading profile represents the propagation of those colours. Note that we are not arguing that manual methods are 'better' than automatic methods. However, we do argue that a user of future drawing technology should be allowed to draw shading and abstract colourings manually. There is therefore incentive to improve such manual drawing technologies.
Alternatively, one can model full 3D representations, purely via the 2D domain, which can be later rendered and viewed in traditional 3D applications [Joh02, JC08, OSJ11, AJC11]. Such methods typically inflate bounded domains to surfaces, using input curves as boundary conditions. Note that several methods employ Laplacian diffusion to achieve such inflation (e.g. [JC08,AJC11], which is similar to how DCs are used for colour diffusion. In this respect, Andrews et al. [AJC11] provide several mechanisms to adjust the gradient of the surface using internal curves, an approach akin to our slope curves and the zero-derivative constraints employed by Finch et al. In general, however, such methods are not directly suitable for colour interpolation because additional aspects, such as avoiding colour saturation, would have to be incorporated. Note that a reconfiguration of 2D-to-3D modelling methods that employ Laplacian diffusion would correspond to first-and second-order DCs, which we compare against in Section 6. Finally, Olsen et al. [OSJ11] use the distance transform (DT) for the inflation of their surfaces, which can seem similar to our usage of the DT (Section 4). However, the two methods employ the DT for different purposes. The method of Olsen et al. uses the DT to inflate their meshes (that is, defining z coordinates). By contrast, our solution uses the DT to place the boundary of the shading from a given curve [that is, defining (x, y) coordinates]. Our use of the DT in this setting is therefore novel, as further described in Section 4.

Drawing with Shading Curves
The shading curve is inspired by chiaroscuro drawing [Cen54] (Figure 4). We suggest the following approach to drawing with shading curves: (1) Draw areas of constant tone with curves, including object boundaries and main tonal areas.  In addition to the shading curve primitive, we have found it helpful to treat boundary curves and interior curves differently. Thus, we have implemented two types of shading curves with different behaviour. The first type of curve, the boundary curve, defines a sharp transition across the curve. It is therefore suitable for object boundaries since they are typically defined as hard edges (e.g. Figure 2c). By contrast, the second type of curve, the slope curve, defines a smooth transition across the curve. Slope curves are useful for shading highlights and transitions within the object interior, such as specular highlights and cast shadows from other objects (e.g. Figure 2d).

Manipulation and Rasterization of Shading Curves
In this section, we present the framework for defining and rendering shading curves. Figure 5 shows the pipeline of the framework and the Video S1 shows interactive manipulation of shading curves. Our framework takes, as input, a set of cubic B-spline curves in 2D. A set of attributes is associated with either side of each curve. These attributes are stored along with the curve control points. A user can chose to globally manipulate attributes, by selecting curves or to perform local manipulations, by selecting curve control points. From this set of inputs, our framework creates 3D control meshes, which define Catmull-Clark subdivision surfaces. The depth buffer of an OpenGL rendering is then used to create the desired effect, implemented as either a luminance alteration or a colour profile.
There are two computational steps involved in our pipeline: creating 3D control meshes from curves (Section 4.2) and rendering the surfaces (Section 4.3). The framework is computationally efficient and the user is able to refine the input interactively. Note that both computational steps must be performed if shading curves are moved in the image plane. In contrast, it is not necessary to recreate the 3D control meshes if curves are not moved (e.g. control meshes do not have to be recreated if shading profiles are manipulated).

Figure 6:
Notational labels added to the example given in Figure  5. There is no notational difference between the two control meshes associated with the curve. In this illustration, they are marked in red and green colours and the black control points are shared.
Before the computational steps are presented, we need formal definitions of the input curves and the output control meshes. These definitions are presented next.

Definitions
An input B-spline curve is defined by a sequence of n control points (Figure 6, left). The 2D unit normal vector of the curve at the position related to Q i , computed from the curve's first derivative [dB78], is denoted N i . It is assumed that the normal vectors are consistently oriented. Three attributes, extent, height and shape, are attached to each control point: r extent, e i ∈ R + 0 : defines the extent of the mesh in the direction N i from Q i ; r height, h i ∈ R: defines the height of the mesh in the perpendicular direction to the image plane at Q i ; r shape, ((α i,2 , β i,2 ), (α i,3 , β i,3 )); α i,j , β i,j ∈ [0, 1] ⊂ R: defines the shape of the surface profile from Q i towards N i . Figure 7 illustrates how these shading profiles can be edited in a user interface by manipulating curves (rendered as cubic Bézier curves) defined in a normalized coordinate system. The extent and height attributes are, in our prototype system, edited via sliders.
With the input curves and attributes defined, the output 3D control meshes are now described. A control mesh is created on the side of the curve related to the direction of N i . A mesh in the opposite direction −N i can also be created. Note that there is no requirement that both meshes are created and they can be treated as completely separate. In our prototype system, the user can manually enable or disable the meshes on either side of the curve. In addition, control meshes are created separately for each curve. Given a set of disjoint curves, our framework therefore creates a set of disjoint control meshes. If multiple curves are joined at a junction point, the related control meshes can be merged (see the supplementary document, Section 1, for implementation details).
The 3D control points derived from and associated with Q i are defined as P i,j = (x i,j , y i,j , z i,j ),i = 1, . . . , n; j = 1, . . . , m, where n is the number of control points associated with Q i and m is the number of control points associated with the shading profile

Figure 7:
The three attributes of a shading curve manipulated in our prototype user interface: shape-the shading profile-is manipulated by the inner control points of a cubic Bézier curve. The extent and height (strength) attributes are edited with sliders. The red/green colourings are used to separate the two sides of the curve.
( Figure 6, right). We have found m = 4 sufficient to demonstrate our results in Section 5. A rectangular grid of size n × m is initially assumed to be created out from the curve. However, some quads will later be deliberately degenerated to triangles.
The coordinates (x i,4 , y i,4 ) represent the location of the 'outermost' control points, P i,4 , of the mesh. A naïve definition of this point is This solution, however, can give rise to folding artefacts when the surface is projected to 2D. Note that this problem has been encountered previously in vector graphics (see the supplementary document, Section 2, for a brief review). However, previous solutions are not robust to the geometrical layout of the input curves. Placing (x i,4 , y i,4 ) is therefore the principal problem of our framework. We present a robust solution to this problem in Section 4.2.
The z, or 'height', coordinates are now defined. The control points along the original curve, P i,1 , are set according to the corresponding height attribute. We can assume that the effect of the surface, being adjustment in luminance or colour, should fair out to have zero effect at the 'other' end of the control mesh at P i,4 . That is, surface values of z = 0 do not alter the image. Given the related curve control points Q i = (x i , y i , 0), the following coordinates can now be defined: The control points P i,{2,3} related to the shape attribute are therefore placed on the plane defined by P i,1 , (x i , y i , 0), and P i,4 , ensuring that the profile is indeed modelled in the direction towards P i,4 .
By default, the height attribute defines changes in luminance using the LAB colour space. To support coloured profiles, the RGB colour space can optionally be used. Each curve therefore has an optional colour attribute C on each side.
We have so far treated the control meshes on each side of the curves as separate meshes. Thus, the transition across a curve will typically be discontinuous. However, one might wish to model a smooth transition across the curve. To this end, we have implemented two types of curves: boundary curves for discontinuous transitions and slope curves for continuous transitions (Figure 8). The only technical difference between these two types of curves is that, for each i, the P i,1 on both sides of a slope curve are merged; that is, they appear only once in the control mesh. The slope curve, now only associated with a single (merged) control mesh, therefore gives rise to a single smooth surface defined on both sides of the curve.
All coordinates of the 3D control mesh have now been introduced. In the supplementary document, Section 1, we describe additional aspects related to these meshes, including design decisions at junctions, high curvature points and curve-end points.

Defining the coordinates related to extent
In this section, we describe our solution to the placement of the 'outermost' mesh control points related to the extent attribute. This placement captures the extent of the shading profile out from the curve. Before presenting our solution (Section 4.2.2), we describe this problem in more detail.

Problem description
To discuss this problem, we need some idea of what we mean by a 'good' solution. Informally speaking, the control meshes should behave naturally and should not give rise to visual artefacts when applied to images. Such visual artefacts appear when the following conditions are violated. When the control meshes are projected to the 2D image, they should:   Figure 9 illustrates the visual artefacts related to the two conditions. Mathematically, when either of these conditions is violated, the resulting function defined by the projected surfaces gives rise to discontinuities. Such discontinuities should be avoided since they represent sharp jumps in the image, like image edges. Instead, the resulting function should be smooth across the image, unless colour jumps are specifically specified by, for example, drawing two curves in separate layers.
Note that we are only concerned with the extents of the control meshes projected to the 2D plane. This projection is defined by simply neglecting the z coordinate. To this end, we will, in the remainder of this section, refer to the mesh control points P i,j as 2D points with the coordinates (x i,j , y i,j ). In addition, let the line P i,1 -P i,4 be L i and the curve defined by P i,4 be the approximate offset curve of the input curve.

Solution
Our solution performs a single step of tracing on the DT [RP66] surface given by the input curves. The 3D coordinates of a DT surface point are defined as an (x, y) position in image plane and z, the distance to the closest curve point at (x, y) ( Figure 10). This surface has many useful properties: r The gradient at any point not positioned at an input curve or at the medial axis (MA) [Blu67] of the set of input curves points in the direction normal to the curve; r The slope of this gradient is 45 • ; r C 0 creases in the surface relate to the input curves and the MA; r The slope along the MA is less than or equal to 45 • ; r Stationary points (not related to curve points) and local extrema on the surface lie on the MA transform.
A conceptual solution is now described. Imagine a particle dropped on the DT surface for each Q i along N i . Such a particle is dropped infinitely close to the curve point associated with Q i in the direction of N i (that is, it is dropped on the correct side of the curve). These particles then follow the gradient field on the DT surface.
According to the properties of the DT surface, the particles behave as follows ( Figure 10). As time increases, they move 'upwards' along the direction of the gradient, towards the MA. When the MA is reached, they will continue to move along the MA until they reach a local extremum and then remain stationary. Eventually, all particles will reach a local extremum or the edge of the domain (i.e. the image border). A particle also turns stationary if its z coordinate (i.e. its DT value) equals the extent attribute.
A control point P i,4 is placed on the location of its related stationary particle. Quads related to Q i and Q i+1 (that is: the quads defined by P i,1 , P i+1,1 , P i+1,4 and P i,4 ) are degenerated to triangles if their related particles coincide (that is: if P i,4 = P i+1,4 , they merge into a single control point). Our implementation of this solution traces pixels on the discrete DT of the input curves (see the supplementary document, Section 3, for implementation details).

Discussion
Our solution satisfies Conditions 1 and 2, as long as the input curves do not intersect (in such cases, the curves can be trivially split): Control meshes of neighbouring curves do not overlap (Condition 1) as the meshes are constrained by the MA. Meshes do not fold (Condition 2) as the paths created by the particles only merge; they do not cross.
The offset curve defined by P i,4 is restricted by the MA. However, one might wish to extend the shading profile further. A future investigation could be to verify whether a weighted DT [KKB96] can be used for this purpose. This extension would increase the complexity of the curve primitive since a weight needs to be attached to it.

Rendering
The process of creating the final image from the control meshes is straightforward: subdivide the control meshes given by P i,j , render the surfaces off screen, and then apply these surfaces to the underlying image. In our prototype system, we allow users to associate a colour with each image region bounded by the input curves. This approach produces a flat-shaded image and represents the 'underlying' image. This image is supplemented with a rendering of the surfaces to produce the resulting image.
We render our surfaces as Catmull-Clark subdivision surfaces. Since a surface must interpolate its boundary curve (defined by Q i ) in the image plane, boundary subdivision rules are used [DKT98]. We have used two subdivision steps to produce our results. In some cases, where the surface is stretched over a large area, three subdivision steps can produce a visually smoother result. Note that increasing to three subdivision levels still provides an interactive system in our setup.
To create a complete per-pixel shading profile for the image, we render the Catmull-Clark surfaces using OpenGL off-screen rendering. The shading image, S, is then extracted from the depth buffer. The camera parameters are set so that depth values directly correspond to the height attributes; thus S ∈ [−100, 100] for luminance and S ∈ [0, 1] for colour.
Finally, this shading image is applied to the underlying image I producing the resulting image R. Luminance adjustment in the LAB luminance channel L is performed by The two other colour channels are set by the corresponding channels in I .
In the setting of colour adjustment, the result is created by linearly interpolating between the original image and an image, I C , defined with the piecewise constant colour C:

Results
The shading curve is adaptable to a wide range of visualizations. In this section, we discuss various types of visualizations that can be drawn using shading curves and we describe ways in which this primitive can be used. The prototype system was informally tested with novice users (Figure 11), which indicated that the primitive is easy to learn and use. Furthermore, we achieved interactive editing with our implementation. The Sonic image (Figure 11) has most surfaces (172) in a single layer. On a system running Ubuntu 12.04 on an Intel Core i7 CPU (870, 2.93 GHz x8), timing for the DT tracing was 18 and 70 ms for the rendering of the subdivision surfaces. The performance for subdivision could be further improved with a GPU implementation [NLMD12], where we should expect a performance boost of at least one order of magnitude, according to timings on such implementations.
Recall from Section 3 the three-stage approach to drawing with the shading curve: (1) outline objects and main tonal areas, (2) fill in colours and define the influence of those colours and (3) smooth out colours with shading profiles. In the following, we present ways in which the final stage can be performed efficiently. Figures 12(a) and (b) show cartoon-like images created using the default settings [(α i,2 , β i,2 ) = (0.15, 1.0); (α i,3 , β i,3 ) = (0.4, 0.0); h i = ±20; e i = 3% of the image diagonal]; height is manually set negative for dark shadings. Adding slope curves to such images, as in Figure 12(d), can induce more glossy looks. Simulated 3D effects can be achieved by varying the attributes along the curves (Figures 12c and d). Increasing or decreasing the height at selective locations along boundary curves adds a sense of location of the main light sources in the scene, as well as their strength (Figure 12 g). The two other parameters, extent and shape, are then varied to give the shading form. Extent is typically set equal for all control points along a boundary at the preferred offset. Note that if the extent is set too large, the surfaces will extend to local maxima in the DT. See Figure 2(a) for an example where the extent is set further than the MA, forcing many 'outer' mesh points to be placed on a local maximum. This can be dealt with by the artist by decreasing the extents. Such editing is analogous to editing using the width tool in Adobe Illustrator.
The shading profile is the most important factor for creating various types of shadings (Figures 2 and 13). Varying the first shape point related to P i,2 between (0, 0) and (0, 1) (β i,2 = 0) in the normalized coordinate system creates a steep shading fall-off, and is suitable for more diffuse conditions. On the other hand, varying this shape point between (0, 1) and (1, 1) (α i,2 = 1) creates a stronger profile out from the boundary and is suitable for depicting cast shadows and shading highlights. The second shape point, defining P i,3 , should be placed along (0, 0) and (1, 0) (α i,3 = 0) for a smooth fall-off to zero at P i,4 . The location of this fall-off in the image is then controlled by this shape point. The offset curve defined by P i,3 can also be shown in the main editing window so that the artist can directly visualize this fall-off. Figures 14 and 15 show multi-layered images shaded with the chiaroscuro-inspired drawing technique. Each area is defined as single layer and is blended with the underlying flat-shaded image with either screen or multiply blending modes.

Comparisons with Related Work
Recall from Section 1 that there are three previous methods to manipulate colour gradients in vector graphics: DCs, the linear gradient tool and the gradient mesh tool. In this section, we discuss the differences between these methods and our approach.

Comparisons with DCs
Recall that there are two types of DCs: first-order DCs and secondorder DCs. In the following, we compare both of these two primitives with our shading curve.

First-order DCs
The naïve first-order DCs primitive (that is, not assuming additional attributes like blur or weights) is simpler than our primitive. The DC primitive can be associated with a single attribute on each side of the curve: colour. By contrast, our method requires the additional width attribute (assuming that height and shape are fixed). In certain types of scenarios, where colour images produced by Laplacian diffusion provide acceptable results, the DC primitive can be preferable as less input is required.
The disadvantage of first-order DCs, compared to the shading curve, is that they are limited to harmonic solutions. The artist is therefore constrained to first-order diffusion conditions. smooth away from constraints. Thus, this solution produces creases along curves, which can only be smoothed by post-processing operations such as image blurring. By contrast, methods with control over derivatives and gradients, such as the shading curve and secondorder DCs, support smoothness across input curves.

Second-order DCs
The limitations of first-order DCs motivated Finch et al. [FSH11] to propose second-order DCs. The PDE is now constrained by RGB colours and derivative constraints. In the framework proposed by Finch et al., a curve associated with derivative constraints forces the derivative of the colour function to zero either across the curve or along the curve. See Figure 17 for an informal visual comparison with our method.
The mathematical differences between our method (subdivision-Catmull-Clark spline surfaces) and secondorder DCs (PDEs-thin-plate spline surfaces) give rise to practical differences between the two approaches (see the supplementary document, Section 4, for a brief introduction to these two types of surfaces). The advantage of DCs is related to vivid colourings. Our method uses surfaces as interpolants between an underlying image and colour or luminance associated with shading curves. Thus, colour propagation is controlled along a shading curve and can only be manipulated in its perpendicular direction with shading profiles. While DCs do not support the flexibility of shading profiles, they support points as constraints. A point constraint adds boundary constraints to its four nearest pixels. In this way, the colouring of an object can be separated from the curves defining the object's boundary by placing point constraints inside the object. This approach can be preferred over drawing 'special' curves, as required by shading curves, to achieve certain colourings (see the supplementary document, Section 5, for a practical example).
Aspects where the shading curve is preferable over DCs include local gradient control, layering and computational efficiency: r The shading profile, modelled with Catmull-Clark subdivision, provides a local way to model colour gradients. The extents of the edits are local because the control meshes are directly created from the extent attribute of the shading curve. The shading profile is guaranteed to influence only locally the colour/luminance function owing to local behaviour of Catmull-Clark surfaces. By contrast, DCs do not provide a way to locally control the colour gradient. Instead of curved profiles, representing the gradient of the colour/luminance function in a given direction, DCs' derivative constraints are restricted to forcing the derivative to zero in a given direction (Section 2). Thus, DCs do not possess the same degree of freedom for manipulating the colour gradient. In addition, the boundary conditions of DCs are global constraints, influencing the entire colour function. Providing a similar mechanism to the shading profile with DCs is therefore challenging (see the supplementary document, Section 4, for supporting information on this claim).
r DCs are not particularly suitable for layering. In image compositing, the spatial extent of a layer should be easily defined. This is ensured with the shading curve using the extent attribute. By contrast, the solution of DCs must be well defined inside the boundary specified by the DCs. This boundary must be explicitly defined by curves, meaning that influences of open curves and point constraints are not easily constrained. In practice, single objects, fully enclosed by curves or the image border, can be separated into layers. Local effects like specular highlights, however, would not typically be treated by layering and should be incorporated as a single layer to ensure that their effects are smoothly blended with each other.
r Interactive performance is easily achieved with our method. Even the naïve CPU implementation provides acceptable performance. On the other hand, a diffusion process solves a large, sparse, linear system which is naïvely time consuming. Approximate solutions with low-resolution CPU finite element methods [BBG12] or high-resolution (re-evaluation-only) boundary element methods [IKCM13] need to be employed in order to achieve interactive speeds with second-order DCs.
In the supplementary document, Section 4, we discuss additional practical aspects related to this comparison. In addition, observations from drawing sessions with novice users indicated that a tool based on shading curves would be easier to learn compared to second-order DCs and drawing sessions with professional designers indicated that our primitive can complement the current suite of tools (see the supplementary document, Section 7, for details on these drawing sessions).

Comparisons with the linear gradient tool
Illustrator's brush tool supports linear and radial directions of colour gradients both along and across a brush stroke. The feature of applying the gradient across the stroke, named 'gradient on a stroke', was added in version CS6 (2012). A linear or radial gradient is defined as an editable univariate colour function (a curve in colour space) applied in a given (linear or radial) direction. The gradient-on-a-stroke feature is similar to the shading curve since it can be combined with Illustrator's width tool, introduced in version CS5 (2010), to define editable colour gradients out from curves in a given extent. While the extent can be varied along the curve, using the width tool, the colour gradient must remain constant for the entire stroke.
Mathematically speaking, the gradient-on-a-stroke tool and the shading curve are different. Although both are defined similarly, Illustrator's brush tool is associated with a univariate colour function and the shading curve is associated with a univariate shading profile, the rendering of the two primitives is fundamentally different. Illustrator's tool renders the brush primitive with reference to its associated colour profile. By contrast, our method creates a bivariate colour/luminance function (i.e. a surface), shaped according to the shading profile. The rendering of the shading curve is related to the surface instead of being directly produced from the original shading profile. With Illustrator's method, without any reference to a smooth surface, it is not clear how smooth colour profiles can be achieved.
Hence, there are three potential sources of visual artefacts in Illustrator's tool: the rendering procedure, the deformation procedure and blending with underlying layers. Figure 18 shows images coloured with Illustrator's tool, where artefacts are visible. In comparison, our rendering procedure, using subdivision surfaces, produces smooth profiles without discontinuities.

Comparisons with the gradient mesh tool
Illustrator's gradient mesh tool allows the user to edit smooth (bivariate) colour functions with rectangular control meshes. Colours Figure 17: Informal comparison between our method (left two images) and second-order diffusion (right two images) [FSH11]. and first derivative constraints are associated with mesh control points. The control of the colour gradient is similar, but not equal, to our method. While Illustrator's tool does not support shading profiles, the derivative constraints directly correspond to the first derivative of the colour function out from given locations in the image. In addition, colours can be edited in the object interior at points (and not curves), which is not supported with our method.
A major disadvantage of gradient meshes is that they are restricted to rectangular control meshes. They do not support free-form curves as input, which is a more natural type of input in drawing. This difference is identical to the difference between DCs and gradient meshes. Limitations related to rectangular control meshes for drawing are well established; see [OBW*08] for more discussion on this restriction and arguments to why control meshes are undesirable compared to curves in the setting of 2D drawing.

Conclusion
We have proposed shading curves as a new primitive for vector graphics. Shading curves are associated with shading profiles, defining the colour gradient out from curves. Our primitive is converted to 3D control meshes and rendered as Catmull-Clark subdivision surfaces. Catmull-Clark subdivision is related to several attractive properties, such as the local convex hull property and local support, which have enabled us to demonstrate explicit and local control of the colour gradient. Such local control is challenging to achieve with (bi)Laplacian diffusion, which is used to render images created using DCs.

Supporting Information
Additional Supporting Information may be found in the online version of this article at the publisher's web site: Figure S1: An example junction. Figure S2: A high-curvature point: an additional set of control points (red) are added at a high curvature control point so that the surface follows the offset curve more closely.        Video S1.
Supporting information will also be available at the project website: http://www.cl.cam.ac.uk/research/rainbow/projects/shadingcurves.