Warning This section not yet updated for Inkscape v0.92.

## Lighting Filters Primitives

Two primitives, Diffuse Lighting and Specular Lighting, are included to simulate light shining on objects. They represent two of the three parts of the Phong reflection model for modeling light in computer graphics. The three parts of the model are:

• Ambient light: The light present everywhere in a scene. In SVG this would be represented by a solid Fill.
• Diffuse light: The reflection of a light source off a surface that does not depend on the location of the observer. The intensity is a function of the angle between a line connecting the surface to a light source and a line normal to the surface.
• Specular light: The reflection of a light source off a surface that does depend on the location of the observer. For example, the highlights seen on shiny surfaces. The intensity is maximum when the angle between the normal to a surface and the light source is equal to the angle between the normal and the viewer.
An illustration of the components of the Phong model. From left to right: ambient light, diffuse light, specular light. All light sources combined. The diffuse and specular light source is the same, a red distant light coming from the upper left. The specular image has had a black background added to set off the specular light.

The Phong model does not take into account shadows that would be caused by one area of an object on another, that is it does not do ray tracing.

The contour of an object in the z (out of the drawing) direction is described by a bump map that is defined by the Alpha channel of an object. The values of the pixel and the neighboring pixels in the bump map define the normal to the surface for the pixel.

The two lighting filters share in common most of their attributes such as the type of light source, its color, and its position; thus we'll discuss them together.

• Diffuse Color, Specular Color: The color of the light source.
• Surface Scale: Sets the scale of the surface in order to calculate normals to the surface. The number represents the maximum height (corresponding to Alpha = 1.0) of the surface in the same units as x and y.
• Constant: Diffuse or Specular Reflection Constant: How much of the light that hits the surface is reflected diffusely or specularly. A value greater than 1.0 oversaturates the object.
• Exponent (Specular Lighting only): Determines how sharp or narrow the specular reflections are. A value of 1.0 (the minimum) suggests a dull surface with wide reflections; as the value increases, the surface appears more polished with narrower reflections.
• Kernel Unit Length (Unused): Sets the pixel size used to calculate the reflections (screen pixels are used by default).
• Light Source: One of three types of light: Distant Light, Point Light, or Spot Light (see below).

When applying a lighting filter with a large Surface Scale, the limited resolution of the bump map may create artifacts. These can be removed by applying a small amount of Gaussian blur to the image.

The limited resolution of the bump map has resulted in artifacts on the sphere on the left. A small amount of blurring has removed the artifacts on the sphere on the right (the sphere has also been clipped).
Warning This section not yet updated for Inkscape v0.92.

### Distant Light Source

This light source simulates a light at a large (infinite) distance from the illuminated object. The required attributes are:

• Azimuth: The direction (angle) of the light source in the drawing plane. The angle is defined in degrees from the horizontal (x) axis in the clockwise direction. Note that this does not match either angle definition used by Inkscape (see the section called “Transformations”). Recall that SVG uses a left-handed coordinate system where the positive y direction is down.
• Elevation: The direction (angle) of the light source above the drawing plane (in degrees).
Five spheres illuminated by Distant Light sources. The light from the left is a Specular reflection, while that on the right is a Diffuse reflection.
Warning This section not yet updated for Inkscape v0.92.

### Point Light Source

This light source simulates a point light source near an illuminated object. One triple set of numbers (x, y, z) is required to set the Location of the light. The units are in the coordinate system of the lit object. Note: z represents the distance out of the plane (toward the viewer of the SVG drawing) if x or y are not inverted.

Five spheres illuminated by Point Light sources. The light from the left is a Specular reflection while that on the right is a Diffuse reflection. The small red and blue circles indicate the positions of the light sources.
Warning This section not yet updated for Inkscape v0.92.

### Spot Light Source

This light source simulates a point light source near an illuminated object but with a limited cone of light. One triple set of numbers (x, y, z) is required to set the Location of the light and another to set the direction the center of the cone points (Points At). See previous section for the definition of the coordinate system. The Specular Exponent sets how well-focused is the light; the higher the value, the more sharply focused the light. The Cone Angle (degrees) defines the maximum angle for the light.

Five spheres illuminated by Spot Light sources. The light from the left is a Specular reflection, while that on the right is a Diffuse reflection. The small red and blue circles indicate the positions of the light sources. The lights are directed at each other. The cone angle is 25°.