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:
- FAQ
- Getting Started
- Advanced Features (you are here)
- Using Chaos Scatter with Other Features of Corona
- Performance and Troubleshooting
Page Contents:
- Limiting Slope and Altitude
- Look At
- Scattering Groups and Hierarchies
- 1D, 2D, and 3D Scattering
- Surface Scattering
- Editing Instances
- Edge Trimming
- Camera Clipping
- Surface Color Map
- Using textures to control scatter transformations
- Preserve scale and rotation
- Chaos Scatter and MAXScript
Advanced Features
Limiting Slope and Altitude
You can limit the scattering of instances to the areas within specific slope and altitude ranges using the built-in limitation options in the Surface Scattering rollout. This is useful, for example, when:
- Scattering trees on top of uneven, mountainous surfaces - in such cases, you can use the slope limitation to make sure trees don't grow on steep areas and vertical walls.
With such slope limitation settings, no instances will ever appear on surfaces steeper than 45 degrees.
- Scattering different types of vegetation depending on how high they are above sea level. You can use the altitude limitation to grow broad-leaved trees in the lowlands, needle-leaved trees at higher altitudes, and some really good-looking shrubbery in the highest parts of the mountains.
With these settings, the instances can only appear in the range from 20 to 300 meters counting from the world zero-position.
A Chaos Scatter scene with different types of vegetation growing at different altitudes. Additionally, slope limitation was used to make sure no plants are growing where it is too steep.
A masking element showing different models scattered at different altitudes.
Look At
You can make all your scattered instances point towards a single object in your scene using the Look at option under Transformations > Rotation. This can be useful for:
- Focusing a crowd's attention on a specific object:
- Making sure all objects are facing exactly the same point:
Scattering Groups and Hierarchies
You can add a group or a hierarchy of objects to the list of instanced model objects with a single click. A group or a hierarchy is treated as a single model, so this way you can create an arrangement of trees and other plants and scatter that as a single "module":
A group of objects. You don't need to attach them into a single mesh. All you need to do is arrange them in the desired configuration and group them.
Add the group to the "Instanced model objects" list.
The rendered result. The groups are scattered on top of a plane and randomized thanks to Scatter translation, rotation, and scale randomization options.
1D, 2D, and 3D Scattering
Under the "Scattering" rollout you can choose between 3 modes:
- 1D - On splines
- 2D - On surfaces
- 3D - In bounding box
1D scattering is intended for distributing models 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 case of a sphere 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 models, for example:
- dust particles in the air inside a room
- fish in an aquarium
- books on a shelf
- wood next to a fireplace.
Surface Scattering
Starting from Corona 12 Update 1, when using 2D surface scattering, you can choose between two distribution modes:
Random Distribution:
This is the default mode where objects are scattered randomly. You can:
- Choose which UV channel to use
- Pick from different pattern presets for the distribution
- Add your own custom map to control where objects appear
- Set how many objects you want (either as a total count or by density)
Position Distribution:
This mode lets you place objects in organized patterns. You can:
- Choose between Grid, Running grid, or Hex grid patterns
- Control exactly how far apart objects are placed (Spacing)
- Add some randomness to the pattern (Jitter)
- Move the entire pattern around (Offset)
- Lock the vertical spacing to match the horizontal
- Use planar mapping instead of the object's UV mapping
You can learn more about the new surface scattering system in the technical documentation
Editing Instances
We can edit (move, scale, rotate, and even delete) the individual instances created by the Chaos Scatter using this option.
Here is how to edit instances:
- Select the Chaos Scatter
- Click on the “Edit Instances” button
-
Select and modify any instances as needed
Click the “Edit Instances” button again to exit Edit Instances mode
Note #1: After finishing editing the instances, they will be reset back to their original state if we:
- move, rotate, or scale the original model(s)
- change the random seed value in the Scatter
- switch from count- to density-based scattering
- change the density map
- perform some other changes in the Scatter itself
This means that editing instances should be done only after finalizing the state of the original models and the whole Scatter.
Note #2: If you select 100 or more instances at a time, you will see the following warning:
This is to explain that if you need to adjust many instances at once and/or a large area of the Scatter, it usually makes more sense to globally change the settings in the Scatter itself than selecting many instances and editing them. Of course, this is not always the case, so if you wish to select and edit more than 100 instances, you are welcome to do so.
Note #3: If you manually edit some instances, they will always be ignored by:
- the avoid collisions option
- include/exclude splines
- slope limitation
- camera clipping
Starting with Corona 12, you now have the option to brush paint or erase instances. Click here to learn more.
Edge Trimming
How to use it?
Note: Starting with Corona 12 Edge Trimming option is available as a checkbox:
You need to plug your Edge Trimming map into the opacity slot 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 maps where they are needed, which is currently especially laborious when using many materials. This will be available in the upcoming versions of Scatter. You can however use the following script made by our forum user Frood:
Macroscript to quickly add/remove Scatter Edge Trimming map
Please note that the script is unofficial, so in case of any issues or questions, you should report those in the forum thread linked above.
Thank you Frood!
If your model is already using an opacity texture, you can pass this existing texture through the Edge Trimming map using its "Default map" slot:
Once the Edge Trimming map is included in the material setup, we can see its effect in the rendered image (this is not visible in the viewport):
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.
In the current example, we are scattering a clump of flowers. It is a single mesh consisting of multiple sub-object elements:
Edge Trimming off:
Without the Edge Trimming map, the whole clumps will be scattered causing some of the flowers (sub-object elements) to grow outside of the distribute-on object. In the below example, the bounding box of the model is represented with a red box. The pivot of the model is represented with a blue sphere. We can see that each model is scattered as expected (its pivot is placed within the boundaries of the distribute-on object), however the sub-mesh elements (individual flowers) are growing outside of the boundaries, because they are a part of the model.
Edge Trimming on:
We can see that each model is scattered the same way as with edge trimming off (its pivot is placed within the boundaries of the distribute-on object), but in this case the sub-mesh elements (individual flowers) are only growing inside this boundary of the distribute-on surface too.
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 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 which you need to distribute within some specific boundary and make sure no instances stick outside of that boundary (determined based on the mesh element pivot precision).
-
This issue was only present in Corona 10 and has been fixed in newer versions:
In Corona 10, Edge Trimming did not work correctly when scattering proxies while their viewport display method was set to solid bounding box, wire bounding box, or point cloud. In Corona 10, the solution is to change the viewport display method of all scattered proxies to "Full mesh". The recommended solution is updating to Corona 11 or newer.
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 be also worth to experiment and find out whether to use scattering, Corona Pattern, or displacement. See: 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 Scatter).
- Currently, you need to manually (or using a script) connect the Edge Trimming map to the opacity slots of each of the material you are using for your scattered instances. This can be challenging, especially in case of scattering models with many different materials. We are planning to improve this workflow.
Tip: if Edge Trimming does not seem to be working correctly (e.g. some elements of the model are expected to be trimmed, but they are still visible), as the first step try resetting the model's XForm in 3ds Max by selecting the model and going to Utilities in the Command Panel and then clicking "Reset XForm":
Camera Clipping
Camera clipping limits the scattering to the camera view. Instances that are not visible will be clipped away. It is an optimization which may improve scene parsing speed and lower memory usage, however it can cause missing reflections or shadows (because some objects outside of the camera will disappear). To compensate for this you can use the "Extend view" option.
It supports various camera types (native, Corona, V-Ray, perspective, orthogonal, fisheye) and also viewport preview.
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!
Clipping Modes:
- Active render camera: 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.
Note: with a reasonable "Extend View" value, this mode is recommended as a default for scenes where camera clipping is possible. It works automatically, so it automatically saves scene parsing time and RAM usage. -
Specific scene camera node: 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 in scene units), 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.
Near and Far overrides:
-
Near threshold: Specifies near threshold distance from the camera in scene units. Instances closer than that will be clipped away.
- Far threshold: Specifies far threshold distance from the camera in scene units. Instances further than that will be clipped away.
Note: Camera clipping also works with XRefs. For example, if there is a child scene using Scatter with camera clipping enabled and this child scene is loaded into a parent scene as an XRef, the camera clipping will be still working.
Surface Color Map
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. With Chaos Scatter this is perfectly possible thanks to the Surface Color Map.
You can find it in the material editor under Maps > Chaos Scatter > ChaosScatterSurfaceColor
This map will automatically take the diffuse color of the Chaos Scatter distribute-on object and will pass it to the instances which are scattered on it. The map 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 map 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 map to it:
In a close-up render, we can see that each strand takes the color of the underlying carpet base object:
Using textures to control scatter transformations
Another new feature of Chaos Scatter is the ability to drive the scattered instances' translation, rotation, and scale using textures or colors (or in fact, anything plugged into the respective "map" slot).
We will be using the below simple scene showing a forest scattered on a flat 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:
1. Translation
We need to set some translation from - to range. In this case, we will use a range from 0 to 50 meters. We also need to plug the RGB texture into the "map" slot under the Translation section:
Here is the result of our adjustments:
To better understand what is going on, we can apply the RGB texture to the plane's diffuse color:
As we can see, the trees which originally grew on the red area were moved in the direction of the X axis, the ones on the green area were moved in the direction of the Y axis, and the trees from the blue area were moved in the direction of the Z axis.
2. Rotation
We can adjust the rotation in a similar way. Let's discard the previous translation changes, remove the translation map, plug the same RGB map into the "map" slot under the Rotation section, and set the rotation XYZ ranges to 0 - 45 degrees:
This is the result:
The trees from the red area are now leaning 45 degrees along the X axis, the trees from the green area - 45 degrees along the Y axis, and the trees from the blue area - 45 degrees along the Z axis.
3. Scale
Lastly, we can use the RGB map to control the trees' scaling. Let's discard the previous rotation changes, remove the rotation map, plug the same RGB map into the "map" slot under the Scale section, and set the scale XYZ ranges to 100 - 300 percent:
As a result, the trees from the red area are now 300% stretched in the X axis, the trees from the green area - 300% stretched in the Y axis, and the trees from the blue area - 300% stretched in the Z axis.
Note: when using transformation maps, 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 maps:
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 R50, G50, B50, and so on).
4. Transformation modes
So far, we only used the default "Map fixed" transformation mode. In this mode the different color values of pixels in the transformation map directly correspond to the values specified in "From" and "To" fields (e.g. pure red color will affect the X axis of a transformation, pure white will affect all axes, pure black will not affect the transformations at all).
If we switch to the "Random amount" mode, the colors of the transformation map will be interpreted differently. "From" and "To" values will specify the maximum allowed randomization, black areas of the map will represent the areas where there is no randomization whatsoever, white areas in the map will represent the areas where maximum randomization is allowed, and any other colors will be interpreted as the maximum allowed randomization for each axis (e.g. pure red color will affect the X axis of a transformation, allowing the randomization only on that axis).
"Random amount" Scaling Mode - Checker map example:
Here is an example of using the "Random amount" mode with a black and white Checker map. 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 map example:
For comparison, here is the same setup as above, only with "Map fixed" mode enabled, where you can see how black and white areas simply represent different scaling:
5. Using textures to control scatter transformations - a practical example
We know how the RGB transformation adjustments work, but how can we actually use this in some more interesting scenarios?
Let's imagine a forest, which was hit by an asteroid, or a huge explosion happened in the middle of it. In such case, we would like the trees to lay on the ground close to the center of the explosion, and still grow straight farther away from it. We would also like the tree tops to be pointing outwards from the explosion.
We can achieve all of that using procedural maps and Chaos Scatter rotation controls.
First, we need to scatter a regular forest, just like we did in the Getting Started guide.
Once we have our forest, we can start creating various maps:
The rotation map:
- To achieve the effect of trees laying horizontally close to the explosion and growing straight farther away, we can use a Gradient Ramp map with its type set to Radial and its colors set to yellow (R255, G255, B0) and black only. We are using pure yellow color, because we only want to affect the X (red color) and Y (green color) rotation axes, and we do not want to affect the Z axis (blue color) at all. If we would use a white-to-black gradient, it would affect the Z axis too:
The pure yellow color (pure red + pure green) means that the trees are allowed to be rotated on the X (red color) and Y (green color) axes. The black color means no rotation at all.
- To make sure that all trees will be pointing outwards from the explosion, we can create a Gradient Ramp map with its type set to "Spiral". We need the gradient to be blue and black only, because we only want to affect the Z axis of the scattered trees:
The blue color means that the trees are allowed to be rotated on the Z axis ("spinning"). The black color means no rotation at all.
- We can then merge the yellow and the blue maps into one using the Corona Mix map and setting its Mix Operation to "Add". This way we will create a map which both allows the trees to lay horizontally as they are close to the texture's center, and rotate them depending on the direction from the texture's center:
- As the last step in the rotation map creation, we can add a black-and-white noise map to randomize the final rotation of the trees and add it on top using another Corona Mix map in "Add" mode:
The yellow map allows the trees to lay horizontally. The blue map allows Z-axis rotation. The noise map has R, G, and B values, so it affects the X, Y, and Z axes thus randomizing the final result.
We can then use this map as the Scatter rotation map. We also need to the following rotation values:
X - from 0 to 90 (the tree is either growing vertically or lying horizontally)
Y - from 0 to 90 (the tree is either growing vertically or lying horizontally)
Z - rom 0 to 360 (full rotation range is possible)
The rotation mode must be set to "Map fixed" since we are controlling the rotation of the scattered trees using our newly created map.
- We can then prevent the trees from growing in the center of the explosion by using a Corona Distance map, picking a sphere object placed where we don't want the trees to grow, and plugging it into the Chaos Scatter Surface Scattering Map:
The Corona Distance map is used to drive the scattering density. Black color means no trees. White color means full density.
The final result seen in the viewport and rendered with Corona:
The explosion was made using a Corona Volume Grid. The ground close to the explosion is displaced and colored using a Corona Decal.
Tip: when creating all kinds of scenes with Chaos Scatter, adjusting its settings, creating texture maps, 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 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 3ds Max rotation tool and rotate the tree 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.
One solution to this issue would be using the "Reset XForm" utility in 3ds Max. 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 3ds Max, this scaling will be either respected or ignored.
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 XForm" utility in 3ds Max:
Note #2: Remember that the pivot of the original object that is scattered decides about 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.
Chaos Scatter and MAXScript
You can use Chaos Scatter with MAXScript.
- For Chaos Scatter MAXScript API, see: https://wiki.corona-renderer.com/scatter_maxscript
- For general information on using Corona with MAXScript, see: https://wiki.corona-renderer.com/maxscript