I love Carrara’s surface replicators. If you hadn’t noticed yet I use them extensively in all my scenes to place vegetation over the landscape. The replicators are a memory efficient way to add a huge number of copies (or instances) of an object to your scene. Surface replicators will place those instances across the surface of another (or source) object whereas regular replicators will place the instances into rows or grids.
- Step 1. Setting Up
- Step 2. Configure the Replicator
- Step 3. Using a Distribution Shader
- Step 4. Finishing Up
In this tutorial I’ll demonstrate how to scatter autumn leaves below a tree using Carrara’s surface replicator. We will work towards creating the following image.
Step 1. Setting Up
The scene contains a solitary tree on an infinite plane and a single leaf that shall be the replicated object. Carrara’s surface replicator will create instances of this leaf object over the surface of a source object. We can not use the infinite plane as the source object so let’s add a standard plane to the scene. Select “Insert -> Plane” from the menu.
Rename this object to “Leaf Plane”.
We want the Leaf Plane to sit just above the infinite plane so set the “Z” value of the “Leaf Plane” hot point to “0.001” and set the overall scale to “135”.
Now let’s add the surface replicator object. Select “Insert -> Surface Replicator” from the menu.
Rename the replicator to “Leaf Replicator”.
Step 2. Configure the Replicator
The display method controls how the replicated instances are displayed in the assemble room. It has no impact on the final render but setting it to “Points” has the benefit of being the least resource hungry display method so will slow down the assemble room 3D view the least.
Populate the replicator by dragging the “Leaf” object onto “Leaf Replicator” in the instances tab.
You should now see about 100 points scattered randomly across “Leaf Plane”.
100 leaves under the tree is really too small a number so let’s increase the instance count. Double-click on “Leaf Replicator” to access its properties. Drag the “Number of Objects” slider to about somewhere near 10,000 – a bug Carrara 7.1 stops you from directly typing in a number larger than 100 so you’ll have to use the slider here if using Carrara 7.1.
Carrara tells us that “Only 482 objects could be placed on the surface” even though we specified 9938. To remedy this the minimum distance between objects needs to be adjusted. To realistically depict fallen leaves it is okay to have the leaves almost piled up upon each other, therefore there is no requirement to set a minimum distance so set this parameter to “0”.
Other parameters to adjust are scale and rotation. Set the “Z” roation to “360”. This will randomly rotate each instance on the Z axis to any angle between 0 and 360 degrees. Set the scale to” -33″. This will result in each instance being somewhere between its original size or 33% smaller.
It’s important to remember that the minimum distance between objects actually refers only to the hot points of the objects. Therefore, should you not want any objects’ geometry to overlap you need to set the minimum distance to something greater than the actual size of the object.
Lets go back to the assemble room and see what we’ve got.
The replicator has evenly distributed the instances over the entire plane, what we really want is to have the leaves more densely spaced around the tree trunk and becoming less dense towards the outer perimeter of the tree’s crown. We also don’t want the square shape of the “Leaf Plane” to be evident. Fortunately Carrara’s surface replicator can use a shader to drive the distribution of instances.
Step 3. Using a Distribution Shader
This image represents the density of the leaf instances we require. White areas of the image represent maximum density while gray areas are less dense and black represents zero density. This image was simply created in Photoshop using a white airbrush on a black background. Now let’s apply this image to the replicator’s distribution map.
Double-click on “Leaf Replicator” in the instances tab to return to the replicator’s edit window. Check the “Use Shader” checkbox, then click on “Edit Shader” button to edit the distribution shader in the shader room.
Now in the shader room, set the “Top Shader” to “Projection Mapping -> Flat Mapping”
Set the projection direction to “Top” by selecting the icon circled in the image below.
Now set the shader to “Texture Map” and load in “leaf_distribution.jpg”. You shader should look like this.
You might need to return to the replicator’s edit page and press the “Distribute” button to apply the shader to the distribution of the leaves.
Return to the assemble room to view the changes.
The instances are clustered in a roughly circular area around the tree but we’re not getting quite as much density fall-off as was wanted. While a distribution shader can contain any of Carrara’s shader effects the replicator is not very sensitive to using grays as lower density areas and will fill them up almost as much as pure white areas. Fortunately there is a simple solution that can be applied using almost any image editing application.
Using your image editor down sample “leaf_distribution.jpg” from an 8bit gray scale image to a 2bit black and white image. Make sure to use a diffusion dither. The image below is the result we’re after.
Save this image and re-load it in the distribution shader, redistribute the instances and you should have the following view in the assemble room.
Step 4. Finishing up
The leaf instances will still be visible but the square plane that they are distributed across will no longer render.
Go to the render room, press render and behold the fruits of your labors.
That concludes this tutorial. I have demonstrated how to add a surface replicator to a scene, add objects to the replicator and configure their distribution. And lastly, how to further control the distribution of the objects using a shader. If you feel that anything is unclear or missing please don’t hesitate to leave a comment below and I’ll see what I can do to fix it.