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:
-
Automatic automatically choose the projection None no projection "Box" box projection "Cubic" cubic projection "Cylindrical" cylindrical projection "Front" planar project on the x–y 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 allBasic Examples (4)
Scope (20)
Basic Uses (3)
Apply a texture to primitives in 2D:
Apply a texture to a plot in 2D:
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:
2D texture using stylized text:
2D texture using 2D and 3D graphics:
2D texture using plot functions:
3D texture using an array of RGB colors:
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)
Applications (13)
Environment Maps (3)
Astronomy (2)
Create realistic planets and moons using texture maps with MaterialShading:
Geography (2)
Display geographical data from GeoGraphics on an interactive globe:
Visualizations (2)
Texture Examples (1)
ExampleData includes grayscale and color texture samples:
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:
Possible Issues (1)
Texture mapping is preceded by VertexColors:
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