GouraudShading

GouraudShading[]

is a threedimensional graphics directive that specifies that faces of polygons and other filled graphics objects are to be drawn to reflect as a smooth surface using a normalvector average shading.

GouraudShading[d]

uses the attenuation factor d for the diffuse light.

GouraudShading[d,s]

uses the attenuation factor s for the specular light.

GouraudShading[d,s,a]

uses the attenuation factor a for the ambient light.

Details

  • GouraudShading is also known as pervertex shading.
  • GouraudShading is typically used to achieve smooth lighting on low-polygon surfaces.
  • The final colors are computed from the averages of the surface normals at the vertices of the polygons and the luminosity of the color resulting from standard shading.
  • GouraudShading[d,s,a] specifies that the diffuse light on a 3D surface should be attenuated by a factor d, the specular light by s and the ambient light by a.
  • GouraudShading[] is effectively equivalent to GouraudShading[1,1,1].
  • The setting Lighting"Accent" uses a directional light and faithfully reproduces colors on the surface.
  • The basic shading models FlatShading, GouraudShading and PhongShading compared:

Examples

open allclose all

Basic Examples  (3)

Apply GouraudShading to the geodesic polyhedron:

Style a plot with GouraudShading:

Draw a 3D model with GouraudShading:

Scope  (14)

Basic Uses  (5)

Apply Gouraud shading to a graphics primitive:

Apply Gouraud shading to a plot:

Apply Gouraud shading to a chart:

Apply Gouraud shading to a 3D object:

Summary box:

Specification  (5)

GouraudShading with no arguments uses similar calculations 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 other attenuation factors to zero:

Attenuate the specular light, setting other attenuation factors to zero:

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

Lighting  (4)

GouraudShading works with all types of lights:

Use colored lights:

The specular percentage only applies if the Specularity directive has been specified:

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

Applications  (2)

Basic Applications  (2)

Interior face colors are linear combinations of the lighting calculated at each vertex:

This is equivalent to passing precomputed vertex lighting as the VertexColors with an ambient White light:

Show vertex normals:

Vertex normals of a triangle:

Triangle with perturbed normals:

Polyhedron with smooth normals:

Vertices are duplicated with different normals to create hard edges:

Properties & Relations  (3)

GouraudShading uses VertexNormals if specified:

Specify FaceForm with GouraudShading:

GouraudShading approximates the PhongShading when the screen size and shade variance across polygons are small:

Possible Issues  (1)

Lighting artifacts are visible along polygon borders:

Use a more refined mesh to reduce the differences between polygons:

Interactive Examples  (1)

Interactively drag the light position while rendering a triangle with GouraudShading applied. Notice that the color of the triangle is calculated by interpolating the light values at its corners:

Wolfram Research (2022), GouraudShading, Wolfram Language function, https://reference.wolfram.com/language/ref/GouraudShading.html.

Text

Wolfram Research (2022), GouraudShading, Wolfram Language function, https://reference.wolfram.com/language/ref/GouraudShading.html.

CMS

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

APA

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

BibTeX

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

BibLaTeX

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