Projective texture mapping: Difference between revisions

Content deleted Content added
Narfhead (talk | contribs)
Tags: canned edit summary Mobile edit Mobile app edit Android app edit App section source
 
(9 intermediate revisions by 8 users not shown)
Line 1:
{{confusing|date=March 2012}}
{{Tone|date=April 2022}}
'''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 (mathematics)|matrix]] [[Coordinate system#Transformations|transformation]] which is performed per-vertex and then linearly interpolated as standard texture mapping.
 
{{ambox|text='''Highly technical reading'''<br/>The following content assumes the reader is confident with real time [[3D computer graphics]] and related technologies such as the involved processing in [[graphics processing unit]]s, with a basic mathematical background. Knowledge of the [[OpenGL]] API is encouraged, although not required.}}
 
== Fixed function pipeline approach ==
Historically{{ref|nvsdk_ptm}}, using projective texture mapping involved considering a special form of eye linear texture coordinate generation{{ref|glEyeLinear}} transform (''tcGen'' for short). This transform was then multiplied by another matrix representing the projector's properties which waswere stored in texture coordinate transform matrix{{ref|glTCXform}}. The resulting concatenatedconcentrated 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 concatenatedconcentrated 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 ==
A less involved method to compute this approach became possible with [[vertex shaders]]. Readers are encouraged to check this method is essentially the same as before.
For readers not familiar with this newer graphics technology, this feature allows to override the default vertex and pixel processing allowing a user defined program to be used.
 
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 concatenationconcentration 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.
 
Line 29 ⟶ 28:
 
== References ==
#{{note|nvsdk_ptm}} The [http://developerwww.nvidia.com/object/Projective_Texture_Mapping.html original paper] from the [http://developerwww.nvidia.com nVIDIA developer web site] includes all the needed documentation on this issue. The same site also contains [http://developerwww.nvidia.com/object/projective_texturesProjective_Texture_Mapping.html additional hints].
#{{note|glEyeLinear}} Texture coordinate generation is covered in section 2.11.4 "Generating Texture Coordinates" from the [http://www.opengl.org/documentation/specs/ OpenGL 2.0 specification]. Eye linear texture coordinate generation is a special case.
#{{note|glTCXFform}} Texture matrix is introduced in section 2.11.2 "Matrices" of the [http://www.opengl.org/documentation/specs/ OpenGL 2.0 specification].
 
== External Links links==
* http://www.3dkingdoms.com/weekly/weekly.php?a=20 A tutorial showing how to implement projective texturing using the programmable pipeline approach in OpenGL.