Give Page Feedback | API

Cell Visual Transition Controllers - Scale Transitioner

The Scale Transitioner performs transitions by manipulating the scale value of transforms. Typically you will scale the transform up when going from invisible to visible, and scale down when going from visible to invisible, however there is nothing stopping you from doing the reverse.

Creating A Scale Transitioner Component

You can add this component by selecting a game object and then selecting from the Top Menu Bar:

Component -> Deep Space Labs -> -> SAM -> Visual Transition Controllers -> Scale Transitioner

Adding A Scale Transitioner Component From The Top Menu Bar GIF

or by selecting a game object and using the Add Component menu via its inspector:

Component -> Deep Space Labs -> -> SAM -> Visual Transition Controllers -> Scale Transitioner

Adding A Scale Transitioner Component From Add Component Menu GIF

How It Works

For each instance, you can specify a Scale From Invisible To Visible value. A Scale From Visible To Invisible value is calculated automatically by dividing 1 by each vector component value from Scale From Invisible To Visible.

When scaling transforms from invisible to visible, the current scale of each transform is multiplied by the Scale From Invisible To Visible value, and then the scale of the transform is lerped between its original value and the new calculated value.

For example, if a transform has a scale of (1f, 2f, 3f) while in the invisible state, and a Scale From Visible To Invisible value of (3f, 3f, 3f) is set, the scale of the transform will go from (1f, 2f, 3f) to (3f, 6f, 9f).

Conversely, when transitioning this same transform from the visible state to the invisible state, the scale of the transform will go from (3f, 6f, 9f) to (1f, 2f, 3f).

The Scale From Invisible To Visible value specified must be greater than 0 for each component. Using a value of 1 for one of the components will cause no scaling to occur on that axis. Using a value less than 1 will cause a sort of reverse scaling operation, where the object scales down when going from invisible to visible and scales up when going from visible to invisible.

Benefits

The Scale Transitioner offers a nice visual effect and is especially useful for vegetation, since the growth of vegetation mimics the effect of scaling up an object.

It is also useful if your shader does not allow for the use of cross fading, or you just don't like the effect.

Reusing The Scale Transitioner

While you can use the Scale Transitioner on multiple World Groupings, keep in mind that each Scale Transitioner instance only allows you to specify a single scaling value. Generally speaking, all transforms that will be transitioned by a single instance should have similar Visible scale values, as otherwise the scaling operation may not transition the transforms to a valid Invisible state (i.e., the objects may remain visible to the Player when they should be invisible).

This also means that if you are using objects that are otherwise very similar but that have widely different scale values, you may need to place them on separate World Groupings.

What Transforms To Use

Each World Cell you need to transition will have one or more Asset Chunks to scale. However, in some cases scaling the Asset Chunk directly does not make sense, such as when the chunk is just an empty parent and its children are individual scene assets.

In these instances, enabling the Transforms Stored In Children option will tell the Scale Transitioner to scale all first level children of each Asset Chunk rather than the Asset Chunks directly.

Transition Time Variation

If you set this setting to 0, the transforms belonging to the input World Cells will all have the same transition time (i.e. the transitions will be completed at exact same moment).

In some cases this may not be visually appealing, and in those cases you can apply a small variation to the Transition Time via this setting. The value you specify is subtracted from the Transition Time to get a minimum possible transition time, and then added to the Transition Time to get a maximum possible transition time.

When performing Non LOD Transitions, every transform is assigned a random value between these two ranges for their transition time.

When performing LOD Transitions, it's assumed that the transforms from the old LOD have matching transforms on the new LOD. Since there is no way to easily determine which Transforms need to match, the Transitioner takes a conservative approach and gives every Transforms on each Transition From Cell and Transition To Cell the same Transition Time (though this time is still a random value between the range specified above).

Basically, transforms belonging to the same Cell are given the same transition time.

The Transitioner uses the System.Random class to randomly choose the final transition times. Use the Random Seed setting to control the randomization.