Home

perspectivecorrect

Perspective-correct interpolation is a technique in computer graphics used to interpolate attributes across a polygon in screen space so that the results are consistent with the scene’s perspective projection. It is essential for rendering textures and other per-vertex attributes without introducing geometric distortion when parts of a polygon lie at different depths.

The core idea is that affine interpolation in screen space does not align with perspective, causing textures

In practice, this method is most commonly applied to texture coordinates (u, v) to produce undistorted texturing,

Advantages of perspective-correct interpolation include accurate texture mapping and reduced distortion in projected geometry. Limitations are

Historically, perspective correction became standard with the advent of texture mapping and modern rasterization pipelines, where

and
colors
to
appear
warped.
To
achieve
perspective
correctness,
attributes
are
first
divided
by
the
homogeneous
depth
(or
w)
at
each
vertex.
For
a
vertex
i
with
attribute
a_i
and
depth
w_i,
compute
a_i'
=
a_i
/
w_i
and
w_i'
=
1
/
w_i.
During
rasterization,
a_i'
and
w_i'
are
interpolated
linearly
across
the
triangle
using
the
usual
barycentric
weights.
At
a
fragment,
the
original
attribute
is
recovered
as
a
=
a'/w'.
but
it
also
applies
to
other
per-vertex
attributes
such
as
colors
and
normals.
Modern
GPUs
perform
perspective-correct
interpolation
automatically
within
the
rasterization
pipeline,
ensuring
accurate
texture
mapping
and
shading
on
polygons
of
varying
depth.
primarily
numerical:
finite
precision
can
introduce
artifacts,
especially
on
very
large
triangles
or
when
depth
buffers
have
limited
precision.
Some
systems
offer
affine
interpolation
as
a
faster
but
less
accurate
alternative
when
performance
is
critical
or
when
depth
variation
is
minimal.
it
is
implemented
as
part
of
the
rendering
hardware
and
shader
stages.