Component:StaticTexture2D

From Resonite Wiki
Revision as of 17:01, 12 April 2025 by 989onan (talk | contribs) (add sync delegate desc)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


This article or section is a Stub. You can help the Resonite Wiki by expanding it.

Component image 
StaticTexture2D component as seen in the Scene Inspector

The StaticTexture2D Component stores a reference to a static asset representing a 2D Texture.

Fields

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled. Some components stop their functionality when this field is disabled, but some don't.
URL Uri The Asset URI that references the raw texture data
FilterMode Nullable`1<TextureFilterMode> How to handle the interpolation between pixels.
AnisotropicLevel Nullable`1<Int> The levels of Anisotropic filtering distances when using Anisotropic for FilterMode
Uncompressed Bool Do not use texture compression
DirectLoad Bool Whether to load the image directly from it's URI source and to not cache it locally.
ForceExactVariant Bool Only allow one variant of the texture to exist, part of Asset Variant System.
PreferredFormat Nullable`1<TextureCompression> The format to use for texture compression rather than the auto picked one
PreferredProfile Nullable`1<ColorProfile> The color profile to use rather than the auto picked one. (usually linear)
MipMapBias Float Whether to see lower resolution versions of the texture closer up or not (MipMaps).
IsNormalMap Bool This texture should be interpreted as a Normal Map
WrapModeU TextureWrapMode How to repeat or mirror the texture along the X axis. this goes into affect when X values are outside of the range [0.0 to 1.0].
WrapModeV TextureWrapMode How to repeat or mirror the texture along the Y axis. this goes into affect when Y values are outside of the range [0.0 to 1.0].
PowerOfTwoAlignThreshold Float The threshold for pixel count from range [0.0,1.0] before scaling both axes to a power of 2.
CrunchCompressed Bool Whether to compress the texture to extreme lengths to reduce VRam usage.
MinSize Nullable`1<Int> The miniumum size to show to the user, which scaled versions are generated by the cloud on the fly from the original and sent as part of the Asset Variant System
MaxSize Nullable`1<Int> The maxiumum size to show to the user, which scaled versions are generated by the cloud on the fly from the original and sent as part of the Asset Variant System
MipMaps Bool Whether to enable the rendering of mipmaps, which are lower res textures at further distances from the camera to improve performance.
KeepOriginalMipMaps Bool Whether to use the original mipmaps that came with the image data (yes you could have rainbow mipmaps at further distances) or not.
MipMapFilter Filtering How to apply filtering to the image's mipmaps. please see Filtering!
Readable Bool Whether this can be read per pixel via things like ProtoFlux


Usage

By default Filter is set to Bilinear Filtering, however Anisotropic Filtering results in a much better appearance at very steep angles, and only has a very minor performance impact. If visual fidelity of your texture is a concern, you should set Filter to Anisotropic, and AnisotropicLevel to 4 or 8.

Special Functions

Any of the operations listed below will generate a new static texture asset, and anything referring to this StaticTexture2D component will be updated with the new texture. The existing asset is deleted from the servers if no other items refer to it.

Troubleshooting

When importing images into Resonite, sometimes the image will have a row of pixels taken from the bottom of the image rendered at the top. To fix this issue, go to the FilterMode property on the StaticTexture2D component, click the checkbox, and select "Point". This prevents the issue

Triggers
Method Name Method type and Arguments. Is the method hidden? Description
BleedColorToAlpha:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X extends the color data of the texture out into transparent areas from non transparent areas.
FlipHorizontal:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Flips the image horizontally
FlipVertical:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Flips the image vertical
Rotate90CW:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Rotates the image by 90° clockwise
Rotate90CCW:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Rotates the image by 90° counterclockwise
Rotate180:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Rotates the image by 180°
MakeSquare:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Stretches the image such that both sides are equal to the longest side
TileLoop:Func`2<Float2, Task`1<Bool>> Func`2<Float2, Task`1<Bool>> X Tiles the image X times on the width and height directions
TileMirror:Func`2<Float2, Task`1<Bool>> Func`2<Float2, Task`1<Bool>> X Tiles the image X times on the width and height directions, mirroring the image every other tiling.
Rescale:Func`3<Int, Filtering, Task`1<Bool>> Func`3<Int, Filtering, Task`1<Bool>> X Resizes the image up or down.
Rescale:Func`3<Int2, Filtering, Task`1<Bool>> Func`3<Int2, Filtering, Task`1<Bool>> X Resizes the image up or down.
Crop:Func`3<Int2, Int2, Task`1<Bool>> Func`3<Int2, Int2, Task`1<Bool>> X Crops the image to a new area in pixels.
Trim:Func`2<Color, Task`1<Bool>> Func`2<Color, Task`1<Bool>> X Trims the image from the edges. for example, this can be used to trim a black and white mask image to get rid of extra white around the edges of the image.
Trim:Func`2<Color32, Task`1<Bool>> Func`2<Color32, Task`1<Bool>> X Trims the image from the edges. for example, this can be used to trim a black and white mask image to get rid of extra white around the edges of the image.
TrimTransparent:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Trims the transparent areas off of the edges of an image.
TrimByCornerColor:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Trims the image from the edges based on the colors in each corner. for example, this can be used to trim a black and white mask image to get rid of extra white around the edges of the image.
KMeansCluster:Func`5<Int, Float, Int, Float, Task`1<Bool>> Func`5<Int, Float, Int, Float, Task`1<Bool>> X This can be used to make the image into a vorroni version of it. is used to compress the color usage of an image to make it easily compressable. can also be used for art effects.
TileLoop:ButtonEventHandler`1<FloatTextEditorParser> ButtonEventHandler`1<FloatTextEditorParser> Tiles the image X times on the width and height directions
TileMirror:ButtonEventHandler`1<FloatTextEditorParser> ButtonEventHandler`1<FloatTextEditorParser> Tiles the image X times on the width and height directions, mirroring the image every other tiling.
Resize:ButtonEventHandler`1<IntTextEditorParser> ButtonEventHandler`1<IntTextEditorParser> Resizes the image up or down.
BleedColorToAlpha:ButtonEventHandler ButtonEventHandler extends the color data of the texture out into transparent areas from non transparent areas.
FlipHorizontal:ButtonEventHandler ButtonEventHandler Flips the image horizontal
FlipVertical:ButtonEventHandler ButtonEventHandler Flips the image vertical
Rotate90CW:ButtonEventHandler ButtonEventHandler Rotates the image by 90° clockwise
Rotate90CCW:ButtonEventHandler ButtonEventHandler Rotates the image by 90° counterclockwise
Rotate180:ButtonEventHandler ButtonEventHandler Rotates the image by 180°
TrimTransparent:ButtonEventHandler ButtonEventHandler Trims the transparent areas off of the edges of an image.
TrimByCornerColor:ButtonEventHandler ButtonEventHandler Stretches the image such that both sides are equal to the longest side
MakeSquare:ButtonEventHandler ButtonEventHandler Resizes the image to make it square.
ToNearestPOT:ButtonEventHandler ButtonEventHandler Resizes the image to the nearest power of two (2^x)
GenerateBitmapMetadata:ButtonEventHandler ButtonEventHandler Generates the bitmap metadata (bitmaps are sets of smaller texture resolutions for performance) for this image.
ReplaceFromClipboard:ButtonEventHandler ButtonEventHandler Replaces the image data with the data in the local user's clipboard
InvertRGB:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Inverts the colors of the image.
InvertR:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Inverts the red channel of the image.
InvertG:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Inverts the green channel of the image.
InvertB:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Inverts the blue channel of the image.
InvertA:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Inverts the alpha channel of the image.
ColorToAlpha:Func`2<ColorX, Task`1<Bool>> Func`2<ColorX, Task`1<Bool>> X Turns the color data of the image into transparency/alpha data.
AlphaFromIntensity:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Makes alpha/transparency data depending on the color intensity of the image.
AlphaToMask:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Turns the alpha of the image into a black and white image.
RemoveAlpha:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Removes the alpha data completely from the image or makes it white.
GrayscaleAverage:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Make grayscale image based on the average values for the colors per pixel.
GrayscaleLuminance:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Make grayscale image based on the color luminance per pixel.
SwapRG:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Swaps the red and green channels on the image
SwapRB:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Swaps the red and blue channels on the image
SwapRA:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Swaps the red and alpha channels on the image
SwapGB:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Swaps the green and blue channels on the image
SwapGA:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Swaps the green and alpha channels on the image
SwapBA:Func`1<Task`1<Bool>> Func`1<Task`1<Bool>> X Swaps the blue and alpha channels on the image
AddBackground:Func`2<ColorX, Task`1<Bool>> Func`2<ColorX, Task`1<Bool>> X adds a background of a color to a transparent image.
AdjustGamma:Func`2<Float, Task`1<Bool>> Func`2<Float, Task`1<Bool>> X Adjusts the gamma of the image.
AdjustAlphaGamma:Func`2<Float, Task`1<Bool>> Func`2<Float, Task`1<Bool>> X Adjusts the gamma of the alpha channel of the image.
ShiftHue:Func`2<Float, Task`1<Bool>> Func`2<Float, Task`1<Bool>> X Shifts the hue of HSV of the image.
SetHue:Func`2<Float, Task`1<Bool>> Func`2<Float, Task`1<Bool>> X Sets the Hue of HSV of the image.
SetSaturation:Func`2<Float, Task`1<Bool>> Func`2<Float, Task`1<Bool>> X Sets the saturation of HSV of the image.
OffsetSaturation:Func`2<Float, Task`1<Bool>> Func`2<Float, Task`1<Bool>> X Adds to the saturation of HSV of the image.
MulSaturation:Func`2<Float, Task`1<Bool>> Func`2<Float, Task`1<Bool>> X Multiplies the saturation of HSV of the image.
SetValue:Func`2<Float, Task`1<Bool>> Func`2<Float, Task`1<Bool>> X Sets the value of HSV of the image.
MulValue:Func`2<Float, Task`1<Bool>> Func`2<Float, Task`1<Bool>> X Multiplies the value of HSV of the image.
OffsetValue:Func`2<Float, Task`1<Bool>> Func`2<Float, Task`1<Bool>> X Adds to the value of HSV of the image.
OffsetAlpha:Func`2<Float, Task`1<Bool>> Func`2<Float, Task`1<Bool>> X Adds to the alpha of the image.
Normalize:Func`4<Bool, Bool, Bool, Task`1<Bool>> Func`4<Bool, Bool, Bool, Task`1<Bool>> X Normalizes the colors of the image, making it have a bigger color range usage.

Examples

See Also