Projective texture mapping is a method of texture mapping that allows a textured image to be projected onto a scene as if by a slide projector. Projective texture mapping is useful in a variety of lighting techniques and it is the starting point for shadow mapping.

Projective texture mapping is essentially a special matrix transformation which is performed per-vertex and then linearly interpolated as standard texture mapping.

Fixed function pipeline approach

edit

Historically[1], using projective texture mapping involved considering a special form of eye linear texture coordinate generation[2] transform (tcGen for short). This transform was then multiplied by another matrix representing the projector's properties which were stored in texture coordinate transform matrix[3]. The resulting concentrated matrix was basically a function of both projector properties and vertex eye positions.

The key points of this approach are that eye linear tcGen is a function of vertex eye coordinates, which is a result of both eye properties and object space vertex coordinates (more specifically, the object space vertex position is transformed by the model-view-projection matrix). Because of that, the corresponding texture matrix can be used to "shift" the eye properties so the concentrated result is the same as using an eye linear tcGen from a point of view which can be different from the observer.

Programmable pipeline approach

edit

A less involved method to compute this approach became possible with vertex shaders.

The previous algorithm can then be reformulated by simply considering two model-view-projection matrices: one from the eye point of view and the other from the projector point of view.

In this case, the projector model-view-projection matrix is essentially the aforementioned concentration of eye-linear tcGen with the intended projector shift function. By using those two matrices, a few instructions are sufficient to output the transformed eye space vertex position and a projective texture coordinate. This coordinate is simply obtained by considering the projector's model-view-projection matrix: in other words, this is the eye-space vertex position if the considered projector would have been an observer.

Caveats

edit

In both the proposed approaches there are two little problems which can be trivially solved and comes from the different conventions used by eye space and texture space.

Defining properties of those spaces is beyond the scope of this article but it's well known that textures should usually be addressed in the range [0..1] while eye space coordinates are addressed in the range [-1..1]. According to the used texture wrap mode various artifacts may occur but it's obvious a shift and scale operation is definitely necessary to get the expected result.

The other problem is actually a mathematical issue. It is well known the matrix math used produces a back projection. This artifact has historically been avoided by using a special black and white texture to cut away unnecessary projecting contributions. Using pixel shaders a different approach can be used: a coordinate check is sufficient to discriminate between forward (correct) contributions and backward (wrong, to be avoided) ones.

References

edit
  1. ^ The original paper from the nVIDIA web site includes all the needed documentation on this issue. The same site also contains additional hints.
  2. ^ Texture coordinate generation is covered in section 2.11.4 "Generating Texture Coordinates" from the OpenGL 2.0 specification. Eye linear texture coordinate generation is a special case.
  3. ^ Texture matrix is introduced in section 2.11.2 "Matrices" of the OpenGL 2.0 specification.
edit

📚 Artikel Terkait di Wikipedia

Texture mapping

Texture mapping is a term used in computer graphics to describe how 2D images are projected onto 3D models. The most common variant is the UV unwrap,

Cube mapping

which found widespread use in video games is projective texture mapping. It relies on cube maps to project images of an environment onto the surrounding

Subsurface scattering

nearest surface is stored. The depth map is then projected onto it using standard projective texture mapping and the scene re-rendered. In this pass, when

UV mapping

UV mapping in 3D graphics is a process for texture mapping a 3D model by projecting the model's surface coordinates onto a 2D image. The letters "U" and

Polynomial texture mapping

Polynomial texture mapping (PTM), also known as Reflectance Transformation Imaging (RTI), is a technique of imaging and interactively displaying objects

Texture filtering

In computer graphics, texture filtering or texture smoothing is the method used to determine the texture color for a texture mapped pixel, using the colors

Reflection mapping

entirely surpassed by cube mapping, in which the environment is projected onto the six faces of a cube and stored as six square textures or unfolded into six

UVW mapping

\mathbb {R} ^{2}} to a solid texture with UVW coordinates in R 3 {\displaystyle \mathbb {R} ^{3}} , in contrast to UV mapping, which maps surfaces in R 2