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 "Chaos Scatter Performance and Troubleshooting". It is a part of a larger collection of articles:
- Getting Started
- Advanced Features
- Using Chaos Scatter with Other Features of Corona
Performance and Troubleshooting (you are here)
Performance and Troubleshooting
Monitor your RAM usage! Chaos Scatter is well-optimized and takes advantage of geometry instancing to keep RAM usage as low as possible; however, you can still run out of RAM, especially with extremely dense scatters or when scattering objects on a very large area.
Running out of RAM may cause various issues, such as extreme rendering slowdown, system instability, or crashes.
If you are dealing with this issue, you may need to optimize your scene or at least lower the number of scattered instances. You may also consider installing additional RAM, especially if you are commonly having RAM issues in various scenes.
Keep in mind that multiple levels of detail based on the distance from the camera are not really needed. Let's imagine that we are scattering a complex model of a building on a few-kilometer large plane. A single model of the building requires 100 MB of RAM. Let's take a look at a few scenarios:
Case 1 - There is no scattering at all, and the building model is in the scene:
The building model takes 100 MB of RAM. The total RAM usage is 100 MB.
Case 2 - The single building model is scattered:
The building model takes 100 MB of RAM. Each scattered instance adds just a tiny bit more to the required RAM. The total RAM usage is 100 MB + a little bit more.
Case 3 - The original building model is in the scene, and additionally, an optimized building model is in the scene, which requires only 50% of the original model's RAM usage:
The original building model takes 100 MB. The optimized building model takes 50 MB. The total RAM usage is 150 MB.
Case 4 - The original and optimized building models are in the scene. The original building model is scattered close to the camera. The optimized model is scattered farther away from the camera:
The original model takes 100 MB. The optimized model takes 50 MB. The scattered instances add a bit of RAM usage to the scene. The total RAM usage is 150 MB + a little bit more.
Conclusion: As you can see, the least RAM is used when only the original building model is scattered, and this is not only the easiest and the fastest to set up but also the most efficient and correct approach. Adding more versions of the same model with different levels of detail will only add to the overall RAM usage and will require some extra work (manually optimizing the models and/or adding the different models into the scatter and placing them in the right distance ranges from the camera).
- Case 1 - There is no scattering at all, and the building model is in the scene:
In case you see that the instanced model objects you want to distribute on the target object are placed in a "weird" way, for example, from the middle of the tree trunk or located under the target object, please make sure that the Pivot Point is at the right place.
Case 1 - Pivot Point is located in the center of the object:
The pivot point defines the point that is scattered on the target object so the trees will be growing inside the ground plane.
Case 2 - Pivot Point is on top:
In this case, the trees are visibly placed too low.
Case 3 - The correct position of Pivot Point:
If the pivot is placed at the base of the tree trunk, the objects will be scattered as expected.
If you made some modifications to your model object, like scaling it, make sure you use the Reset Scale utility, and then you can align the pivot point according to the World coordinate system using the Axis Center tool:
In case of dense scattering on a large surface (e.g. grass), always scatter a clump of smaller objects rather than a single small object (e.g. a clump of grass blades rather than a single grass blade). Scattering a single mesh consisting of multiple elements rather than a single element is always better in terms of RAM usage. Here is an example:
Case 1 - Scattering a single mesh, which is a clump of grass blades:
RAM usage: 1.5 GB
Case 2 - Scattering a single mesh, which is a single grass blade:
RAM usage: 2.4 GB
Note that the scattering is much, much sparser than in the case of scattering a clump, but the RAM usage is already higher.
Case 3 - Scattering a single mesh, which is a single grass blade, number of scattered instances increased:
RAM usage: 11.4 GB
We can try to cover a larger area with individual grass blades, but even with very high count values, this won't give us a satisfying result, and at the same time will cause an extreme increase in RAM usage:
Camera clipping 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. To learn more, see the "Camera Clipping" section in this article.
Note: This issue only occurs in versions of Corona up to 9. It is fixed in Corona 10.
Flickering may appear in animations when using Camera Clipping with Corona Multi Shader. For more information, see Known Limitations of Camera Clipping.
To learn more about the Chaos Scatter, see also: Chaos Scatter at the Chaos Documentation Portal.