WOLFRAM

Texture[obj]

is a graphics directive that specifies that obj should be used as a texture on faces of polygons and other filled graphics objects.

Texture[obj,map]

specifies the projection mapping map to assign to vertices of 3D graphics objects.

Details

  • Texture mapping is also know as UV mapping or diffuse mapping.
  • Texture is typically used in modeling to project an image to a 2D polygon or 3D surface.
  • Texture can be used in both Graphics and Graphics3D.
  • In Texture[obj,], the object obj can be an image, a graphics or arrays of colors.
  • The following forms can be used to explicitly specify the color values for textures:
  • Texture[{c1,c2,}]a 1D texture of colors
    Texture[{{c11,c12,},}]a 2D texture of colors
    Texture[{{{c111,c112,},},}]a 3D texture of colors
  • Each color can be either a list of the form {r,g,b} corresponding to RGBColor[r,g,b] or a list of the form {r,g,b,a} corresponding to RGBColor[r,g,b,a].
  • Texture[obj] is equivalent to Texture[Rasterize[obj]] and will rasterize obj at the size and resolution it would normally be displayed in a notebook.
  • Texture[obj,map] provides a texture obj that can be applied to faces of polygons and surfaces by assigning coordinates to vertices from the projection mapping map.
  • Possible 3D projection mappings for 2D images include:
  • Automaticautomatically choose the projection
    Noneno projection
    "Box"box projection
    "Cubic"cubic projection
    "Cylindrical"cylindrical projection
    "Front"planar project on the xy plane
    "Planar"planar projection
    "Spherical"spherical projection
  • VertexTextureCoordinates can be used to specify a projection mapping for a given graphics primitive.
  • Opacity can be used with Texture to specify overall opacity of textures.
  • Texture can be used in FaceForm to texture front and back faces differently.
  • The colors in Texture are taken to be diffuse colors in their interaction with Lighting.

Examples

open allclose all

Basic Examples  (4)Summary of the most common use cases

Apply a texture to a polygon in 2D:

Out[1]=1

Apply a texture to a plot:

Out[1]=1

Apply a texture to a cube in 3D:

Out[1]=1

Apply a texture to a model:

Out[1]=1

Scope  (20)Survey of the scope of standard use cases

Basic Uses  (3)

Apply a texture to primitives in 2D:

Out[1]=1

3D:

Out[2]=2

Apply a texture to a plot in 2D:

Out[1]=1

3D:

Out[2]=2

Apply a texture to a GraphicsComplex:

Out[1]=1

Specification  (8)

1D texture using a list of RGB colors:

Out[2]=2

1D texture using a gradient ColorData:

Out[4]=4

1D texture on a polygon in 3D:

Out[5]=5

1D texture on the surface of Plot3D:

Out[6]=6

2D texture using a matrix of RGB colors:

Out[2]=2

A 3D graphic:

Out[3]=3

A plot:

Out[4]=4

2D texture using an image:

Out[1]=1

A 3D graphic:

Out[2]=2

A plot:

Out[3]=3

Use a transparent image:

Out[1]=1

2D texture using stylized text:

Out[2]=2

A 3D graphic:

Out[3]=3

A plot:

Out[4]=4

2D texture using 2D and 3D graphics:

Out[1]=1
Out[2]=2

A 3D graphic:

Out[3]=3

2D texture using plot functions:

Out[1]=1

A 2D graphic:

Out[2]=2

A 3D graphic:

Out[3]=3

A plot:

Out[4]=4

3D texture using an array of RGB colors:

Display the 3D texture by stacking polygons:

Out[2]=2

Cross sections of the 3D texture:

Out[3]=3

Coordinates  (5)

Texture coordinates corresponding to each vertex of Polygon can be specified by VertexTextureCoordinates:

Out[2]=2

Specify a portion of 1D texture by using coordinates between {0} and {1}:

Out[3]=3

Repeat 1D texture by using coordinate values outside of {0} and {1}:

Out[4]=4

The 2D texture coordinates are assumed to range from {0,0} to {1,1}:

Out[2]=2

Specify a portion of 2D texture by using coordinates within the range of {0,0} and {1,1}:

Out[3]=3

Repeat 2D texture by using coordinate values outside of {0,0} and {1,1}:

Out[4]=4

The 3D texture coordinates are assumed to range from {0,0,0} to {1,1,1}:

Out[2]=2

FilledCurve components are mapped to sublists of texture coordinates:

Out[2]=2

Texture coordinates of plot functions can be specified by TextureCoordinateFunction:

Out[1]=1
Out[2]=2
Out[3]=3

Styling  (4)

Use Opacity to set overall opacity of textures:

Out[1]=1

Use FaceForm to set front and back textures differently:

Out[2]=2

Specularity of a textured surface can be set by Specularity:

Out[1]=1

The colors in textures are taken to be diffuse colors in their interaction with Lighting:

Out[1]=1

Generalizations & Extensions  (1)Generalized and extended use cases

Use a list of the form {r,g,b,a} to specify transparency of individual pixels of texture:

Out[3]=3

Use the transparency values to create texture with holes:

Out[5]=5

Applications  (13)Sample problems that can be solved with this function

Basic Applications  (1)

Show the corresponding mapping to texture coordinates:

Out[97]=97
Out[98]=98
Out[99]=99

Environment Maps  (3)

Create a realistic background using a spherical texture:

Out[2]=2

Create a realistic background using a sky box texture:

Out[2]=2

Apply sky box textures to the individual sides of a cube:

Out[2]=2

Astronomy  (2)

Create realistic planets and moons using texture maps with MaterialShading:

Out[2]=2

Use the star map as the background:

Out[1]=1

Geography  (2)

Display geographical data from GeoGraphics on an interactive globe:

Out[1]=1

Style countries with their own flag:

Out[1]=1
Out[2]=2

Texture Models  (1)

Apply a texture to a texture-mapped model:

Out[1]=1

Visualizations  (2)

Style a plot with a texture:

Out[1]=1

Style a ListSurfacePlot3D with a texture:

Out[2]=2

Texture Examples  (1)

ExampleData includes grayscale and color texture samples:

Use the sample textures with a plot function:

Out[4]=4

Volume Rendering  (1)

Construct a 3D texture from slices of medical images:

Draw cross-sections of the volumetric data:

Out[3]=3

Properties & Relations  (4)Properties of the function, and connections to other functions

The projection mapping can be specified per object using TextureMapping:

Out[1]=1

The "Spherical" mapping transforms Cartesian points on a surface to spherical coordinates:

Out[1]=1
Out[2]=2

The "Cylindrical" mapping transforms Cartesian points on a surface to cylindrical coordinates:

Out[2]=2

The "Planar" mapping projects 3D points to a 2D plane:

Out[1]=1
Out[2]=2

Possible Issues  (1)Common pitfalls and unexpected behavior

Texture mapping is preceded by VertexColors:

Out[1]=1

Neat Examples  (3)Surprising or curious use cases

Animated Textures  (2)

Create a cube with an animated clock face on each side:

Out[1]=1

Display an animation mapped to a polygon:

Out[1]=1

Show multiple animations in the same graphic:

Out[2]=2

Textures on Polyhedra  (1)

Out[1]=1
Wolfram Research (2010), Texture, Wolfram Language function, https://reference.wolfram.com/language/ref/Texture.html (updated 2024).
Wolfram Research (2010), Texture, Wolfram Language function, https://reference.wolfram.com/language/ref/Texture.html (updated 2024).

Text

Wolfram Research (2010), Texture, Wolfram Language function, https://reference.wolfram.com/language/ref/Texture.html (updated 2024).

Wolfram Research (2010), Texture, Wolfram Language function, https://reference.wolfram.com/language/ref/Texture.html (updated 2024).

CMS

Wolfram Language. 2010. "Texture." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/Texture.html.

Wolfram Language. 2010. "Texture." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/Texture.html.

APA

Wolfram Language. (2010). Texture. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Texture.html

Wolfram Language. (2010). Texture. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Texture.html

BibTeX

@misc{reference.wolfram_2025_texture, author="Wolfram Research", title="{Texture}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/Texture.html}", note=[Accessed: 30-April-2025 ]}

@misc{reference.wolfram_2025_texture, author="Wolfram Research", title="{Texture}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/Texture.html}", note=[Accessed: 30-April-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_texture, organization={Wolfram Research}, title={Texture}, year={2024}, url={https://reference.wolfram.com/language/ref/Texture.html}, note=[Accessed: 30-April-2025 ]}

@online{reference.wolfram_2025_texture, organization={Wolfram Research}, title={Texture}, year={2024}, url={https://reference.wolfram.com/language/ref/Texture.html}, note=[Accessed: 30-April-2025 ]}