Inherits: Resource < Reference < Object

Inherited By: Texture3D, TextureArray

Base class for 3D texture types.


Base class for Texture3D and TextureArray. Cannot be used directly, but contains all the functions necessary for accessing and using Texture3D and TextureArray. Data is set on a per-layer basis. For Texture3Ds, the layer sepcifies the depth or Z-index, they can be treated as a bunch of 2D slices. Similarly, for TextureArrays, the layer specifies the array layer.


Dictionarydata{"depth": 0,"flags": 4,"format": 37,"height": 0,"layers": [  ],"width": 0}


voidcreate ( int width, int height, int depth, Format format, int flags=4 )
intget_depth ( ) const
Formatget_format ( ) const
intget_height ( ) const
Imageget_layer_data ( int layer ) const
intget_width ( ) const
voidset_data_partial ( Image image, int x_offset, int y_offset, int layer, int mipmap=0 )
voidset_layer_data ( Image image, int layer )


enum Flags:

  • FLAG_MIPMAPS = 1 — Texture will generate mipmaps on creation.
  • FLAG_REPEAT = 2 — Texture will repeat when UV used is outside the 0-1 range.
  • FLAG_FILTER = 4 — Use filtering when reading from texture. Filtering smooths out pixels. Turning filtering off is slightly faster and more appropriate when you need access to individual pixels.
  • FLAGS_DEFAULT = 4 — Equivalent to FLAG_FILTER.

Property Descriptions

Default{"depth": 0,"flags": 4,"format": 37,"height": 0,"layers": [  ],"width": 0}

Returns a dictionary with all the data used by this texture.


Specifies which Flags apply to this texture.

Method Descriptions

Creates the Texture3D or TextureArray with specified width, height, and depth. See Format for format options. See Flags enumerator for flags options.

  • int get_depth ( ) const

Returns the depth of the texture. Depth is the 3rd dimension (typically Z-axis).

Returns the current format being used by this texture. See Format for details.

  • int get_height ( ) const

Returns the height of the texture. Height is typically represented by the Y-axis.

  • Image get_layer_data ( int layer ) const

Returns an Image resource with the data from specified layer.

  • int get_width ( ) const

Returns the width of the texture. Width is typically represented by the X-axis.

  • void set_data_partial ( Image image, int x_offset, int y_offset, int layer, int mipmap=0 )

Partially sets the data for a specified layer by overwriting using the data of the specified image. x_offset and y_offset determine where the Image is “stamped” over the texture. The image must fit within the texture.

  • void set_layer_data ( Image image, int layer )

Sets the data for the specified layer. Data takes the form of a 2-dimensional Image resource.

Doc ID missing

Disclaimer: This page has been automaticaly and directly extracted from the official Godot Docs website, the 1970-01-01 at 00:00:00. It’s the English Stable version because it’s what most Godot users should use. The Copyright owners are Juan Linietsky, Ariel Manzur and the Godot community. CC-BY 3.0. Thanks for your patience and generosity.