How to use Chaos Scatter with Corona for Cinema 4D - Advanced Features
This is "Advanced Features of Chaos Scatter". It is a part of a larger collection of articles:
- Getting Started
- Advanced Features (you are here)
- Using Chaos Scatter with Other Features of Corona
- Performance and Troubleshooting
1D, 2D, and 3D Scattering
Under the "Config" tab you can choose between 3 modes:
- 1D - On splines
- 2D - On surfaces
- 3D - In bounding box
1D scattering is intended for distributing objects along splines. An example of this would be planting trees in straight or curvy lines, or placing lamps along a street.
Note: open or closed splines can be used for this, and in this mode, the instances will always be distributed along the selected splines:
2D scattering is the most common mode, where the distribute-on object's surface is considered, no matter if it's horizontal, vertical, or if it's a complex 3D object.
Note: a closed spline can be used in this mode too, and in such case, the instances will be distributed on the area enclosed by the spline's border.
3D scattering means that the instances will be scattered inside the volume of the distribute-on object's bounding box:
Note: in the case that a spherical object is selected as the distribute-on object, the instances will be scattered inside a cube (since the bounding box of the sphere is considered, and it is cube-shaped). This type of scattering is useful when a box-shaped volume needs to be populated with objects, for example:
- dust particles in the air inside a room
- fish in an aquarium
- books on a shelf
- wood next to a fireplace.
Camera clipping is a feature that limits the scattering to the camera view. Instances that are not visible will be clipped away. It is an optimization, it may improve scene parsing speed and lower memory usage, however, it can cause missing reflections or shadows (because some objects farther away from the camera will disappear). To compensate for this you can use the "Extend view" parameter. It supports various camera types (native, Corona, V-Ray).
Note: As explained above, camera clipping is purely an optimization feature! It can speed up scene parsing and lower memory usage by hiding some of the rendered objects which would be otherwise visible and therefore would need to be parsed and allocated in the memory. It must NEVER be used to limit the scattered instances to a specific area. Other features should be used for this, such as spline include/exclude and slope limitation!
Camera Clipping Parameters:
Enable: Checking this will enable the Camera Clipping feature.
- Active render camera: This mode clips the instances based on the camera view used for rendering. In this case, the clipping is not visible in the viewport unless changing clipping parameters (or running IR). This is because otherwise, the clipping would be too intrusive during regular scene work.
- Specific Scene Camera node: This mode uses a specified camera for the clipping. In this case, the clipping is always visible.
- Extended view: Specifies a uniform extension to the camera view in all directions (as distance), adding an extra zone beyond the camera view (behind the camera too) where the instances will not be clipped. This is useful for ensuring correct shadows or reflections from instances that would otherwise be clipped. The distance is in scene units.
Near and Far overrides:
- Near threshold: Specifies near threshold distance from the camera. Instances closer than that will be clipped away. The distance is in scene units.
- Far threshold: Specifies far threshold distance from the camera. Instances further than that will be clipped away. The distance is in scene units.
Using textures to control scatter transformations
Another new feature of Chaos Scatter is the ability to drive the scattered objects' translation, rotation, and scale using textures or colors (or in fact, anything plugged into the respective "Texture" slot).
We will be using the below simple scene showing a forest scattered on a simple plane.
In this image, no translation, rotation, or scale adjustments are used, so all trees are positioned exactly at the plane surface, they are not leaning in any direction, and their scale is uniform.
We will be using a texture with pure red, pure green, and pure blue colors to drive the three transformations:
We need to set some translation from - to range. In this case, we will use a range from 0 to -120, 0 to 70, and 0 to 120 meters respectively. We also need to plug the RGB texture into the "Texture" slot under the Translation section:
Here is the result of our adjustments:
As we can see, the trees which originally grew on the red area were moved in one direction (X-axis), the ones on the green area were moved in another direction (Y-axis) and the trees from the blue area were moved up (Z-axis).
We can adjust the rotation in a similar way. Let's discard the previous translation changes, remove the translation texture, plug the same RGB gradient into the "Texture" slot under the Rotation section, and set the rotation XYZ ranges to 0 - 75, 0 - 60, and 0 - 80 degrees respectively:
This is the result:
The trees from the red area are now leaning 75 degrees along the X-axis, the trees from the green area - 60 degrees along the Y-axis, and the trees from the blue area 80 degrees along the Z-axis.
Lastly, we can use the RGB gradient to control the trees' scaling. Let's discard the previous rotation changes, remove the rotation texture, plug the same RGB texture into the "Texture" slot under the Scale section, and set the scale XYZ ranges to 100 - 250, 100 - 200, and 100 -200 percent respectively:
As a result, the trees from the red area are now 250% stretched in the X-axis, the trees from the green area - 200% stretched in the Y-axis, and the trees from the blue area - 200% stretched in the Z-axis.
Note: when using transformation textures, the red, green, and blue values correspond to transformations in different axes (X, Y, Z). This means that colorful textures will allow the instances to be transformed in unproportional manner (it is possible that they will be moved, rotated, or stretched in one direction more than in another direction). To make the transformations proportional, use grayscale transformation textures:
In the above example, a black-to-white gradient is used to drive the size of the trees. This way the trees will be scaled proportionally in all directions, because the R, G, and B color values are the same at any given point (for example R 50, G 50, B 50, and so on).
4. Transformation modes
So far, we only used the default "Map fixed" transformation mode. In this mode, the black and white areas of the transformation map directly correspond to the values specified in the "From" and "To" fields. This way, black areas of the map will represent the lowest allowed transformation, and white areas will represent the highest allowed transformation.
For example: black areas in the scale texture will represent the smallest allowed instances, and white areas in the scale texture will represent the biggest allowed instances.
If we switch to the "Random amount" mode, the black and white areas of the transformation map will be interpreted differently. "From" and "To" values will specify the maximum allowed randomization, black areas of the texture will represent the areas where there is no randomization whatsoever, and white areas in the scale texture will represent the areas where maximum randomization is allowed.
"Random amount" Scaling Mode - Checker texture example:
Here is an example of the same mode ("Random amount") based on a black and white Checker texture. You can clearly see that no randomization occurs on the black squares, and that full randomization occurs on the white squares:
"Map fixed" Scaling Mode - Checker texture example:
For comparison, here is the same setup as in point 10, only with "Map fixed" mode enabled, where you can see how black and white areas simply represent different scaling:
Tip: when creating all kinds of scenes with Chaos Scatter, adjusting its settings, and creating textures, Corona's Interactive Rendering is a great ally. It lets you preview your changes and decide which settings to use close to real-time.
Preserve scale and rotation
You may sometimes have a model in your scene which is not rotated correctly. This is especially common in the case of models imported from a different 3D application:
In this case, a tree model is laying on its side instead of growing upwards. This is incorrect, unless we need to render a fallen tree.
The first idea to fix this would be to use the rotation tool and rotate the object by 90 degrees:
However, if we do it, and use this rotated tree model in Chaos Scatter, we will end up with the following result:
This is because, by default, Chaos Scatter considers the local coordinate system of the model object. In this case, the tree model was originally laying on its side with its local Z axis pointing upwards. We rotated the tree, however, this did not affect the local coordinate system - it stayed the same.
When this is checked, the current rotation of the scattered tree models will be considered, so they will behave as we originally intended:
After enabling the "Preserve model rotation" option, the scattered trees are growing straight, just like the model that we see in the viewport.
The "Preserve model scale" option under Transformations > Scale works in a similar manner. If the model selected for scattering was rescaled in Cinema 4D:
- When "Preserve model scale" is disabled, the scattered objects' scale will be the same as the original model's scale when it was imported into the scene.
- When "Preserve model scale" is enabled, the scattered objects will look the same as the model after it was rescaled.
Note #1: In situations where the scattered models appear to be rotated or scaled in an unexpected way, it is a good practice to tick and untick the "Preserve model rotation" and "Preserve model scale" checkboxes and observe the behavior of the results.
Note #2: Remember that the pivot of the original object that is scattered decides the point of rotation and scaling of the instances. Moving and rotating the pivot of the original object will change the way the scattered instances are rotated and placed on the distribute-on object.
Using the Preserve Scale and Rotation options with animated instances
If the geometry of your original model is animated, for example, the vertices or faces of the mesh are changing their positions - everything will work as expected and the scattered instances will be animated too.
If the rotation and/or scale of your original model is animated (keyframes are created for the model's rotation or scale transformations), then by default this will be ignored and the scattered instances will appear static, without any kind of movement. To fix this, you need to enable the "Preserve scale" and/or "Preserve rotation" checkboxes.