5 min read

In this article by Robin de Jongh, author of Google SketchUp for Game Design, you’ll learn about making foliages for game assets.

Making Foliage for Game Assets

Here’s a technique that’s one of the mainstays of asset creation. It’s completely independent of what Game Engine you use. Let’s call it The Invisible Pixel. You can see this technique in action when you take a look in the sample chapter for Google SketchUp for Game Design. This technique adds unparalleled realism to your games.

For this short tutorial, you will need a photo of a branch which you can find on http://www.cgtexture.com named Leaves0110. Also, you need to have Photoshop or install GIMP at http://www.gimp.org.

Time for action – creating foliage

  1. Open the image in GIMP.
  2. Go to Filters ¦ Blur ¦ Blur. This blurring of the image helps the Fuzzy Select tool do its magic.
  3. Select the Fuzzy Select tool and change the Threshold setting to 20.
  4. Click on an area of the cardboard background. Now, select more areas holding down Shift to add them to the selection, as shown next:
  5. This way you gradually build up a selection of only the cardboard. Or, in other words, you build up a selection around the branch and leaves. Use the Ctrl key and click if you wish to remove any part of the selection and if it has accidentally selected part of the leaves.
  6. When you’re part way to finish, but you can’t see the wood for the trees, go to Layer ¦ Mask ¦ Add Layer Mask. Select Selection and Invert Mask.
  7. Don’t worry about the brick background for now. We’ll remove this later.
  8. You can see better what you’re doing now. Go to Select ¦ None. Continue selecting areas of cardboard that remain. You may need to reduce threshold to 15. You can see my progress as shown in the next screenshot:
  9. Whenever you want to add your selection to the mask, click on the mask in the Layer Pallet, select the Fill Bucket, and then click inside your selection. You must have the following settings selected:
  10. Now, reset your selection, click on the normal layer in the layer pallet, and continue using the Fuzzy Select tool.
  11. Continue until you’re either happy with the outcome or bored to death. You might have something like the following:
  12. Now, there are things you can do to speed up the removal of the fiddly bits you missed.
  13. First, use a large brush with the Paint Brush tool on the mask layer to remove all the brick. Then use a smaller brush to remove the stray areas that got away.
  14. Right–click on the Layer Mask and select Mask to Selection. Now go to Select ¦ Shrink and type in 2 and click on OK.
  15. Go to Select ¦ Invert. Select the layer mask and then use the Fill tool on the same settings as before.
  16. Create a black layer and move it below this one, so you can see if there are any haloes around the leaves. This looks pretty good so far, but at the edge of some leaves you can see there’s a little light too:
  17. You can adjust the mask manually here if you need to unmask any areas such as thin branches. You can also go around the edge if you wish using the Paint Brush tool (with the mask selected) to remove haloes.
  18. Now, delete the black background layer.
  19. Go to Layer ¦ Transform ¦ Arbitrary Rotation.
  20. Use the mouse to rotate the image layer so that the branch is horizontal. Click on Rotate.
  21. Now, crop the image.
  22. Go to Image ¦ Fit Canvas to Layers.
  23. Add a background layer in green.
  24. Right–click on the mask. Select Mask to Selection. Now, go to Selection ¦ Feather.
  25. Select 2 or 3 pixels and click on OK.
  26. Now, create a mask for the green layer. Select the Selection option and deselect Invert Mask.
  27. This fills all the gaps you may have accidentally left, with green, so you don’t notice.
  28. Save the .xcf file. Reduce the images size to 512 pixel wide (you’ll learn why, and how to do this in Chapter 3 of Google SketchUp for Game Design). Now, save a copy in the PNG file format named Tree_Branch_512.png.

Here’s your finished branch.

What just happened?

You’ve isolated the branch in the photo from the background. This is usually laborious and the only way to really speed it up is to start with a photo on a plainer background. So, from now on, you can use your own photos taken on a piece of blue card or cloth. It’s just the same technique as blue screens used in films.

Your image has an alpha channel so that it will appear without the background in SketchUp or a game engine such as Unity 3D. You didn’t even need to create the alpha channel because it was created by masking your layers. The reason you shrunk your selection earlier was to get rid of the halo effect—a light color that surrounds alpha masked images that have been poorly cut out.

Now, you can import your branch into SketchUp to create a tree, plant, or shrub to use in your games or architectural visualizations. Here are a couple of my attempts, importing the foliage into Google SketchUp and rendering with Kerkythea. I used the Make Fur plugin to arrange the branches:

LEAVE A REPLY

Please enter your comment!
Please enter your name here