is a three-dimensional graphics directive specifying that objects that follow are to be drawn with closely spaced parallel lines.
HatchShading[d]
uses the density d of shading.
HatchShading[col]
uses lines with the specified color col.
HatchShading[d,col]
uses lines with the specified color col and density d.
HatchShading
is a three-dimensional graphics directive specifying that objects that follow are to be drawn with closely spaced parallel lines.
HatchShading[d]
uses the density d of shading.
HatchShading[col]
uses lines with the specified color col.
HatchShading[d,col]
uses lines with the specified color col and density d.
Details
- HatchShading is also known as cross-hatching.
- HatchShading is typically used to create tonal effects with closely spaced parallel lines.
- HatchShading[d,col] specifies that lines of color col should vary with overall density d.
- The density of lines is driven by the luminosity of the surface. Less dense areas are where there is high luminosity.
- The density d is between 0 and 1. A higher value indicates more lines per area.
- The color col can be defined by RGBColor, Hue or any other color specification.
- In HatchShading[d], the color of lines is taken to be Black.
- HatchShading[col] uses a density of 0.5.
- HatchShading[] is effectively equivalent to HatchShading[0.5,Black].
- The setting Lighting"Accent" uses a directional light and faithfully reproduces colors on the surface.
Examples
open all close allBasic Examples (4)
Apply hatch shading to the unit sphere with a directional light:
Graphics3D[{HatchShading[], Sphere[]}, Lighting -> "Accent"]Use hatch shading to show a knot:
Graphics3D[{HatchShading[.6, Blue], KnotData["SolomonSeal", "ImageData"]}, Lighting -> "Accent"]Plot3D[Style[Sin[x y], HatchShading[.7, Red]], {x, 0, 3}, {y, 0, 3}, Mesh -> None, TextureCoordinateFunction -> ({#1, #3}&), Lighting -> "Accent"]A cross-hatching portrait of Beethoven:
Graphics3D[{HatchShading[], ExampleData[{"Geometry3D", "Beethoven"}, "GraphicsComplex"]}, Boxed -> False, Lighting -> "Accent"]Scope (12)
Basic Uses (5)
Apply hatch shading to a graphics primitive:
Graphics3D[{HatchShading[], #}, Lighting -> "Accent"]& /@ {Sphere[], CapsuleShape[], Cone[]}Apply hatch shading to a plot:
SphericalPlot3D[1 + 2Cos[2θ], {θ, 0, Pi}, {ϕ, 0, 2Pi}, Axes -> False, PlotStyle -> HatchShading[], PlotPoints -> 40, Lighting -> "Accent" ]Apply hatch shading to a chart:
BarChart3D[Range[5], ChartElements -> [image], ChartStyle -> HatchShading[]]Apply hatch shading to a 3D object:
Graphics3D[{HatchShading[], ExampleData[{"Geometry3D", "Beethoven"}, "GraphicsComplex"]}, Lighting -> "Accent"]HatchShading[]Specification (4)
HatchShading with no arguments uses gray tones:
Graphics3D[{HatchShading[], Sphere[]}, Lighting -> "Accent"]Apply hatch shading to the unit sphere with different densities:
Graphics3D[{HatchShading[#], Sphere[]}, Lighting -> "Accent"]& /@ {.15, .4, .7}Graphics3D[{HatchShading[#], Sphere[]}, Lighting -> "Accent"]& /@ {Red, Green, Blue}Use LightDarkSwitched to specify different colors for light and dark modes:
graphic = Graphics3D[{HatchShading[LightDarkSwitched[Red, Blue]], Sphere[]}, Lighting -> "Accent"];{LightModePane[graphic], DarkModePane[graphic]}Lighting (3)
HatchShading works with all types of lights:
lights = {{"Ambient", LightGray}, {"Point", White, ImageScaled[{1, 1, 2}]}, {"Directional", White, ImageScaled[{1, 1, 2}]}, {"Spot", White, {{1, -1, 1}, {0, 0, 0}}, Pi / 4}};
Graphics3D[{HatchShading[], Sphere[]}, Lighting -> {#}]& /@ lightsGraphics3D[{HatchShading[], Sphere[]}, Lighting -> {{"Directional", Red, ImageScaled[{1, -0.5, 1}]}, {"Directional", Green, ImageScaled[{-1, -0.5, 1}]}, {"Directional", Blue, ImageScaled[{0, 1, 1}]}, {"Ambient", GrayLevel[0.2]}}]Use "Accent" lighting to faithfully reproduces colors on the surface:
Graphics3D[{HatchShading[], Sphere[]}, Lighting -> #] & /@ {"Accent", Automatic}Possible Issues (2)
The default light scheme uses several colored light sources:
Graphics3D[{HatchShading[], Sphere[]}]Use a single directional light to get the standard hatch shading effect:
Graphics3D[{HatchShading[], Sphere[]}, Lighting -> {{"Directional", White, ImageScaled[{1, 1, 2}]}}]No shading effect is applied to faces of polygons or filled graphic objects:
Graphics3D[{Red, HatchShading[0], Sphere[]}]Related Guides
History
Text
Wolfram Research (2020), HatchShading, Wolfram Language function, https://reference.wolfram.com/language/ref/HatchShading.html.
CMS
Wolfram Language. 2020. "HatchShading." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/HatchShading.html.
APA
Wolfram Language. (2020). HatchShading. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/HatchShading.html
BibTeX
@misc{reference.wolfram_2026_hatchshading, author="Wolfram Research", title="{HatchShading}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/HatchShading.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_hatchshading, organization={Wolfram Research}, title={HatchShading}, year={2020}, url={https://reference.wolfram.com/language/ref/HatchShading.html}, note=[Accessed: 13-June-2026]}