Image Gradient Component

Add the Image Gradient component to generate a gradient from an image. The component also provides advanced configuration options, such as tiling, scaling, and custom sampling types.

Provider

Gradient Signal Gem

Dependencies

Gradient Transform Modifier

Image Gradient properties

Image Gradient component properties

PropertyDescriptionValuesDefault
PreviewDisplays the output gradient of this component after all properties are applied.
Pin Preview to ShapeUses the bounding box of a compatible Shape component from the given entity to determine the world size of the preview. If Constrain to Shape is Enabled, the preview will constrain to the actual shape, not just the shape bounds.EntityIdCurrent Entity
Preview PositionSets the world location of the preview.

This field is available only if there is no entity selected in Pin Preview to Shape.
Vector3: -Infinity to InfinityX:0.0, Y:0.0, Z:0.0
Preview SizeSets the dimensions of the preview.

This field is available only if there is no entity selected in Pin Preview to Shape.
Vector3: 0.0 to InfinityX:1.0, Y:1.0, Z:1.0
Constrain to ShapeIf Enabled, the gradient preview uses the bounds of the entity selected in Pin Preview to Shape.

This field is available only if an entity is selected in Pin Preview to Shape.
BooleanDisabled
TilingSets the number of times to tile the image horizontally (X) and vertically (Y).Vector2: 0.01 to InfinityX: 1.0, Y: 1.0
Image AssetSets the source image to generate this gradient’s values..streamingimageNone

Advanced properties

The Advanced group of properties has an in-line toggle switch that enables/disables the entire group of advanced properties. By default, these are disabled.

PropertyDescriptionValuesDefault
Channel To UseThe channel component of the image to sample from.

The Terrarium option is for an image-based terrain file format as defined by Mapzen here
Red, Green, Blue, Alpha, TerrariumRed
Custom ScaleChoose a scaling operation to be applied to all image data.

The Auto option will automatically scale based on the min/max values in the image data.
None, Auto, ManualNone
Range MinimumThe minimum value used to scale image data into the 0-1 range for the gradient. All image values at or below the minimum will be scaled to 0.

This field is available only if the Custom Scale field is set to Manual.
Float: 0.0 to 1.00.0
Range MaximumThe maximum value used to scale image data into the 0-1 range for the gradient. All image values at or above the maximum will be scaled to 1.

This field is available only if the Custom Scale field is set to Manual.
Float: 0.0 to 1.01.0
Mip IndexSpecify which mip level index to sample from.

If you specify a mip level higher than the number of mip levels available in your image, then the highest existing mip index will be used (see MipCountMax ).
Int: 0 to 150
Sampling TypeThe sampling type to be used on the image data.Point, BilinearPoint

Sampling types

There are several sampling types to choose from. To illustrate, here are previews of the same source image using the different supported sampling types.

Point

Point sampling is the default and only samples a single point for each pixel of the source image.

Image Gradient using point sampling

Bilinear

The Bilinear filter can be used to smooth out the image by requesting four points in a grid around a requested pixel and then performing interpolation between the points.

Image Gradient using bilinear interpolation

ImageGradientRequestBus

Use the following request functions with the ImageGradientRequestBus EBus interface to communicate with Image Gradient components in your game.

Request NameDescriptionParameterReturnScriptable
GetImageAssetPathReturns the path of the AZ::RPI::StreamingImageAsset property.NoneStringYes
GetTilingXReturns the value of the Tiling X property.NoneFloatYes
GetTilingYReturns the value of the Tiling Y property.NoneFloatYes
SetImageAssetPathSets the path of the AZ::RPI::StreamingImageAsset property using an absolute or relative path to the asset.StringNoneYes
SetTilingXSets the value of the Tiling X property.FloatNoneYes
SetTilingYSets the value of the Tiling Y property.FloatNoneYes