Creating Leaves Using 3D Particles

This tutorial shows how to simulate tree or plant leaves using textured 3D particles in Realsoft 3D V8. Thanks to Bernie den Hertog for the original ideas and proof reading.

Originally created by Robert den Broeder, August 25th 2004. Last update April 14th 2017

Beginner/intermediate level.

Creating the particles

Click on the Creation tab and select the Particle tool.

Particle tool selected, set to create 3D particles using the Brush pen.

Select the 3D particles and select the Brush as pen type. This allows you to literally spray particles around. Next set Brush (which defines the brush radius in pixels) to 30, Count to 2 and Project to 'Sphere'.

Spherical brush projection selected

These settings allow you to spray just a few 3D particles with every mouse click. This also causes the particles to be sprayed around using a spherical brush, meaning that the particles are not all in the same 2D plane, but spread in all 3 dimensions, only limited by the size of the brush.

To see how this spherical brush works, just click and hold the right mouse button for about 10 seconds and then accept the tool. In your view window the particles will form a 3D sphere about the size of your brush.

A nice feature is the counter in the View window, which shows you exactly how many particles are created:

The counter shows how many particles are created

Press Ctrl + Z to undo last action. Then, in the view window, press the right mouse button and select 'Again' from the pop-up menu. This restarts the particle tool with the same settings as you had the last time you used it.

Select 'Again' to restart the tool with the same settings as last time

The particle tool has some additional controls for size and direction. Set 'Size' to 0.01, 'RndSize' (Random Size) to zero and RndDir (Random Direction) values to 0.5 and 0,5.

If RndSize is set to zero, all particles will have the same size. If RndSize is set to a higher value, more and more particles will have a different size.

The same goes for RndDir: if set to zero, all particles will have the same orientation towards the camera; change that value and their orientation will change randomly. The randomization is controlled with 2 values. The first value defines how much the axis of each particle changes randomly. In case of 3D particles, the controlled axis is the z axis. The second value controls the random rotation around the axis.

The greater the values, the more randomized direction each particle gets. For the first component, value 1.0 already randomizes the direction 180 degrees, but the original direction still dominates the average of directions. For the second random component, value 1.0 gives a totally random rotation around the axis.

Settings for Size, Random Size and Random Direction

All settings are OK now. So, spray just a few particles around by clicking and releasing the left mouse button at various locations in the view window. If you click and hold the left mouse button, more particles are added to the scene. The counter exactly shows how many particles are created. When done, accept the tool. A 3D particle object is now added to the hierarchy in the SelectWindow.

From spheres to rectangles

If we now render the scene, all 3D particles will render as spheres. This is the default setting for 3D particles. Because we want to make the particles look like leaves, we need the shape to change from spheres into rectangles. This is simply done by changing the properties of the 3D particle object. Double click on the 3D particle object in the Select Window to open its properties. Go to the Spec tab of the Property Window. On the Rendering tab make sure that "Post Processing"and "Scan Line" are unchecked and then check "Ray Tracing" and then "Ray Trace Rectangles". This last option ensures that all particles are rendered as rectangles, which can be textured. In this case, we can texture them now to look like leaves. And because we set the RndDir option as well, not all rectangles (leaves) will face the camera, which enhances the effect we need.

Ray Tracing and Ray Trace Rectangles options set on the Rendering tab of the Property Window

When the Ray Trace Rectangles option is set, all 3D particles are rendered as equally sized squares. This is of course due to the settings we used when creating them (RndSize = 0). It is also possible to edit the size and shape of each individual particle inside the 3D particle object after we created them. Attributes like size, shape, position and orientation of the individual particles can even be key framed for animation.

To change the size of a single particle, just select the particle object in the Select Window and press the Space bar on your keyboard to go in edit mode. The 3D particles have 3 points that can be edited and one central point that can be used to move the particle around:

A single 3D particle in edit mode

Modifying the shape of a particle is simple: just drag the red dots on each axis until the particle reaches desired shape. To move a particle, just click or drag the red dot in the center of the particle. As usual, transformation handles allow you to move the particle to a new location in your view window. If you wish to move several individual particles, hold the Shift key and click at the center dot of each particle you wish to move. You can also use the Drag Select method to multi select particles. To modify all selected particles simultaneously, use the Drag Select method to multi select particles and then apply the Noise tool, which is located in the Transformation toolbar .

Creating the Leaf material

To make the particles look like leafs of a plant, we need to texture them. This requires a material, which we will create from scratch.

In the Select Window, click the Materials tab and create a new VSL material.

Create a new VSL Material in the Materials tab of the Select Window

It will be added at the top of the material list. You will see a black square representing the new material and it has a name like Material64. Double click on the new material to open the Property Window. Change the name, call it Leaf1. Check the Preview box. We need a leaf texture and an alpha map of the same leaf. So why not use these two images?

The color map (D_longleaf.gif) and the alpha map (A_longleaf.gif) of our leaves (Thanks Bernie den Hertog!)

Just save these two images to your favourite directory and use them in this tutorial.

Use the texture wizard and select the coloured leaf texture (D_Longleaf.gif). Leave the Tile X,Y and Grade X,Y boxes empty. Check the Advanced checkbox to get access to the VSL statements. Click the Color=Texture(Map coords) instruction. At the lower part of the Property Window go to the Texture tab and tick the Edge X and Edge Y boxes. This stops edge feathering from appearing.

Select a Constant object and drag that into the Surface properties shader. In the lower section of the Property Window there are three tabs, related to the Constant object. We start with the third (most right hand) tab. The third tab is called the In/Out tab. Make sure that 'Output' is set to 'Surface : Fade'.

The second tab is called General. The Operation should be set to '=' (the default value) and do not check the other boxes. Finally, go to the first tab (Constant) and set the Constant value slider to 1. Notice that the preview window now turns completely black!

The Constant object added, output set to Fade and Constant value set to 1.

Select the Color=Texture(Map coords) instruction, press the right mouse button and select 'Duplicate' from the pop-up menu. The duplicate instruction will be placed at the bottom of the hierarchy.

The Color=Texture(MapCoords) instruction will be duplicated

Select the duplicate instruction. In the lower section of the Property Window there are now five tabs. Go to the Texture tab and select the alpha map image (A_longleaf.gif). Next, click the General tab. Set Operation to ' - ' (the minus sign) .Finally, go to the In/Out tab. Click on 'Output' and set the Output to 'Surface : Fade', simply by selecting it from the list on the right side of the window. Note that the preview window is immediately updated.

Finally, drop a VSL curve object into the hierarchy, which gives us color control over the texture. At the In/Out tab of the curve object, set both 'Input 0' and 'Output' to 'Surface : Color'. The shader should now look like this:

The material is completed.

And then...

Map the Leaf1 texture to the 3D particles using a default mapping. Add a simple infinite rectangle to have a background and add a light source. Press render, and you should get something like this...

The first render: leaves-textured particles!

Now this scene is more interesting when not all leaves have the same colour. This is where the VSL curve object becomes handy. Perform the following steps:

1 Create just a few new 3D particles using similar settings as before and now also add some random size, like 0.3.

2. In the Material tab of the Select Window duplicate the Leaf1 material, call it Leaf2

3. Modify the color of the texture in Leaf2, using the VSL curve. This is done as follows. Make sure the material Preview box is checked. In the VSL Property Window, select the Color=Curve(Color) instruction. In the lower section of the window a graph appears, showing a red line. Click in the middle of the red line. This creates a knot point. Drag the knot point slightly diagonally upwards. Notice the color change in the preview box. When happy with the new color, close the Property Window.

4. Select the new particles in the Select Window and map Leaf2 on these particles using the default mapping.

5. Render again and it already looks more interesting!

Another example

In this part of the tutorial we put our knowledge to use and show some more of the sheer power of 3D particles!

First create an analytic cube, which will act as a brick wall. Then create a brick texture and map that to the cube (wall) using a parallel projection. Don't forget to enable the Roll option (Properties Spec tab) for the parallel mapping object. You get something like this:

Nice brick wall eh?

Then it's time to grow some plants on that wall. Again we will use our 3D particles with the same Leaf1 material applied to it. Only this time we will use a different projection when creating the particles. This allows us to let the plants follow the structure of the wall. Activate the particle tool again, select 3D particles and the brush pen, just like before, only this time with the following settings:

Settings for the 3D particles. Notice the Surface projection and the size of the particles.

Make sure the cube (wall) is selected in the Select Window. Now spray just a few particles at a time right on the top left corner of the wall and make your way down. Notice that there will be no particles added to the scene when you do not spray on the wall. This is because we set the projection method to 'Surface' and we selected the wall as target.

Then open the properties of the 3D particle object, set the Ray Tracing and Ray Trace Rectangle options at the Spec tab. Apply a default mapping of the Leaf1 material. Then repeat the particle creation process with the same settings and then apply the Leaf2 material and render. I got something like this:

Wall with some leaves growing over it.

When using many textured particles, you may find yourself waiting for your render to finish. Setting the 'No Shadows' option in the Property Window of the 3D particle object could be a real time saver!

No Shadows option set, to increase render speed!