you can fly!? Painting Foliage with PD Particles...

Billboard Polygons
with Carrara


(best viewed at 1024x768 pixels or higehr resolution)


More Tutorials
PD Particles
PD Artist
PD Pro
TheBest3D.com


In this tutorial, we're going through some more techniques for creating foliage and shrubbery to be mapped onto billboard rectangles for rendering in a 3D scene, such as within Carrara 5, or games and other environments that can use the alpha channel for transparency masking.


Starting with PD Particles

Create a blank of the desired shape and size. Perhaps an 800x800 square image. If you're creating for an interactive 3D game, you may want to stick with image resolutions which are powers of two: 128x128, 256x256, 512x512, 1024x1024  and similar. Often times, but not always, you get best performance from graphics cards or libraries when using such dimensions.
Click the  "Settings" button in the lower right, on the Particles panel.

Select "Roots.opt"

One quick brush stroke across the image buffer and you see your selected particle brush at work.

We may want to use a black color for the background, instead of the white.

Note that if you use the dark color from the color well which looks like black, it actually is not exactly black.

The Red, Green and Blue channels are set to 32, 32 and 16 each.
Set them to zero, by numeric field entry or with the sliders all the way to the left.

This sets the primary color, showing as a dark (and now truly black) rectangle next to the white secondary color under the "Color tools" label.

Once the desired background color is set as the primary color, we can simply drag and drop it onto the secondary color to swap the two.

You could also use the Erase tool with the right button instead, and click "Clear selected to Primary", but with the desired background color set as the secondary color, a simple left-click on the erase tool, or  the keyboard shortcut (Shift-K to Kill) will do the trick.

After clearing the image buffer to the desired background color, and having selected a desired particle preset or fiddled with the settings, make sure also that it's set to render the alpha channel along the particle trails.

If you use "Line", change it to "Line + alpha".

If you use "Shrinking lines", switch to "Shrinking lines +", which of course means 'shrinking lines plus alpha'.


Now as you draw your foliage, not only will you see the shrubbery getting created, but also a selection mask in the alpha channel. It appears as usual in the form of 'marching ants'.

Now it's time to get creative.

Clear the colors:  Shift-K

Clear the Alpha:  Control-D

Below are a few examples, starting from the 'Roots' preset, and then changing size, gradient, randomness, lifespan, splits, split angles, gravity, drag etc...

Right-click any of these to download a zip file containing the Targa files. They were saved as 32-bit Targa, with alpha.


Into 3D

Now on to Carrara 5, or whatever your 3D system is. Whether realtime or not, we'll assume that it is capable of using the alpha channel found in an image for transparency masking.

Let's start by inserting a simple primitive, the Plane object. We'll worry later about orienting it to stand up. After all, we don't see yet which way the texture is going to be  mapped onto it eventually.
Go to the Texture toom, or click 'Edit' in the properties tray to access the shader used by the plane.


In the Color channel, click the 'Color' menu to change it from color to 'Texture Map'


Click the File Open icon in the dialog. Select the Targa file or whatever image file you have created that contains a transparency mask in the alpha channel. The foliage is to be opaque, the background around it transparent.
You can tell Carrara to only use the Alpha or only the colors found in the file. However, we'll stick with both color and alpha.



Now in the Assembly room, select the Scene and add a Realistic Sky.




If you do a rendering in the 3D view however, the shadow is not yet showing correctly. The whole rectangle is casting its shadow.

That's easily fixed. In the Render room, select the Rendering tab of the property tray. Check the box: "Light through Trans." so that the light can go through the transparent parts of the texture.


You can now expect the shadow to show properly.

You might need to also adjust and refine the Shadow Accuracy however, as it defaults to 4 pixels and that's not very precise when you have lots of fine grass helms or twiggs in your trees.


You might also want to make the light that's in the scene become identical in position or direction with the Sun in the sky system, so that the illumination effect and cast shadows match with what the sky shows.
Here's  another view.

You may notice a little bit of darkening along the fine ends of the branches anbd twiggs. That's because it was painted against a dark (e.g. black) background. This still normally looks still much better than if we had kept a light, e.g. white background while painting in PD Particles, in which case we'd be looking a a white'ish glow.

That effect can be reduced by premultiplying the image vs. the inverse of apha. Some imaging tools offer the capability to do that in a single click, so that the color of the branches appear to grow out into the anti-aliased edges, thus chasing away the black or the white color glow along the edges of the twiggs. If you're interested in such a tool, take a look at PD Pro, aka Project Dogwaffle Professional. It comes with a plugin called 'premultiply'.

Other solutions might also work, such as shrinking the alpha, or adjusting the contrast and gamma of the alpha channel. PD Pro offers numerous such tools for further pre-processing the image alpha if needed.
The surface Replicator can now be used to place many instances of this one billboard rectangle all over the terrain.

Insert a Surface Replicator.

Choose the Terrain as the source object, which controls where the billboard will appear.
Then designate the 'Plane' object, i.e. our billboard rectangle, as the object to replicate.


Now the formerly empty green field of our terrain is filled with lots of trees and shrubbery.
A different view against the sun shows great cast shadows.
You can easily add more billboard rectangles which carry different images of different bushes. 

When you edit the shader for it, indicate that you want a new master shader for this new object, so that you can change the texture without affecting the texture of the first bush billboard.



Here's a sample animation done with Carrara 5 Pro. A dozen of billboard polygons were placed in the scene over a desert terrain. The camera was moved from one end to the other, following a target object that was also moving, ahead of the camera, to guide its viewing direction.

  • AVI: anim1c.avi - AVI (high quality xvid coded, 4 MB)
  • Quicktime H.264 - anim1b.mov - good quality, 2.5 MB
<<< click image to view animation as Flash stream