Donner 0.5.1
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
"<fePointLight>"

<fePointLight> is a positional light source — think of a bare light bulb floating in space.

It emits light in all directions from a single (x, y, z) point in the filter's coordinate system. Unlike "<feDistantLight>" (which has a single direction everywhere), the direction of a point light is different at every pixel of the surface, because each pixel sits at a different angle relative to the bulb.

The z coordinate controls how "high above" the surface the light sits. A large z puts the bulb far away so the illumination is soft and nearly uniform; a small z puts the bulb right up against the surface so you get a small, bright hotspot with harsh falloff toward the edges. <fePointLight> must appear as a child of "<feDiffuseLighting>" or "<feSpecularLighting>" — on its own it does nothing. It takes no standard filter primitive attributes.

Coordinate system

x and y are in the filter's user-space coordinates (the same space your shape is drawn in), and z points out of the screen toward the viewer.

+X +Y +Z (x, y, z) point light in filter space

Rendered examples

All examples below light the same blurred-alpha "sphere" bump (roughly 100 × 100 user units with the bump centred around x=50, y=50) using "<feDiffuseLighting>". Only the point light's (x, y, z) changes.

(50,50,100) (50,50,20) close (20,20,50) up-left (80,80,50) down-right

<filter id="MyFilter">
<feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur" />
<feDiffuseLighting in="blur" surfaceScale="6" diffuseConstant="1.4" lighting-color="white">
<fePointLight x="50" y="50" z="100" />
</feDiffuseLighting>
</filter>

Compare the centred lights: at z=100 the whole bump is lit roughly evenly with a gentle centre-brightness; at z=20 the bulb has moved down almost onto the surface, producing a harsh, pinpoint-bright centre with the edges falling into shadow. Moving (x, y) off-centre walks the hotspot around the bump, the same way moving a flashlight over a ball would.

Usage

<fePointLight> can be used as the child of either "<feDiffuseLighting>" (matte shading) or "<feSpecularLighting>" (glossy highlights). See those pages for the full lighting pipelines. For parallel light (no position, only direction) see "<feDistantLight>", and for a cone-shaped light see "<feSpotLight>".

Attributes
Attribute Default Description
x 0 X coordinate of the light in the filter's coordinate system.
y 0 Y coordinate of the light.
z 0 Z coordinate (height above the surface). Larger values produce softer, more uniform light; smaller values produce a bright hotspot with sharp falloff.

<fePointLight> does not take the standard filter primitive attributes (in, result, x, y, width, height) — it is purely a child element of a lighting primitive.