The Texture Mapper
The procedure of texture mapping
has always seemed to me most attractive because
of its obvious complexity, its arcane sense
of mystery and the fact that to produce one
requires incredible patience and a little knowledge
of the correct method of constructing 3D engines.
I have experimented with simple textures from
the beginning: even my first effort, using BGI
graphics, gave the polygons a semblance of texture
by shading them using the standard BGI routines.
Later I started to endeavour to give the polygons
the vague appearance of a given image, whilst
maintaining the speed of my polygon code by
only writing in optimised assembler. Soon after
this point, however, I realised that chance
experimentation was futile: a methodical approach
was required for true texture mapping, and no
subtle shortcuts would give the sense of tangible
solidity that genuine texture mapping gives.
Again, I began to systematically considering
the process of texture mapping; and it is this
process which I am going to attempt to document
here, as well as producing a record of my eventual
success. It should be noted that I have absolutely
zero knowledge of the correct, conventional
or accepted method of texture mapping; and there
is no guarantee that my method is the fastest
or the best optimised. I devised it purely on
my own intuitive reasoning, and an ordered approach
to the problem; and on the terms on which I
designed it, the texture mapper now functions.
Hence, first for consideration is the problem
itself; what is texture mapping, and how can
it be symbolically represented in a 3D engine?
Texture mapping is, as far as I understand it,
the mapping of an image, usually of fixed size
to aid optimisation, onto a mobile polygon that
can be plotted as part of a 3D engine. If it
works correctly, the texture itself should appear
to move and scale in 3D realistically, and hence
allow far more life-like objects to be represented
in the engine. The polygons must be completely
mutable, to ensure their flexibility withing
the engine; and in addition, the texture should
be associated with the edges of the polygon
as if it were a 3D object; that is, the edges
of the texture remain in contact with the same
edges of the polygon, however the polygon is
rotated or manipulated.