Version:

Use the Gradient Baker component to bake a complex node graph of gradients down to a single static image. You can then use a single Image Gradient at runtime, instead of having the entire node graph computed every time, to optimize performance.

For example, suppose you have a complex gradient chain with a generator and multiple gradient modifiers.

You can create a Gradient Baker and connect its input gradient to the output of the gradient chain you’d like to bake. The Gradient Baker also needs an input bounds for where to sample the data. With both of those connected, the graph would look like this.

Clicking the Bake image button on the Gradient Baker component will then bake out a single static image that can be used in a single Image Gradient, which reduces the entire complex graph to only a single component.

The final optimization step is to select all of the gradients in your chain and mark them as Editor only. This will prevent them from being loaded/computed at runtime. You can optionally mark the Gradient Baker as Editor only as well, but it will have no effect because there is no runtime component for it.

## Provider

PropertyDescriptionValuesDefault
PreviewDisplays the gradient image that will be baked out of this component after all properties are applied.
Input BoundsAn entity with a shape component for where to sample the data from.EntityIdNone
ResolutionThe resolution of the output baked image.Vector2: 1 to InfinityX:512, Y:512
Output FormatThe output format of the output baked image.R8, R16, R32R32
Output PathFile path where the output image will be baked.

NOTE: By default, the initial output path will have a _gsi suffix. This is because the Image Gradient that will consume the output image only supports a subset of available pixel formats. The _gsi suffix will make sure the Asset Processor uses a supported format. You can omit the _gsi suffix if your output image is configured to use a supported format. For more information about this limitation, please refer to the Image Gradient documentation
AZ::IO::PathNone

PropertyDescriptionValuesDefault
OpacitySets the opacity of the input gradient.Float: 0.0 - 1.01.0
Invert InputInverts the values of the input gradient.BooleanDisabled
Preview (Input)Displays the gradient provided by the entity set in Gradient Entity Id.
Enable TransformIf Enabled, the translation, scale, and rotation of the input gradient may be modified.BooleanDisabled
TranslateSets the translation of the input gradient.Vector3: -Infinity to InfinityX:0.0, Y:0.0, Z:0.0
ScaleSets the scale of the input gradient.Vector3: 0.0001 to InfinityX:1.0, Y:1.0, Z:1.0
RotateSets the rotation of the input gradient.Vector3: -Infinity to InfinityX:0.0, Y:0.0, Z:0.0
Enable LevelsIf Enabled, the input and output values of the input gradient may be modified.BooleanDisabled
Input MidSets the median value of the input gradient.Float: 0.0 - 1.01.0
Input MinSets a minimum value for the input gradient.Float: 0.0 - 1.00.0
Input MaxSets a maximum value for the input gradient.Float: 0.0 - 1.01.0
Output MinSets a minimum value for the output gradient.Float: 0.0 - 1.00.0
Output MaxSets a maximum value for the output gradient.Float: 0.0 - 1.01.0

Use the following request functions with the GradientBakerRequestBus EBus interface to communicate with the Gradient Baker component.
BakeImageBake the image to the output path.NoneNoneYes
GetInputBoundsReturns AZ::EntityId of the input bounds to sample from.NoneAZ::EntityIdYes
SetInputBoundsSets the AZ::EntityId for the input bounds to sample from.AZ::EntityIdNoneYes
GetOutputResolutionReturns the output resolution for the baked image.NoneAZ::Vector2Yes
SetOutputResolutionSets the output resolution for the baked image.AZ::Vector2NoneYes
GetOutputFormatReturns the output format for the baked image.NoneGradientSignal::OutputFormatYes
SetOutputFormatSets the output format for the baked image.GradientSignal::OutputFormatNoneYes
GetOutputImagePathReturns the path that the output image will be baked to.NoneAZ::IO::PathYes
SetOutputImagePathSets the path that the output image will be baked to.AZ::IO::PathNoneYes