Note: you are viewing an article in the Chaos Help Center. If you are interested in the technical documentation of Chaos Scatter, please see: Chaos Scatter at the Chaos Documentation Portal.
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
- Scattering instances on existing Scatter objects
- Camera Clipping
- Using textures to control scatter transformations
- Preserve scale and rotation
- Edge Trimming shader
- Surface Color shader
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.
Scattering instances on existing Scatter objects
It is also possible to scatter objects onto another Chaos Scatter objects within your scene. In the example below, the needles are being distributed onto the cactuses. The ''Cactus'' scatter object is used in the ''Distribute On'' field of the second ''Needle'' scatter object.
(The ''Cactus'' scatter object is placed inside the ''Distribute On'' field of the ''Needle'' scatter object)
Additional examples of scattering instances on existing scatter objects:
Water drops are scattered on cans, which are scattered too.
Sugar crystals are scattered on jellies, which are scattered too.
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 that 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 for Corona 9 for Cinema 4D users:
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!
If you are experiencing a lag in the viewport due to camera clipping being enabled, you can disable ''Immediate updates'' from within the Viewport Display settings, which will then only update scatter objects in your scene when releasing the mouse button.
This has been improved starting from Corona 10 for Cinema 4D.
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.
Extend 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 clipping:
Near clipping: Specifies near threshold distance from the camera. Instances closer than that will be clipped away. The distance is in scene units.
- Far clipping: Specifies far threshold distance from the camera. Instances further than that will be clipped away. The distance is in scene units.
Known Limitations of Camera Clipping:
Visible flickering in animations:
Note: This issue only occurs in versions of Corona up to 9. It is fixed in Corona 10.
This issue occurs when using Camera Clipping on models that have at least one Corona Multi Shader in their material setup. The reason behind this is that when using Camera Clipping, the number of scattered models can vary between animation frames, and this affects the way different colors/textures are distributed through the Multi Shader. Note that the models are not actually changing their positions, but their colors are affected instead.
Solution: Either disable Camera Clipping or remove any Corona Multi Shaders from the materials of the scattered models. We are planning to fix this issue in the upcoming versions of Scatter.
Using textures to control scatter transformations
Another 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 simple scene below, 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 that originally grew in the red area were moved in one direction (X-axis), the ones in 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 instead:
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 "Fixed" texture mode. In this mode, the black and white areas of the transformation texture 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" texture mode, the black and white areas of the transformation texture 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.
Tip: The Texture mode parameter is only available if a shader is being loaded for any transformation (translation, rotation, scale) texture slot.
"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:
"Fixed" Scaling Mode - Checker texture example:
For comparison, here is the same setup as above, only with "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 patch of grass model is laying on its side instead of growing upwards. This is incorrect, unless we need to render a fallen patch of grass.
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 Y axis pointing upwards. We rotated the model; however, this did not affect the local coordinate system - it stayed the same.
One solution to this issue would be using the built-in "Reset Scale" or the "Axis Center" tools in Cinema 4D. But an easier, faster, and non-destructive solution would be using the Chaos Scatter "Preserve model rotation" option under Transformations > Rotation:
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 the "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 the "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. If this doesn't seem to help, try using the "Reset Scale" and "Axis Center" tools in Cinema 4D.
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.
Starting with the Chaos Scatter included in Corona 9; you can trim scattered instances consisting of multiple mesh elements so that they stay within the boundaries of the distribute-on objects or the include/exclude splines. In addition to making the scattering look more refined and natural, this feature also provides a performance increase - thanks to removing some of the instances, you save RAM and make the parsing time shorter.
To learn more, see also: Scatter Edge Trimming shader
Using Edge Trimming
Without using Edge Trimming
How to use it?
Edge Trimming shader is provided through the new Edge Trimming shader, which you can find in the material editor under the New shader > plugins > ChaosScatter category.
You need to plug the Edge Trimming shader into the Opacity channel of the material of the model that you are scattering (in case of multiple models with different materials - all opacity slots of all materials used):
Note: We are planning to automate the process of connecting Edge Trimming shaders where they are needed, which is currently especially laborious when using many materials. This will be available in upcoming versions of Scatter.
If your model is already using an opacity texture or shader, you can pass this existing texture map through the Edge Trimming shader using its "Default shader" slot:
Once the Edge Trimming shader is included in the material setup, we can see its effect in the rendered image (this is not visible in the viewport):
The image shows how the Chaos Scatter looks like in the viewport (the Edge Trimming shader's result is not visible in the viewport).
The image shows the result of a scattered object without using the Edge Trimming shader for their materials.
The image shows the result of using the Edge Trimming shader for the scattered object's materials.
How does it work?
If a pivot of any integral part of the instance (any sub-mesh element of the instanced model) falls outside of the area specified by the scatter, such part is not rendered. This is a simplification, but you can imagine the pivot as a point on the distribute-on object from which an element is growing.
When the Edge Trimming shader is not used:
Without the Edge Trimming shader, the whole clumps will be scattered, causing some of the flowers (sub-object elements) to grow outside of the distribute-on object.
When the Edge Trimming shader is used:
Each model is scattered the same way as when the Edge Trimming shader is not used (its pivot is placed within the boundaries of the distribute-on object), but when this shader is in use, the sub-mesh elements (individual flowers) are only growing inside this boundary of the distribute-on surface.
The area to consider for trimming can be specified using:
- The distribute-on object itself.
- Include splines.
- Exclude splines.
There is no need to enable any special options in the Chaos Scatter object itself.
The typical use cases of Edge Trimming include:
- Grass lawns - In the case of using large grass clumps, no individual grass blades will be growing outside of the defined area.
- Carpets - In case of using large clumps of strands, no individual strands will be placed outside of the carpet area.
- Pebbles, rocks, bark chippings, or any other objects you need to distribute within a specific boundary and ensure no instances stick outside of that boundary (determined based on the mesh element pivot precision).
Known Limitations of Edge Trimming:
- Currently (Corona 10), Edge Trimming does not work correctly when scattering proxies while their viewport display method is set to Solid bounding box, wire bounding box, or point cloud. The solution is to change the viewport display method of all scattered proxies to "Full mesh".
Proxies scattered with point cloud viewport display method: Proxies scattered with full mesh viewport display method:
- Generally, the less mesh elements a model object has, the faster the Edge Trimming feature works. It may get slower when using extreme numbers of mesh elements in a single model (think 10,000 elements or more), but this should not be an issue in usual scattering scenarios (scattering grass, trees, rocks, etc.).
Note: Sometimes, it may also be worth to experiment and finding out whether to use scattering, Corona Pattern, or displacement.
See also: Displacement, Scatter, and Pattern usage differences.
- If the area where trimming is expected to occur (e.g., a narrow path defined by an exclude spline) is significantly smaller than a single to-be-trimmed model itself (e.g., a large grass patch), then the trimming may actually not happen because of optimizations used by the trimming feature. The solution is to make the model smaller (e.g., manually scale the grass patch or use scaling options in the Chaos Scatter).
- Currently, you need to manually (or using a script) connect the Edge Trimming shader to the opacity slots of each of the materials you are using for your scattered instances. This can be challenging, especially in the case of scattering models with many different materials. We are planning to improve this workflow.
Surface Color Shader
Sometimes you may want to color the scattered instances based on the texture of the underlying distribute-on object. A typical example of this is scattering strands on a carpet so that each strand gets the color of the underlying carpet surface. This is perfectly possible when using the Chaos Scatter, thanks to the Surface Color shader.
You can find it in the material editor under New shader > plugins > ChaosScatter category:
This shader will automatically take the diffuse color of the Chaos Scatter distribute-on object and will pass it to the instances that are scattered on it. The shader itself takes only the distribute-on diffuse color, but it can be applied to any material property of the scattered instance (e.g., roughness, opacity, self-illumination, or any other).
A basic example:
The objects we will be using are a plane with a colorful pattern (as the distribute-on object) and a box (as the scattered instance):
A Surface Color shader is created in the material editor and plugged into the box object's base diffuse color slot:
The scattering is enabled, and as a result, each scattered box is colored based on the underlying texture:
A carpet can be created using a similar approach. The base of the carpet is using a material with a pattern in its diffuse color (no scattering is used in the below image):
We can then create strand geometry and scatter it on top of the carpet base. Then apply a Surface Color shader to it:
In a close-up render, we can see that each strand takes the color of the underlying carpet base object:
To learn more about the Chaos Scatter, see also: Chaos Scatter at the Chaos Documentation Portal