is a three-dimensional graphics directive that specifies that faces of polygons and other filled graphics objects are to be drawn to reflect as a flat surface.

uses the attenuation factor d for the diffuse light.

uses the attenuation factor a for the ambient light.

# Details

• FlatShading is typically used to make individual faces and edges of polygons easily visible.
• The final color of a face of a polygon is computed from the polygon surface normal and the luminosity of the color resulting from standard shading.
• FlatShading[d,a] specifies that the diffuse light on a 3D surface should be attenuated by a factor d and the ambient light by a.
• is effectively equivalent to FlatShading[1,1].
• The setting Lighting"Accent" uses a directional light and faithfully reproduces colors on the surface.

# Examples

open allclose all

## Basic Examples(4)

Apply flat shading to the geodesic polyhedron:

Use flat shading to show a knot:

Show the faces used when rendering a plot:

Visualize a 3D model with hard edges between polygons:

## Scope(12)

### Basic Uses(5)

Apply flat shading to a graphics primitive:

Apply flat shading to a plot:

Apply flat shading to a chart:

Apply flat shading to a 3D object:

Summary box:

### Specification(4)

FlatShading with no arguments uses similar calculations for diffuse and ambient light as the default system shader:

Attenuate all light from the surface by a scaler value:

This is equivalent to specifying each attenuation factor explicitly:

Attenuate the diffuse light, setting the other attenuation factor to zero:

Attenuate the ambient light, setting the other attenuation factor to zero:

### Lighting(3)

FlatShading works with all types of lights:

Use colored lights:

The ambient percentage only applies if an AmbientLight is has been specified:

## Applications(4)

### Basic Applications(2)

The face colors are constant across the face of a polygon and based on the face normal:

The face color is based on the angle between the face normal and light vector:

The face is brightest when pointed toward the light:

The face is darkest when the face normal and light vector are orthogonal:

### Visualizations(2)

Create a low poly plot style:

Visualize the underlying plot mesh:

## Properties & Relations(3)

FlatShading does not include specular reflection:

## Possible Issues(2)

A discretization of the sphere:

Specular reflection does not affect FlatShading:

Use the default system shader with no VertexNormals specified to include specular lighting:

#### CMS

Wolfram Language. 2022. "FlatShading." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FlatShading.html.