How to use Scale Map in Corona Scatter


In this guide we will explore and explain various uses of the Scale Map feature of Corona Scatter. 




1. Scattering the stones

In the following example we will be using a simple scatter consisting of one stone model (with the Corona MultiMap applied to randomize colors) instanced over a flat ground plane:


 


Corona Scatter settings (click to enlarge)



2. Randomizing the scale of stones uniformly

The scale of the stones can be randomized using the controls available in Corona Scatter, even if no Scale Map is used:



Corona Scatter settings showing the scale randomization (from 10% to 200%).

No Scale Map is used.



3. Using a Noise map to control the scaling of stones

We can plug a grayscale texture into the Scale Map slot to control the scaling of the stones:



Corona Scatter settings showing a Noise map plugged into the Scale Map slot. 

This means that the Noise map will be used to control the scaling of the stones. 



4. The Scale Map

We are using a simple grayscale Noise map. Here is what it looks like when applied to the ground plane (to visualize how black and white areas are interpreted by the scatter):




5. Randomizing the scale of the stones non-uniformly

By default, the stones are scaled uniformly in all directions (proportionally), as seen in point 2. We can however disable this uniform scaling by unticking the "Uniform scale" checkbox:


"Uniform scale" checkbox unticked. 

No Scale Map is used. 


Unticking the "Uniform scale" checkbox results in having the stones scaled independently in different axes. 

This means that they will no longer be proportional (some of them will be stretched in just one or two axes). 

No Scale Map is used. 



6. Controlling which scale axes should be randomized (without the Scale Map)

When "Uniform scale" is disabled, we can still control which axes should be randomized, and which shouldn't. To do it, simply set the "From" and "To" values of the axes which you do not want to affect to 100%, and only specify the "From" and "To" values for the axis you actually want to randomize. In this example we disabled randomization for X and Y axes, and enabled it for the Z axis only. This results in all the instances having original X and Y dimensions, but the Z dimension (height) is randomized. There is no scale map used in this example:


Scale randomization is disabled for X and Y axes (by setting "From" and "To" values to 100%), and Z axis is randomized. 

No Scale Map is used. 


The result of randomizing only the Z-scale axis. 

No Scale Map is used. 



7. Controlling which scale axes should be randomized (with the Scale Map)

And here are exactly the same settings as in point 6, only with the scale map loaded. Like in the previous example, the X and Y scaling is not randomized at all, but the Z axis (height) is controlled by the noise map:



Scale randomization is disabled for X and Y axes (by setting "From" and "To" values to 100%), and Z axis is controlled by the Scale Map (Noise). 

Black areas of the noise map mean that "From" value (10%) will be used for the Z-scale, and white areas mean that "To" value (500%) will be used.



8. Controlling which scaling axes should be affected by the Scale Map

If we enable randomization for all axes by changing all "From" and "To" values from 100% to 10% - 200% range, and then untick the checkboxes next to X and Y axes, while keeping the Z axis checkbox ticked, we will end up with randomization of X and Y axes ignoring the scale map, and Z-scale (height) based on the scale map:



10% - 200% randomization is used for all scale axes. Checkboxes next to X and Y axes are unticked. 

This means that they will be randomized, but they will not be affected by the Scale Map. 

The Z-scaling is controlled by the Scale Map. 



9. Scaling Modes

So far, we only used the default "Map fixed" scaling mode. In this mode the black and white areas of the scale map directly correspond to the values specified in "From" and "To" fields. This way, black areas in the scale map will represent the smallest allowed instances, and white areas in the scale map will represent the biggest allowed instances. 


If we switch to the "Random amount" mode, the black and white areas of the scale map will be interpreted differently. "From" and "To" values will specify the maximum allowed randomization, black areas in the scale map will represent the areas where there is no randomization whatsoever, and white areas in the scale map will represent the areas where maximum randomization is allowed. 


Here is exactly the same setup as in point 8, only with the scaling mode changed to "Random amount". As you can see, in the black areas of the scale map, there is no scale randomization at all (all instances look exactly like the original object), and in the white areas there is maximum scale randomization happening:



Scaling Mode is changed to "Random amount".



10. "Random amount" Scaling Mode - Checker map example

Here is an example of the same mode ("Random amount") based on 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:



"Random amount" Scaling Mode using a Checker Scale Map.



11. "Map fixed" Scaling Mode - Checker map 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:



"Map fixed" Scaling Mode using a Checker Scale Map.



12. "Legacy" Scaling Mode - Checker map example

There is also "Legacy" mode, which multiplies the random scaling by the black and white values of the scale map, which means that all instances placed on the black areas will end up with 0 scale and in turn will be invisible. This mode is available only for compatibility with older scenes and generally there is no need to use it.



"Legacy" Scaling Mode using a Checker Scale Map.



13. RGB Scale Maps - controlling one axis

So far we only used black and white maps, but Corona Scatter can also interpret red, green, and blue channels of the scale map. Red color corresponds to the X axis, green color to the Y axis, and blue color to the Z axis. 

Here is an example of using a blue noise map. As you can see it only affects the height of the scattered objects, even though all axes are enabled for the Scale Map. This is because the blue color controls the Z axis, and the red and green channels are black for all other axes, which means that the "From" value will be used for X and Y axes for all of the scattered instances:


In this example we are using this blue Noise map.



All axis checkboxes are ticked, meaning that the blue Scale Map will affect all scaling axes.

Since there are no red and green components in the Scale Map, only the "From" value will be used for X an Y scaling axes, and the Z-scaling will be controlled by the amount of blue in the Scale Map (10% where there is no blue, 200% where there is only blue). 



14. RGB Scale Maps - controlling all axes

Here is an example of using an RGB noise map. As you can see, all X, Y, and Z axes are controlled separately by R, G, and B values of the scale map:


In this example we are using this RGB Noise map.



All axis checkboxes are ticked, meaning that the RGB Scale Map will affect all scaling axes.

X, Y, and Z scaling axes are controlled by the amount of the R, G, and B values respectively in the Scale Map (between the 10% and 200% range specified by "From" and "To" values).



15. Bonus - using Corona Distance map as the Scale Map


An example use of the Scale Map is controlling the scale (uniformly or not) of the scattered objects, depending on how close they are to some other object. In this case we want the stones to be fully randomized in X and Y axes, but we want them to be taller as they get closer to the cylinder object. 


To do it, we should first specify "From" and "To" values. In this case we will use the "From" value of 10% and "To" value of 200%. This means that the smallest allowed stones will have 10% size of the original stone (in any direction), and the largest ones will be twice as big as the original one. 


Once this is done, we should define which axes should be controlled by the scale map. Since we only want to control the Z axis (height), but we want other axes to be randomized too, we should untick the checkboxes next to X and Y axes (so that they are independent from the scale map, but still randomized based on "From" and "To" values), and only leave the Z checkbox ticked. 


We should then create a Corona Distance map, and pick the cylinder as the "distance-from" object. The colors of the Corona Distance map should be set up in a way that it gets more blue as it gets closer to the cylinder, and more black as it gets farther away from it. 


The Corona Distance map setup.


We should then plug this Corona Distance map as the Scale Map of the Corona Scatter:



X and Y scaling axes checkboxes are unticked, to get random scaling in X and Y axis (independent from the Scale Map). 

Z checkbox is ticked, to let the Scale Map control Z-scaling. 




A similar setup can be used to, for example, get smaller stones closer to the water surface, and larger stones further away from the water:






Related article: Error Message: Found a Corona Scatter object that uses more than one unique map plugged into its scale map slots.