Texture

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)

Apply a texture to a polygon in 2D:

Apply a texture to a plot:

Apply a texture to a cube in 3D:

Apply a texture to a model:

Scope  (20)

Basic Uses  (3)

Apply a texture to primitives in 2D:

3D:

Apply a texture to a plot in 2D:

3D:

Apply a texture to a GraphicsComplex:

Specification  (8)

1D texture using a list of RGB colors:

1D texture using a gradient ColorData:

1D texture on a polygon in 3D:

1D texture on the surface of Plot3D:

2D texture using a matrix of RGB colors:

A 3D graphic:

A plot:

2D texture using an image:

A 3D graphic:

A plot:

Use a transparent image:

2D texture using stylized text:

A 3D graphic:

A plot:

2D texture using 2D and 3D graphics:

A 3D graphic:

2D texture using plot functions:

A 2D graphic:

A 3D graphic:

A plot:

3D texture using an array of RGB colors:

Display the 3D texture by stacking polygons:

Cross sections of the 3D texture:

Coordinates  (5)

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

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

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

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

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

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

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

FilledCurve components are mapped to sublists of texture coordinates:

Texture coordinates of plot functions can be specified by TextureCoordinateFunction:

Styling  (4)

Use Opacity to set overall opacity of textures:

Use FaceForm to set front and back textures differently:

Specularity of a textured surface can be set by Specularity:

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

Generalizations & Extensions  (1)

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

Use the transparency values to create texture with holes:

Applications  (13)

Basic Applications  (1)

Show the corresponding mapping to texture coordinates:

Environment Maps  (3)

Create a realistic background using a spherical texture:

Create a realistic background using a sky box texture:

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

Astronomy  (2)

Create realistic planets and moons using texture maps with MaterialShading:

Use the star map as the background:

Geography  (2)

Display geographical data from GeoGraphics on an interactive globe:

Style countries with their own flag:

Texture Models  (1)

Apply a texture to a texture-mapped model:

Visualizations  (2)

Style a plot with a texture:

Style a ListSurfacePlot3D with a texture:

Texture Examples  (1)

ExampleData includes grayscale and color texture samples:

Use the sample textures with a plot function:

Volume Rendering  (1)

Construct a 3D texture from slices of medical images:

Draw cross-sections of the volumetric data:

Properties & Relations  (4)

The projection mapping can be specified per object using TextureMapping:

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

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

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

Possible Issues  (1)

Texture mapping is preceded by VertexColors:

Neat Examples  (3)

Animated Textures  (2)

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

Display an animation mapped to a polygon:

Show multiple animations in the same graphic:

Textures on Polyhedra  (1)

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).

CMS

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

BibTeX

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

BibLaTeX

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