A texture is a pair ''(g, h)'', where ''g'' is a continuous image, and ''h'' is a function ''RR^n -> RR'', called a detail filter.
A continuous image is a continuous function ''RR^n -> V'', where ''V'' is a vector space over the reals.
Given a texture T = (g, h), its texture sampler is a function
''f_T : RR^{n xx n} xx RR^n -> V : f_T(M, x) = ((h circ M^-1) ox g)(x)'',
where ''ox'' denotes convolution, and ''circ'' denotes composition.
An image (or a discrete image) is a function ''ZZ^n -> V'' where ''V'' is a vector space over the reals. Given an image ''d'', if we assume that it has been obtained by sampling some band-limited continuous image ''I'', it can be shown that
''I = D ox s'',
where
''D : RR^n -> V : D = sum {delta_x * d(x) | x in ZZ^n}''
''s : RR^n -> RR : s(x) = prod_{i = 1}^n text(sinc)(x_i)''
where
''delta_x'' is the delta distribution in ''RR^n'' centered on ''x''.
The ''s'' is called a reconstruction filter, and as an approximation can be replaced by other low-pass filters, particularly with those having bounded support. The process of forming I from D (or d) is called reconstruction.
Pastel provides the abstract Texture class template to model textures in ''RR^n''. It is defined by:
template <typename Type, int N = 2>
class Texture
: public ReferenceCounted
{
public:
typedef CountedPtr<Texture> Ptr;
typedef CountedPtr<const Texture> ConstPtr;
typedef Type Element;
virtual ~Texture() {}
virtual Type operator()(
const Vector<real, N>& p,
const Matrix<real, N, N>& m) const = 0;
virtual std::string name() const = 0;
};
where Type is a vector, such as Color, or real32, which defines the ''V'' in the definition, and N defines the dimensionality. Its abstract interface provides access to a texture sampler.
Pastel provides three types of concrete, predefined texture classes:
An image-based texture, whose continuous image has been reconstructed from an image. The different versions differ in the used reconstruction and detail filter.
A modifier texture, which modifies the values of an existing texture in some way, or combines the values of two or more existing textures to form a new one.
A synthetic texture, whose continuous image is computed on the fly via a mathematical formula.
A distortion texture, which distorts the texture space of an existing texture in some way.
The ideal reconstruction filter most often can not be used for computational purposes because it has an infinite support. Therefore, it is approximated by finite-support filters. However, for images it is the case that the visual quality which results from reconstructing with the ideal filter is very bad (the reconstruction can be done in restricted cases by using the Fourier transform): it exhibits so called ringing where each discontinuity is echoed to its neighborhood. Therefore finite-support filters are not used just for necessity but also for better-looking reconstructions.
An abstract class for textures