7
$\begingroup$

Leaf Example

I want to make my own leaf textures for trees, but if I just make a PNG with transparent background it gets a weird white edge. I found that usually they use this effect with an alpha mask to get rid of that issue.

I found the name of the technique is called "Edge Padding" or even "Edge dilate". It creates an offset of the border of the image and expands the pixels outwards creating a "frame" around it.

$\endgroup$
0

3 Answers 3

14
$\begingroup$

There is a compositing node called Inpaint that does exactly that:

enter image description here

It can be found in the Compositing Nodes add menu Shift+A in the Filter section:

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ Nice find, wasn't aware of this. +1 for making it in Blender $\endgroup$ Commented Nov 1, 2018 at 18:11
4
$\begingroup$

An alternative technique using modelling tools

Import you leaf image as a plane using File > Import > Image as Plane (activate the addon in the User Preferences if necessary.

Enter Edit Mode in the imported plane and use the Knife Project tool (K).

Trace over the border of your image with as much detail as desired, making sure you always tread slightly inwards in relation to the alpha edge so the cut is always over the opaque part of the image. (Illustrated below is a quick and dirty, you can follow the image detail more closely)

enter image description here

Once done, eliminate the surrounding leftover faces so only the leaf remains.

Select all border edges and extrude them in place with E then immediately Right Click to cancel. Proceed by scaling them up as desired.

enter image description here

$\endgroup$
2
  • $\begingroup$ Is there a way in blender to quickly overlay the original back onto the result above? $\endgroup$
    – batFINGER
    Commented Nov 1, 2018 at 16:00
  • $\begingroup$ You could probably do the above operation either in a separate object, or duplicate the original plane in edit mode, then overlay it afterwards my moving slightly in Z axis. You would have to somehow bake or screencapture the result though $\endgroup$ Commented Nov 1, 2018 at 18:17
2
$\begingroup$

Could not really find an elegant solution for this.

In the particular case of a single leaf, or images with simple island shapes you could achieve a vaguely equivalent effect using GIMP's Recursive Transform.

enter image description here

Open the desired image with an alpha channel in GIMP, increase the size of the layer with Layer > Boundary Size as desired, so there is actual usable image space around the leaf layer.

Open Filters > Map > Recursive Transform use the on-canvas gizmos to very slightly scale the image up. The smaller the factor the smoother the expansion, at the expense of having to repete the process to fill the available space.

Tick the option Paste Below so new iterations don't overlap the original leaf, and adjust the iterations as necessary. Repeat the filter with Ctrl + F if necessary to fill available space.

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .