Gradients on a path

This article is about creating gradients that change angle one or more times, such as a gradient on a curved face of an extrusion, and creating gradients over whose range of color you have complete control.

There are two major problems, obstacles to be surmounted, when you need gradients that change angle and/or have a shape that is not square.

Problem 1:

Gradients (fountain fills) can only have a single angle

Since extrusion faces have vanishing points, the two outer edges, if extended far enough, converge, and so, cannot possibly be the same angle. The use of a normal fountain fill must be one or the other of the two angles, or an average of the two. No matter what angle is chosen, at least one outer edge is not going to match the angle of the gradient (see Figure 1).

Figure 1. Convergence factor precludes use of linear gradients

Now, it is true that, when doing extrusions, you could use the shading and lighting functions of the Extrude roll-up, but there are some severe side effects.


Figure 2. Cylinder shaded with Extrusion


Figure 3. Cylinder shaded with linear gradient

Figure 2 shows the same extruded cylinder as Figure 3, however, in Figure 2, the shading and lighting functions of the Extrude roll-up were used. There are a couple of undesirable things happening, as a result.

In order to shade the extruded portion, CorelDRAW creates quite well-defined bands of color, about which you can do nothing.

Also, the light source affects the original object from which the extrusion was formed, in this case, the color is darkened since the light source, to provide the proper shading, does not fall fully on the front face. Maintaining a specific color for the original object is virtually impossible when using the Extrude roll-up’s lighting function.

Figure 3 illustrates the problem of the single angle allowed with a gradient. The average angle (averaging the angle of the two convergence lines) was used for the gradient, and it is quite evident in this illustration that the gradient angle does not match at the either edge of the extrusion face (left or right).

Problem 2:

Gradients always fill based on a rectangular area

Another problem with using fountain fills is the minimal control over the range of color: where specific bands of color appear, unless you happen to be filling a non-rotated rectangle.

Figure 4 shows how a gradient fills the bounding area of a shape. In this case, a custom gradient with white in the middle and black on both ends results in the full black portion of the gradient falling entirely outside the shape being filled. In order to see any black in the shape itself, additional color points must be added to the custom gradient for the black. Even though it is possible to do this, the color bands in a custom fountain fill must be established through trial and error, since they are specified in terms of a percentage of the range to be filled , rather than with “real” dimensions

Figure 4. Gradients always fill to the full extent of an object’s bounding area, which is always a rectangular shape aligned to application window.

The Concept

This method of blending lines to create gradients hinges on snapping straight lines, using the Snap to Objects (Layout menu) to nodes on the edges of an extrusion face. The lines must, if extended, intersect the vanishing point (see Figure 1). The problem here is that, at least in CorelDRAW 5 and 6, performing an extrusion on an object creates extrusion faces with way too many nodes, so many that it is hard to discern which nodes you need to use.

How to Auto-Reduce Extrusion Faces

  1. The first step is to add nodes at the points to your original object, before extruding it, where you want color shifts to occur. The easiest way to do this is to select a node, adjacent to the portion of the curve where you want the new node, and either click on the plus button in the Node Edit roll-up or press the gray plus key on your numeric keypad (see Figure 5).

    Figure 5 shows a node added at the upper right on the outside circle that will represent the color shift to white. The end color for both extremes of the blend will be a dark brown color, and since the extrusion will be an approximately a 45-degree angle, the nodes for the end lines of the blend can snap to the corners of the extrusion face. the top node and the far right node of the outside circle.

    The reason to add these nodes is that they will be “preserved” by the extrusion function, and the corresponding nodes will appear on the back edge of the extrusion face.

Figure 5. Here, a node has been added, in the upper right quadrant, on the outside outline, where a color shift is to occur in the desired gradient.

Figure 6. Here, guidelines have been added to mark the Extrusion vanishing point.

  1. The next step is to perform the extrusion. Turn on the Snap to Grid (and set up your Grid and Scale Setup, as needed) so that, when placing the vanishing point, it will snap to a location that will be reasonably easy to locate later. But before exiting the extrusion function, while the “X” that represents the vanishing point is still showing, you’ll need to drag some guidelines to the “X” to mark the vanishing point for use in some of the following steps (see Figure 6).

    It’s okay to go ahead and apply, by default, using the fill color for the object being extruded because you’re going to do a Powerclip inside the extrusion face and completely cover the color that’s there, anyway.

  2. Now bring up the Layers roll-up, from the Layout menu, and create a new layer called “Extrusions” (click on the Layer Edit button — the right-pointing arrow just below and at the far right of the roll-up’s title bar). Make this new Extrusions layer not visible (no “X” in the Visible check box), and then click on OK.

  3. Click on Layer 1 (or whichever layer you used for drawing your original object) in the Layers roll-up.

  4. Now Separate your original object from the extrusions (Alt+A+S or Separate from the Arrange menu).

  5. Click off to the side, somewhere, to deselect all the objects, and then click on one of the extrusion faces.

  6. Click on the Layer Edit button in the Layers roll-up and select Move To. A thick arrow will appear.

  7. Use the thick arrow that appears to click on the Extrusions layer in the Layers roll-up. Your extrusion faces will disappear — not to worry; they’re still there, just on an invisible layer.

  8. Click on Layer 1 (or whichever layer you used for drawing your original object) in the Layers roll-up.

  9. Turn on the Snap to Objects, and turn off the Snap to Grid, both in the Layers menu.

  10. Click on your original object (so you can see the nodes)

  11. Draw straight lines from the nodes on the original object — the ones you are using for your color-shift points — to the intersection of the guidelines you placed at the vanishing point (see Figure 7). You’ll need to click on the original object, immediately prior to drawing each successive line, in order to see the nodes you have left. The nodes on the original object will disappear immediately when you select the pencil tool, so if you miss, when placing the ends of the lines, just select the Shape tool (Node Edit tool) and move the ends around until they snap into position.

Figure 7. Here, straight lines are drawn from the nodes at the color-shift points on the original object to the intersection of the guidelines at the vanishing point.

  1. Double-click on the Extrusions layer in the Layers roll-up and put an “X” in the check box for visible.

  2. Click on one of the extrusion faces and do one of three things: click on the Group/Ungroup button in the Toolbar; press Ctrl+U, or select Ungroup from the Arrange menu.

  3. Click off to the side, somewhere, to deselect all the objects, and then click on the extrusion face you’re going to work with (in this case, the top one).

  4. Change to the Shape tool (Node Edit tool).

  5. At this point, you may want to point to the Extrusions layer in the Layers roll-up and drag it down below Layer 1. This will cause the lines you drew to the vanishing point to appear on top of the extrusion face.

  6. With the Zoom In tool, marquee select just a portion of the back edge of the extrusion face. The portion to marquee select is just the area between any two nodes you want to keep (those that have vanishing-point lines running through them and the two outer-most nodes of the back edge — as shown by the dotted blue line in Figure 8).

Figure 8. Here, the Zoom-In tool has been used to marquee select an area on the back face of the extrusion containing two nodes to be preserved (and all nodes in between). (See resulting enlargement in Figure 9.)

  1. With the Shape tool, marquee select all the nodes between the outer-most one of the extrusion face and the one through which the vanishing-point line extends (Figure 9).

Figure 9. Here, the Shape tool has been used to marquee select all the nodes between the outer-most one of the extrusion face and the one through which the vanishing-point line extends.

  1. Carefully, so as not to move it, double-click on any one of the highlighted nodes — this will bring up the Node Edit roll-up. If have, or think you have, accidentally moved a node or a curve line, check the Undo menu; if the top menu selection is “Undo Curve Edit,” then you did, and should undo it (it wouldn’t hurt to at least check the Undo menu, even if you don’t think you moved it).

  2. Select Auto-Reduce from the Node Edit roll-up. This will eliminate most, if not all, of the nodes that you highlighted.

  3. Repeat the procedure for each range of nodes to be Auto-Reduced, making sure to never highlight the nodes that are to be retained. Do the same for the front edge of the extrusion face. This results should look like Figure 10.

Figure 10. Here is how the extrusion objects should look after Auto Reducing.

Now you’re ready to start adding the lines, snapped to the remaining nodes, that will be used to create the blends.

Adding the Blend Lines

  1. Turn on the Snap to Objects (to make it somewhat easier to find the snap points, since you won’t be able to see the outer-most ones, you might also want to turn off the Snap to Guides and Snap to Grid).

  2. Click on Layer 1, in the Layers roll-up.

  3. With the Pencil tool, click first on any intentionally-kept node on the front edge, and then do the final click to complete the line on the corresponding node on the back edge. It is important, if you create these lines individually with the pencil tool, to be consistent about whether you click first on the front edge or the back edge — otherwise, the blend will look rather strangely twisted.

  4. Repeat the creating of lines for all pairs (front edge and back edge) of intentionally kept nodes — just ignore the ones that Auto-Reduce was unable to eliminate.

  5. With the last line you drew still selected, hold down the Shift key and click, successively, on each of the previous lines you just drew, to “multiple select” them.

  6. With the alternate mouse button (right button, right-handers), click on the red color swatch in the color palette at the bottom of the screen (this is temporary — just so they’re easier to see and to make sure that you did select all the lines, and only the lines).

  7. Select the Outline tool (pen nib) from the tool box, and click on the pen nib in the flyout (or press F12), and change the line thickness to 1 or 2 points, and click on OK.

The thickness you choose for your outline will depend on the size of your object. There are two factors to take into account. You probably should try to keep the number of blend steps, between any two lines, under 200, if possible, otherwise the redraw time (as well as file complexity) is excessive. Also, for the smoothest blends, you want to have one step for approximately every half-point of distance. Typically a one or two point thickness is appropriate for these lines.

After completing step 7, you should have something that looks like Figure 11.

Figure 11. Here, all lines have been added, snapped to the nodes on the front and back of the extrusion objects.

Before you do the blending of the lines, you need to change the color. But even before that, you need to lengthen the lines. The lines, as drawn are not long enough. If you were to blend them, as is, they would look like Figure 12 — the blend would not extend all the way out to the back edge of the extrusion face because blends occur in a straight line.

Figure 12. Here, two of the lines have been blended to show how, without prior resizing of the lines, the blend area falls short of the desired fill area, due to it’s curved edges.

It is possible to make the blend curve match that of the edges of the extrusion face, but it’s a process of trial and error and hardly worth the trouble when there is a much easier way.

Scaling the Blend Lines

  1. Click on the Transform button in the toolbar (or select Transform Roll-up from the Effects menu). Position the roll-up as need in order to be able to see and select what you working on.

  2. Select any one of the lines (easiest way is to click off to the side, to deselect all objects and/or to move the “focus” out of the Transform roll-up, and then press the Tab key to select the last drawn).

  3. In the Transform roll-up, select the Scale button (third button).

  4. Specify equal values for both Horizontal and Vertical scaling — start by trying 150% (you just need to get the ends of the lines past the curve so that, when blended, each blend will extend past the edge of the extrusion face), and then click on Apply.

  5. Press the Tab key to select the next line and click on the Apply button in the Transform roll-up. Repeat this step until all the red lines have been scaled.

Your illustration should now look like Figure 13.

Figure 13. Here, all lines have been resized, by percentage, to extend each line beyond, but still aligned with the nodes.

Applying the Line Colors

  1. Click off to the side to deselect all objects, and click on one of the outside red lines.

  2. With the right mouse button (alternate button), click on the Banana Yellow color swatch in the color palette at the bottom of the screen.

  3. Bring up the Outline Pen dialog box (F12), click on the color button, select the More button, change the K (Black) value from 20 to 70, click on OK, and then click on OK, again, in the Outline Pen dialog.

  4. Click on the other outside red line, and apply the same color changes to the line as in the last step.

  5. Click on the next line in from either side, Shift-click on the other next line in (to multiple select), and with the right mouse button (alternate button), click on the Banana Yellow color swatch in the color palette at the bottom of the screen.

  6. Select the only remaining red line and, again with the right mouse button, click on the white color swatch in the color palette.

Your illustration should now look like Figure 14.

Figure 14. Here, the appropriate outline colors have been applied. Note the two lines to either side of the middle white one that have the same color as the fill of the extrusion and original objects.

Performing the Blends

  1. Select the Blend roll-up from the Effects menu.

  2. Click the left most dark line, Shift-click immediately to the right of it

  3. From the distance on your rulers, try to gauge the distance between the “near” ends of the lines (the ends that are farthest apart). If you really have trouble guessing, you can deselect the lines and, with the Snap to Objects on, draw a line between the two line ends — and before you click on the second line end, allow the line to snap into place and, in the status bar, read the value for “Distance.”

  4. If you are working in inches, multiply the inches by 144; if you are working in picas, multiply the distance by 24; if you are working in points, multiply the distance by 2.

  5. In the Blend roll-up, Enter the result of the math (ugh) in the last step for the number of blend steps, and click on the Apply button.

  6. Click off to the side to deselect, and click on the line forming the right side of the blend you just created (the Banana Yellow line). Make sure the status bar reports that you have selected a Control Curve.

  7. Shift click on the next line (the white one), gauge the distance between the near ends of the lines, figure and enter the appropriate number of steps in the Blend roll-up, click on the apply button.

  8. Click off to the side to deselect, and repeat this blend step figuring and application for the remaining pairs of lines. Always make sure that, when you select what you think is the line forming the end of a blend, the status bar reports that you have selected a Control Curve.

Your illustration should now look like Figure 15.

Figure 15. Here, all the blends have been completed. Note that each of the straight edges of each of the blend groups now completely covers the curve of both front and back of the extrusion objects.

Powerclipping the Blend

Now you need to Powerclip the compound object (the multiple blends) into the extrusion face. In order to do that, you need to be able to see the extrusion face, which is currently obscured by the blend. Fortunately, since you put the blend lines on Layer 1 and took the precaution of putting the extrusion face on a separate layer, it’s an easy matter to move the extrusion to the front.

  1. In the Layers roll-up, drag the Extrusion layer above Layer 1. You illustration should now look like Figure 16.

Figure 16. Here, the layer containing the extrusion object (which will be the PowerClip shape) has been moved above the layer containing the blend groups, so that you can now see the extrusion object in order to select them.

  1. Click on an available area of the blend (not one of the control curves), so that the status bar reports what you have selected is a Compound Object.

  2. From the Effects menu, select Powerclip.

  3. From the Powerclip flyout, select Place Inside Container.

  4. With the thick arrow that appears, click inside the area of the extrusion face.

Your illustration should now look like Figure 17.

Figure 17. Here, the blend groups (the Compound Object) has been PowerClipped inside the Extrusion object.

  1. In the Layers roll-up, drag the Extrusion layer back down below Layer 1.

  2. Delete the (now) unnecessary lines that extend to the vanishing point (or, if you think you might need them, create a new layer, make it invisible, and move the vanishing point lines to the invisible layer).

  3. Select the extrusion face, and, with the right mouse button, click on the “X” button at the left of the color palette at the bottom of the screen.

Your illustration should now look like Figure 18.

Figure 18. Here, the extraneous lines (including vanishing point lines) have been removed and the outline of the extrusion object changed from white to none.

HINT: To see what this object would look like under very specific lighting conditions, use CorelDRAW 6’s CorelDREAM 3D to set up a 3-dimensional scene and render to a TIF file. You can then import the TIF file into CorelDRAW and recreate the effects with vector tools.

Figure 19 shows the cylinder with a blend applied to the “interior” extrusion face, as well as a custom linear gradient at a minus 45-degree applied to the front edge.

Figure 19. The finished cylinder.

You have now seen that, with CorelDRAW, it is possible to create gradients that have more than one angle, through the use of blends applied to straight lines which are then Powerclipped inside closed curves. You have seen how this can be particularly useful for adding realistic shading to extrusions of objects with curved surfaces. With this technique, you can overcome the two basic problems with gradients, that they can have only a single angle, and that the range of the gradient is always based on the rectangular bounding area of the object being filled.

Expand your limits — go forth and create.


Copyright ©2005 by Byron Canfield