great tools for happy artistsCarrara Studio & Project Dogwaffle:

Using Trees from DigArts
with 2D & 3D tools


to Probe Further:

DigArts  makes great collections of foliage systems such as trees, with Alpha channel masks. They also carry image cell collections, which you can use to paint even more sophisticated plant sets with Painter, Paint Shop Pro and other paint software. Check out their newest collection, the Jungle DVD - artist edition!

Now, you might think, why bother with tree images when Carrara comes with its own Plant generator? Well, good question. Sometimes indeed you'll need in fact a fully 3D tree, with branches and leaves growing in all directions, and casting proper shadows no matter from where you're looking at it.  But there's more to it. There's also the need for grass and foliage on the ground. In game design, you can't afford to make 3D trees if they're there just to decorate your 3D scene, only if the action of the game actually happens in the tree and you need lots of detail up close. Then it's good to know that you can convert a tree from the Plant system in Carrara to a vertex model and do custom changes and editing work to it.

Architectural walk-throughs such as those shown at Renderings.com often make use of 2D tree images, even 2D animated tree sequences, which show the leaves moving due to wind. Likewise, people can be added and shown from movie clips recorded against a blue screen. Marlin Studios makes excellent People in Motion often used in architectural displays and walk throughs.

Sometimes you'll also use a paint system like the particle brushes in Project Dogwaffle to plaster the ground with grass and high tufts and other realistic foliage effects such as for sprites used in gamedev. In other cases you're just dreding the rendering time involved with hundreds or thousands of 3D trees in an architectural walk-through. Rendering a few quadrilateral polygons instead, loaded with a good texture and transparency map, will certainly help.

In this tutorial we're using the samples found in the Assorted Trees collection, the freebies found at DigArts. They are free for non-commercial use. With DigArts's permission we're using them here to show you some ways of working with them with Carrara and other tools. You can get these and other sets at the download page of DigArts.

Note that since Carrara 5 has an object replicator, it is a perfect combination when you need a whole forest full with thousands of trees.  But even with the earlier Carrara Studio 3 there's a lot you can do to place 3D billboard rectangles into the 3D scene that will carry your alpha-mask enabled tree pictures.






1) Previewing the Photoshop Images

The tree samples coming from Gardenhose.com  are in .psd file format. Carrara will load these just fine. But what if you didn't have Carrara, or if you have a version that doesn't use the Alpha channel directly, such as Carrara Studio 3, where you'll want to isolate and separate the alpha channel from the color channels found in the 32-bit image? The alpha channel can be used in Carrara's transparency channel. You'll need to find a way to extract the alpha channel into an 8-bit greyscale image, such as Tiff or Targa. You could then also keep the 24-bit image portion (rgb) in its own file. Carrara Studio 3 would then let you load the rgb into the color channel as a texture, and the greyscale alpha channel into the Transparency channel (as a texture again). Note that even though it is an 8-bit greyscale image, the alpha channel's transparency information would typically be almost all on or off, i.e. transparent or opaque. Some pixels around the transition zones like around the tree's trunk or around some branches and leaves might show a transitional alpha value to blend between full opaque and transparent transparent. Also, some very thin leaves might want to be shown as semi-transparent. Hence the need for more than just one bit of on or off transparency.

What tools to use? Project Dogwaffle can do much. But if you have $29 to spare you might want to upgrade your Quicktime player to Quicktime Pro. It's not only a cool tool for converting AVI to Quicktime movies, but also image sequences. And when you have a rendered animation in AVI or post work completed in Dogwaffle, converting it to Quicktime 7 to show online as a highly compressed H.264 compressed Quicktime file is a great solution.

Here we have an example of the Apple tree (purely by coincidence :-) from DigArts.





converting the images with Quicktime Pro
viewing the Apple tree in the Quicktime player

2) Converting to Targa

You can save (export) the tree, selecting Targa for example as the format.

If you want to convert from PSD to TGA for other reasons, such as to have it in Dogwaffle's preferred format, and yet still keep the alpha channel in the same image,then  be sure to select the color depth as Millions of Colors+, not just Millions. The '+' stands for the additional bits used for the alpha channel. It goes beyond saving just the millions of colors - it also saves the alpha channel, aka selection mask.





converting to Targa with alpha channel intact


3) Testing in Dogwaffle

Here's a test in PD Pro, after opening the image through File>Open... in Project Dogwaffle 3.5. You should see the familiar 'marching ants' outline indicating the presence of a selection mask coming from the alphachannel.

Note that PD Pro has two options for loading Targa images. The native, preferred method  ('Default Targa' filetype) will load the alpha channel and uses a built-in loader. The Automatic 60+ filetype, using ImageMagick, may not always do so.. So be sure to use the 'Default Targa' type in the File>Open dialog.




checking the Targa in Dogwaffle

After opening the image, use Control-B or the first item from the Brush... menu to transfer the current selection to a custom brush. Then you can use

Brush > Store/manage...

to store and view the brush's image and have it ready for use in painting in different ways, changing size, orientation, colors etc... Notice that only the extent of the tree's selection is found in the brush, based on the selection mask, not the whole original image. This helps in fact reduce whitespace around the tree when it's transferred to the brush.. You can then use

Brush > Save...

to save the alpha-masked image from the brush back to a file, perfectly cropped to just the tree. 
4) Inverting the Alpha Channel

Some images may not have the 'proper' selection mask. They might be inverted. Should an alpha value of 'white' (all bits set to '1') be  transparent or opaque?  That really depends on the interpretation be the program you use, which is going to make use of the alpha channel one way or another. Is it opacity? or Transparency, i.e. the complement to opacity?

 In some cases, white is transparent, in other it's opaque.  Therefore you need an easy way to invert it. Carrara has a flag to invert color in a channel, so there's probably no issue there. Just in case, make sure you know how to invert the alpha channel at the level of the image in your image editor. 

Here we see it in PD Pro, before inversion and with another tree image. In the Alpha menu there's an option 'Invert Alpha'. It can also be found in the Alpha controls panel shown here.


inverting the alpha channel
ooops, this alpha channel needs to be inverted





5) Alpha Channel Inverted

Ok,  we've inverted the alpha channel. After using Control-B to transfer the new selection to the custom brush, and storing it (Brush>Store/manage...) you can see that it appears at a different size, and not only properly inverted. The change in size is because there is no more excessive whitespace around the tree. It was left out of the selection and not transferred to the brush: the Control-B shortcut loads only the current selection to the brush, and only the tree was in that selection after the inversion, whereas before it was all the background image around the tree. (that all said, the aspect ratio is ignored in the brush preview thumbnail, hence the slightly widened skew of the second thumbnail).

Inverted the alpha channel
after inverting the alpha and picking it up with Control+B
6) The complete Forest

Loading the complete set of images from the free tree collection at DigArts, you can create yourself a nice collection of several tree images for very quick composition of excellent tree scenes. Here's an example with over half a dozen tree images loaded as brushes. We then did a little arrangement with these trees against a simple sky background from Dogwaffle's  Sky generator found in the Filter>Render menus. You could use your Sky images from 3D renderings or a real photo of course.

  ... Saving to Media Manager:

To access these trees even faster you can also save them in the Dogwaffle Media Manager (also known as the Media-Pedia which was introduced in Dogwaffle 2.0). The preview image is not exactly useful since it's used in a more traditional brush sense along a brush stroke. Instead, we really are just interested in the fact that the brush image is stored and saved along with all imaginable parameters, saving you time by not having to recrete all these fine tuned parameters next time you run Dogwaffle and want to use the same trees. You will easily be able to locate your saved trees and simply in the Media-Pedia window by name. You double-click their text entry in the media manager to select and load it as the current brush whenever you need it. (a single-click on the saved text item only shows a preview but doesn't select or load the brush as current).


seven DigArts trees and the Media Manager
seven trees from DigArts

7) Isolating the Alpha Channel

There are those cases we've mentioned where at times it's necessary or desired to isolate the alpha channel. Either because you're using Carrara Studio 3 and you'll need a greyscale image of the alpha channel to load as the Transparency map, separately from the color texture map.  Heck, and why not, perhaps you really are interested in only the alpha channel image. After all, it makes for a cool outline that can be handy for making strange things such as music videos.

Or, perhaps you just want to create a variant of the original tree, perhaps to show how it might look after an explosion from a nearby meteor impact has cut off the upper half of the pine trees. You can easily work with the transparency mask from the alpha channel to make the un-desired parts invisible, simply by painting the upper half to transparent alpha levels.

Dogwaffle lets you copy the Alpha channel to an alternate buffer (the Swap buffer), from where you can also swap it back with the Main buffer. You can then paint on it and send it back to Alpha.  Regardless, you can paint directly to the alpha channel.

There are even more elegant ways to do this, such as storing a snapshop of the alpha. Like storing a snapshot of the color channels or storing&managing the custom brush image, you can grab a snapshot of the alpha mask:

   Alpha > Store alpha...

and directly paint therein (you can also invert Alpha therein, by-the-way).

And, you can also toggle the general paint mode to paint on Alpha in the Main buffer.

And there's also a built-in brush, Paint on Alpha, where the Blobby mode comes in very handy for foliage systems in addition to the hard and soft brush modes.



isolating the Alpha channel
isolating the alpha channel of the Blue Fir




Editing the Alpha channel to cut off the top of the tree
after the blast - top of the tree missing



7) Saving as Greyscale

Carrara Studio 3 doesn't handle the alpha channel directly (but Carrara 4 and 5 do). So if you use Carrara Studio 3, then you'll want to extract the alpha channel into its own greyscale image, to load it as a texture into Carrara's transparency channel.

There are several tools available to stretch the dynamic range of the alpha mask so that it does go all the way to dark black and full white for transparent to opaque. You can also work with contrast and gamma, value and brightness while on the alpha channel. Whichever method you choose, be sure you have the full range in use so that the tree trunks will indeed be fully opaque.

Saving to greyscale
saving the alpha as a greyscale to Targa

9) Putting it all together

Using just one tree image, you can quite easily make several variants from it. Either by trimming down the alpha channel to cut off some branches. You can also mirror the image sideways. When you place such images as textures  (billboards) into a 3D scene you can get very decent results. Here's an example with just 4 trees, using the mirror and the alpha mask tricks.

Carrara 5 rendering



Here's a composition done with PD Pro. Only one image of the broken tree was used, but there are mirrored versions and some with slight changes in coloroation or saturation as well as different sizes, i.e. smaller ones to show farther distance..

There is also, of course, some amount of optipustics-based particle brushing along the ground near the bottom to show grass.