2

I'm trying to create a Polygonal Gradient fill in Inkscape or Illustrator. Here's a rendered example of what I'm trying to do:

Polygonal Gradient on a pentagon

The image above shows a black-to-white polygonal gradient on a pentagon. As you can see, the gradient is neither linear nor radial. It follows the shape of the polygon: the color of each pixel is determined by its distance to the nearest border. The further away from any border the pixel is, the more of the "inner" colour (in this case: white) is used.

Can inkscape or illustrator do something like this? And, bonus question: can I somehow make this work for curve-based shapes too, such as a rounded rectangle?

It seems so very basic but I just can't seem to do it.

EDIT: I just learned that Gimp has an option for bitmap-based graphics called "shapeburst". It does exactly what I want - but only for bitmaps. This site has some nice examples. Here are the Gimp docs on this topic.

3
  • without claiming anything of the availability of this as an effect I'd say: One can draw this. It's 5 thin white lines, 5 blurred white lines , background with a radial gradient from white to black and a masking shape with black fill and blurred pentagon hole. I guess you do net expect a drawing but an effect. Right?
    – user82991
    Apr 2, 2020 at 20:44
  • Yes. Specifically I intend to use the result as an alpha mask in this case. Any manual modifications would become really obvious and stick out. I like your idea, but the pentagon is a very basic example; this approach will not scale for more complex (and curve-based) shapes. Apr 2, 2020 at 21:23
  • Vector images do not suffer especially badly if the alpha mask is a bitmap image, so your GIMP finding can be usable.
    – user82991
    Apr 2, 2020 at 21:27

1 Answer 1

3

This is for Inkscape 0.92, and uses the Interpolate Extension, although something similar could also be achieved in Illustrator using a Blend.

  1. In Inkscape draw a pentagon, and fill it black, no stroke

  2. Copy and paste it in place

  3. Scale the copy to a small pentagon in the centre of the larger pentagon, and fill it white.

  4. Select both pentagons, and do Extensions > Generate from Path > Interpolate

  5. Set the Interpolation steps to something like 75, and other settings as shown, then click Apply

enter image description here

  1. Finally draw a black square over everything, and do Object > Lower to bottom

Example made in Inkscape

enter image description here

3
  • Looking great in your example, but I'm running into an issue with the interpolation. For me, it just turns the entire shape solid white. What other interpolation settings (exponent, method, duplicate end paths, interpolate style...) did you use? Apr 3, 2020 at 13:10
  • Ah now it works! I had to use interpolation method 1 (whatever that means), and enable "use Z order" as well as "interpolate style". Thanks! Apr 3, 2020 at 13:14
  • 1
    @Alan47 Here are my Interpolate settings. I added them to the answer for clarity.
    – Billy Kerr
    Apr 3, 2020 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.