lighting
Selects the lighting method used to shade surfaces and patches.
Category: Graphics > Formatting and Annotation
Syntax
lighting flat
Computes one shade per face. Fast, shows the facets.
lighting gouraud
Interpolates the shade smoothly across each face, giving the best look on curved surfaces.
lighting none
Turns the lights off for the surfaces.
lighting(ax, option)
Applies the option to the axes ax.
Description
lighting sets the face and edge lighting mode of every surface and patch in the axes. The result shows only when a light exists, which you add with light, lightangle or camlight.
Gouraud shading looks smooth because it blends the colors computed at the vertices. Flat shading is quicker and is often the better choice to see the shape of a coarse mesh.
Input arguments
option- One of
'flat','gouraud','none'.
Example
Smooth lighting on a sphere
[x, y, z] = sphere(30);
s = surf(x, y, z);
shading flat
lighting gouraud
camlight
axis equal
class(s)
Output
ans = 'matlab.graphics.chart.primitive.Surface'