[0001] The invention relates to a method of computing a pixel value for a pixel in a texture
mapped computer graphics image.
[0002] Texture mapping and bump mapping are mapping techniques for increasing the realism
of computer graphics images. These mapping techniques are used to create color patterns
and visual effects of unevenness in an image part that shows a surface, which is modeled
as a flat polygon in three-dimensional space. These mapping techniques use an approximation
to compute the image. A two-dimensional map (the texture map or the bump map) is provided,
for example as an array of values stored in computer memory. Each location on the
surface is assigned to a location in the map. When the pixel value of a pixel in the
image is computed, one computes which location on the surface is visible in the pixel
and determines the pixel value from the value stored in the two dimensional map for
the location in the map which is assigned to that location on the surface. In case
of a texture map, a color value (e.g. RGB combination) from the map is used to compute
a surface color. In case of a bump map, a local surface orientation is determined
from the bump map and this orientation is used to compute visible reflections from
the surface.
[0003] Texture mapping and bump mapping increase the sense of realism that is experienced
when viewing the image. A further increase can be realized by including parallax effects.
This is realized for example in PCT patent application No. WO 98/92911 (by the same
inventor) which creates a parallax effects by combining information from two texture
maps for one surface, where the two texture maps are offset to one another in a direction
normal to the surface. In WO 98/22911 it is proposed to apply two texture maps where
one texture map (A) is shifted in a view-dependent direction and view-dependent amount
with respect to the other texture map (B). In combination with that, the other texture
map (B) is made transparent in some places to show the one texture map (A) (e.g. a
window in a brick wall lies somewhat deeper, so the brick texture (B) has a hole in
the place where the window texture (A) should come. Thanks to shifting the texture
map (A), the window appears to lay deeper due to parallax.) This gives a pseudo-3D
effect in a much cheaper way than having to model the actual 3-D geometry.
[0004] It is an object of the invention to provide a method and apparatus for generating
computer graphics images with additional realism.
[0005] The method according to the invention is set forth in Claim 1. According to the invention,
the surface texture in a pixel is determined from the content of the texture map at
a texture map location. The texture map location is determined by applying an offset
to a location in the texture map that is assigned to the surface location which is
visible in the pixel. The offset is determined from a surface height for the surface
location, as determined from a displacement map. Thus, a parallax in the texture is
simulated. The parallax corresponds to unevenness of the surface as described by the
displacement map.
[0006] The parallax also depends on the current viewing direction relative to the local
normal vector. So in order to compute the offset, both the surface height and the
viewing parameters are taken into account.
[0007] Preferably, the computation of parallax from the displacement map is combined with
computation of angular dependence of reflections (specular and/or diffuse reflections)
and/or shadows cast from the unevenness described by the displacement map. The computation
of parallax effect will automatically account for some effects of occlusion: hiding
of certain surface details by other surface details.
[0008] The invention also relates to an apparatus with computer graphics capability that
is structured and/or programmed to perform the method according to the invention.
[0009] These and other advantageous aspects of the invention will be described by way of
non-limitative example using the following figures, wherein
Fig. 1 shows a computer graphic apparatus
Fig. 2 shows an example of a two-dimensional cross-section of a three dimensional
space
Fig. 3 illustrates the parallax effect caused by height variations.
[0010] Figure 1 shows a computer graphics apparatus. The apparatus contains a pixel control
unit 10 coupled to a model memory 11. An output of the pixel control unit 10 is coupled
to an offset generator 12 and a displacement map memory 13. The displacement map memory
13 is coupled to the offset generator 12. The offset generator 12 has an output coupled
to a texture memory 15 and a pixel value generator 14. The texture memory 15 has an
output coupled to the pixel value generator 14. The pixel generator has an output
to a display unit 16, which also has an input to the pixel control unit 10.
[0011] In operation, the pixel control unit 10 visits a number of pixels. By way of example,
the pixel control unit 10 successively visits spatially successive pixels along a
scan line of an image. The pixel control unit 10 signals the location of the pixel
being visited to the display unit 16, e.g. by means of a pixel clock that signals
advance along the scan line.
[0012] Figure 2 shows an example of a two-dimensional cross-section of a three dimensional
space that contains an object described by model. The cross-section shows two surfaces
20, 22 in cross-section. In addition, a viewpoint 23 is shown and a line of sight
24 from the viewpoint 23 to one of the surfaces 20. The line of sight 24 intersects
this surface 20 at a surface location 25.
[0013] A displacement map is provided at least for the first surface 20. The displacement
map defines a height profile 26 for this surface 20. The height profile 26 corresponds
for example to displacement of each surface location by a location dependent amount
along the normal of the surface at that surface location.
[0014] The location dependent amount is specified for example by means of a function of
two-dimensional coordinates. Values of this function for different coordinates may
be stored as an array of values in the displacement map memory 13. The model specifies
the function that is to be used for each surface 20, 22. The model also specifies
a relation between on one hand two dimensional coordinates are used as arguments for
the function and on the other hand surface coordinates of locations on the surface
20, 22. Thus, a function value is assigned to each location on the surface.
[0015] The pixel control unit 10 determines which modeled surface 20 is visible at a visited
pixel. The pixel control unit 10 also determines the two-dimensional coordinates of
the surface location 25 that is visible at the pixel. From this information, the pixel
control unit 10 determines an address to retrieve the appropriate displacement map
value from the displacement map memory 13. The pixel control unit 10 thereupon accesses
the displacement map memory 13, to obtain a displacement map value for the visible
surface 20 at the coordinates of the surface location 25. The pixel control unit 10
also determines the normal to the surface 20 at this surface location 25. The pixel
control unit 10 signals an indication of the coordinates and the normal to the offset
generator 14.
[0016] The offset generator 14 receives an indication of the visible surface 20 and the
surface coordinates of the surface location. The offset generator 14 applies an offset
to the surface coordinates.
[0017] The resulting surface coordinates and an indication of the modeled surface 20 that
is visible are used to address the texture map memory 15. The texture map memory 15
stores texture map values that describe for example a color pattern of location dependent
light reflected from the surface (optionally the texture map is also normal vector
orientation dependent; in this case the normal vector is also used to address texture
map memory 15). In response to addressing from the offset generator 12 the texture
map memory 15 provides a texture value for the location 25 that is visible for at
visited pixel.
[0018] The pixel value generator 14 uses the texture map value and the normal to the surface
to compute the pixel value of the visited pixel. This pixel value is passed to the
display unit 16, for display on a display screen at a pixel location defined by the
visited pixel. Preferably, the display unit 16 stores the pixel value in a frame buffer
(not shown) at a location determined by the coordinates of the visited pixel, for
later display on a display screen.
[0019] As mentioned, the offset generator 14 applies an offset to the surface coordinates.
The offset accounts for a parallax effect corresponding to height variations of the
surface 20 as defined by the displacement map.
[0020] Figure 3 illustrates the parallax effect caused by height variations. A surface 30
is shown in cross-section, with a height profile 32. A line of sight 34 intersects
the surface 30 at a first surface location 35. It intersects the height profile 32
at a profile location 36. The profile location 36 corresponds to a second surface
location 37, obtained by displacing the profile location 36 along the normal to the
surface. Without parallax, the texture for the first surface location 35 would be
visible along the line of sight 34. Due to parallax, the texture for the second surface
location 37 will be visible along the line of sight 34. That is, the surface coordinate
for which a texture value is obtained is offset from the surface of the coordinates
of the first location 35 by a vector D, where

[0021] Here "h" is the displacement along the normal defined by the displacement map for
the second location 37, and Pe is a projection onto the surface 30 of a normal vector
"e" in the direction of the line of sight 34. In general, the offset will be small
compared with the variation of the displacement "h" along the surface 30 and therefore
a reasonable approximation of the parallax can be obtained by taking the displacement
h for the first surface location 35 instead of that for the second surface location
37.
[0022] In any case, the offset does not need to be computed with extreme precision in order
to create a convincing visual impression of an uneven surface. A convincing visual
impression is created by this approximation, or similar approximations, because the
approximation normally provides a parallax in the right direction and with an amplitude
that is responsive to height variation.
[0023] The offset generator 14 applies offsets to the surface coordinates of visited pixels.
The offset generator 14 determines the offset dependent on the displacement map height
value h that is obtained35 from the displacement map memory 13 for the first surface
location 35 where the line of sight 34 from the visited pixel intersects the flat
modeled surface 30. The offset generator 14 adds this offset to received coordinates
of the first surface location 35. The offset generator 14 applies the resulting coordinates
as an address to texture memory 15. Pixel value generator 16 uses the addressed content
of texture memory 15 to generate a pixel value. Thus, the pixel value corresponds
to a texture that is locally offset by the offset computed by the offset generator
14.
[0024] Preferably, the pixel control unit 10 computes the normal to the surface by interpolation
of values of the normal for the corners of the surface, as is known for shading calculations
such as Phong shading, so that the normal may vary over the surface. The interpolated
normal that is used for computing reflected light intensity preferably is also used
to compute the offset in the offset generator 14. Thus, there will be no visible jumps
in parallax at the junctions between different surfaces that are used to model objects.
[0025] Of course, the implementation described above is merely an example of how the invention
can be applied. Many variations are conceivable, such as implementation of the different
units 10, 12, 14 in a suitably programmed computer, and/or implementation of one or
more of the different memories 11, 13, 15 as different regions in a larger memory.
Other variations include computing displacement map and/or texture values from a function
instead of obtaining them from memory. Similarly, instead of using flat surfaces to
model the shape of an object one may use curved surfaces, such as Bezier triangles
or implicit surfaces as a model to compute the points of intersection, surface coordinates
etc.
[0026] By accounting for parallax, some effect of occlusion (disappearance of some surface
detail behind a different surface part) is automatically accounted for. If desired,
a further computation of occlusion may be included to increase the experienced realism
of the image.
[0027] Preferably, the application of an offset to suggest parallax is combined with computations
to account for effects of unevenness such as the casting of shadows and/or surface
orientation dependent reflection (preferably both diffuse and specular reflection).
To a considerable extent, these computations use the same information about the surface
(surface coordinates, normals, displacement maps) as the computation of parallax.
Therefore, computation of parallax can be added to these computations without much
computational overhead. When combined in a consistent way (i.e. using the same displacement
map), the combination of the effects increases the experienced realism of surfaces.
1. A method of computing a pixel value for a pixel in a texture mapped computer graphics
image, the method comprising:
- defining a surface (20, 30) in a three dimensional space, to which a texture is
to be applied;
- defining a texture map having texture values and a corresponding displacement map
having displacement map values (32), the displacement map representing a height profile
for said surface, the displacement map values being displacements of each surface
location by a location dependent amount along the normal of the surface at that surface
location;
- computing surface coordinates for a location of intersection (35) of the surface
(30) with a line of sight (34) for the pixel;
- computing a surface coordinate offset vector that represents a change in the surface
coordinates of said intersection (35), the surface coordinate offset vector being
dependent on the displacement map value at the location of said intersection (35);
- modifying said surface coordinate of said location of intersection (35) by said
offset vector, and
- computing a pixel value for the pixel in the computer graphics image from a texture
value defined at said modified location of intersection (37), thereby simulating parallax
effects.
2. A method according to claim 1, also comprising computation of angular dependence of
reflected light intensity from the surface (30), dependent on a surface orientation
modified in correspondence with said displacement map values.
3. A method according to claim 2, wherein said displacement map value defined for said
surface coordinates offset by said offset vector is used for computing angular dependence
of the reflected light intensity.
4. A method according to claim 2, also comprising computation of shadows cast from unevenness
of the surface (30) in correspondence with said displacement map values.
5. A texture mapped computer graphics image generator comprising:
- a surface model input for receiving model that defines a surface (30) in a three
dimensional space, to which a texture is to be applied;
- a texture map memory for storing a texture map that defines texture values and a
corresponding displacement map having displacement map values (32), the displacement
map representing a height profile for said surface, the displacement map values being
displacements of each surface location by a location dependent amount along the normal
of the surface at that surface location;
- a processing circuit arranged for:
- computing surface coordinates for a location of intersection (35) of the surface
(30) with a line of sight (34) for the pixel;
- computing a surface coordinate offset vector that represents a change in the surface
coordinates of said intersection (35), the surface coordinate offset vector being
dependent on the displacement map value at the location of said intersection (35);
- modifying said surface coordinate of said location of intersection (35) by said
offset vector; and
- computing a pixel value for the pixel in the computer graphics image from a texture
value defined at said modified location of intersection (37), thereby simulating parallax
effects.
6. A generator according to claim 5, the processing circuit being arranged to determine
an angular dependence of reflected light intensity from the surface (30), dependent
on a surface orientation modified in correspondence with said displacement map values.
7. A generator according to claim 6, wherein said displacement map value defined for
said surface coordinates offset by said offset vector is used for computing angular
dependence of the reflected light intensity.
8. A generator according to claim 6, the processing circuit being arranged to compute
an effect of shadows cast from unevenness of the surface in correspondence with said
displacement map values.
1. Verfahren zum Berechnen eines Pixelwerts für ein Pixel in einem Computergrafikbild
mit Texturabbildung, wobei das Verfahren umfasst:
- das Definieren einer Oberfläche (20, 30) in einem dreidimensionalen Raum, auf welche
eine Textur angewandt werden soll;
- das Definieren einer Texture Map, die Texturwerte aufweist, und einer entsprechenden
Displacement Map, die Displacement Map-Werte (32) aufweist, wobei die Displacement
Map ein Höhenprofil für diese Oberfläche darstellt, wobei die Displacement Map-Werte
Verschiebungen jeder Oberflächenposition um eine positionsabhängige Menge entlang
der Normalen der Oberfläche an dieser Oberflächenposition sind;
- das Berechnen von Oberflächenkoordinaten für eine Schnittpunktposition (35) der
Oberfläche (30) mit einer Sichtlinie (34) für das Pixel;
- das Berechnen eines Oberflächenkoordinatenversatzvektors, der eine Änderung in den
Oberflächenkoordinaten des Schnittpunkts (35) darstellt, wobei der Oberflächenkoordinatenversatzvektor
vom Displacement Map-Wert an der Position des Schnittpunkts (35) abhängig ist;
- das Modifizieren der Oberflächenkoordinate der Schnittpunktposition (35) um diesen
Versatzvektor; und
- das Berechnen eines Pixelwerts für das Pixel im Computergrafikbild anhand eines
Texturwerts, der an dieser modifizierten Schnittpunktposition (37) definiert ist,
wodurch Parallaxeeffekte simuliert werden.
2. Verfahren nach Anspruch 1, auch umfassend das Berechnen der Winkelabhängigkeit der
von der Oberfläche (30) reflektierten Lichtstärke, die abhängig ist von einer Oberflächenorientierung,
die den Displacement Map-Werten entsprechend modifiziert wird.
3. Verfahren nach Anspruch 2, wobei der Displacement Map-Wert, der für die Oberflächenkoordinaten
definiert ist, um den Versatzvektor versetzt ist, der verwendet wird, um die Winkelabhängigkeit
der reflektierten Lichtstärke zu berechnen.
4. Verfahren nach Anspruch 2, auch umfassend das Berechnen von Schatten, die von Unebenheiten
der Oberfläche (30) den Displacement Map-Werten entsprechend geworfen werden.
5. Computergrafikbildgenerator mit Texturabbildung, umfassend:
- einen Oberflächenmodelleingang zum Empfangen des Modells, das eine Oberfläche (30)
in einem dreidimensionalen Raum definiert, auf welche eine Textur anzuwenden ist;
- einen Texture Map-Speicher zum Speichern einer Texture Map, die Texturwerte definiert,
und einer entsprechenden Displacement Map, die Displacement Map-Werte (32) aufweist,
wobei die Displacement Map ein Höhenprofil für diese Oberfläche darstellt, wobei die
Displacement Map-Werte Verschiebungen jeder Oberflächenposition um eine positionsabhängige
Menge entlang der Normalen der Oberfläche an dieser Oberflächenposition sind;
- eine Verarbeitungsschaltung, angeordnet zum:
- Berechnen der Oberflächenkoordinaten für eine Schnittpunktposition (35) der Oberfläche
(30) mit einer Sichtlinie (34) für das Pixel;
- Berechnen eines Oberflächenkoordinatenversatzvektors, der eine Änderung in den Oberflächenkoordinaten
dieses Schnittpunkts (35) darstellt, wobei der Oberflächenkoordinatenversatzvektor
vom Displacement Map-Wert an der Position des Schnittpunkts (35) abhängig ist;
- Modifizierens der Oberflächenkoordinate und der Schnittpunktposition (35) um diesen
Versatzvektor; und
- Berechnens eines Pixelwerts für das Pixel im Computergrafikbild anhand eines Texturwerts,
der an dieser modifizierten Schnittpunktposition (37) definiert ist, wodurch Parallaxeeffekte
simuliert werden.
6. Generator nach Anspruch 5, wobei die Verarbeitungsschaltung angeordnet ist, um eine
Winkelabhängigkeit der von der Oberfläche (30) reflektierten Lichtstärke zu bestimmen,
abhängig von einer Oberflächenorientierung, die den Displacement Map-Werten entsprechend
modifiziert wurde.
7. Generator nach Anspruch 6, wobei der Displacement Map-Wert, der für die Oberflächenkoordinaten
definiert ist, die um diesen Versatzvektor versetzt wurden, verwendet wird, um die
Winkelabhängigkeit der reflektierten Lichtstärke zu berechnen.
8. Generator nach Anspruch 6, wobei die Verarbeitungsschaltung angeordnet ist, um einen
Effekt von Schatten zu berechnen, die von Unebenheiten der Oberfläche den Displacement
Map-Werten entsprechend geworfen werden.
1. Procédé pour calculer une valeur de pixel pour un pixel dans une image infographique
de projection de texture, le procédé comprenant:
- la définition d'une surface (20, 30) dans un espace tridimensionnel sur laquelle
une texture doit être appliquée;
- la définition d'une projection de texture ayant des valeurs de texture et une carte
de déplacement correspondante ayant des valeurs de carte de déplacement (32), la carte
de déplacement représentant un profil vertical pour ladite surface, les valeurs de
carte de déplacement étant des déplacements de chaque emplacement de surface par une
quantité étant dépendante de l'emplacement le long de la normale de la surface à cet
emplacement de surface;
- le calcul de coordonnées de surface pour un emplacement d'intersection (35) de la
surface (30) avec une ligne de visée (34) pour le pixel;
- le calcul d'un vecteur de décalage de la coordonnée de surface qui représente un
changement des coordonnées de surface de ladite intersection (35), le vecteur de décalage
de la coordonnée de surface étant dépendant de la valeur de carte de déplacement à
l'emplacement de ladite intersection (35);
- la modification de ladite coordonnée de surface dudit emplacement d'intersection
(35) par ledit vecteur de décalage; et
- le calcul d'une valeur de pixel pour le pixel dans l'image infographique à partir
d'une valeur de texture qui est définie audit emplacement d'intersection (37), de
ce fait simulant des effets de parallaxe.
2. Procédé selon la revendication 1, comprenant également le calcul d'une dépendance
angulaire de l'intensité de la lumière qui est réfléchie à partir de la surface (30)
dépendamment d'une orientation de surface qui est modifiée en rapport avec lesdites
valeurs de carte de déplacement.
3. Procédé selon la revendication 2, dans lequel ladite valeur de carte de déplacement
qui est définie pour ledit décalage de coordonnées de surface par ledit vecteur de
décalage est utilisée pour calculer la dépendance angulaire de l'intensité de la lumière
réfléchie.
4. Procédé selon la revendication 2, comprenant également le calcul d'une projection
d'ombres en provenance de l'inégalité de la surface (30) en rapport avec lesdites
valeurs de carte de déplacement.
5. Générateur d'image infographique de projection de texture comprenant:
- une entrée du modèle de surface pour recevoir un modèle qui définit une surface
(30) dans un espace tridimensionnel sur laquelle une texture doit être appliquée;
- une mémoire de projection de texture pour stocker une projection de texture qui
définit des valeurs de texture et une carte de déplacement correspondante ayant des
valeurs de carte de déplacement (32), la carte de déplacement représentant un profil
vertical pour ladite surface, les valeurs de carte de déplacement étant des déplacements
de chaque emplacement de surface par une quantité étant dépendante de l'emplacement
le long de la normale de la surface à cet emplacement de surface;
- un circuit de traitement qui est agencé pour:
- calculer des coordonnées de surface pour un emplacement d'intersection (35) de la
surface (30) avec une ligne de visée (34) pour le pixel;
- calculer un vecteur de décalage de la coordonnée de surface qui représente un changement
des coordonnées de surface de ladite intersection (35), le vecteur de décalage de
la coordonnée de surface étant dépendant de la valeur de carte de déplacement à l'emplacement
de ladite intersection (35);
- modifier ladite coordonnée de surface dudit emplacement d'intersection (35) par
ledit vecteur de décalage; et
- calculer une valeur de pixel pour le pixel dans l'image infographique à partir d'une
valeur de texture qui est définie audit emplacement d'intersection (37), de ce fait
simulant des effets de parallaxe.
6. Générateur selon la revendication 5, le circuit de traitement étant agencé de manière
à déterminer une dépendance angulaire de l'intensité de la lumière qui est réfléchie
à partir de la surface (30) dépendamment d'une orientation de surface qui est modifiée
en rapport avec lesdites valeurs de carte de déplacement.
7. Générateur selon la revendication 6, dans lequel ladite valeur de carte de déplacement
qui est définie pour ledit décalage de coordonnées de surface par ledit vecteur de
décalage est utilisée pour calculer la dépendance angulaire de l'intensité de la lumière
réfléchie.
8. Générateur selon la revendication 6, le circuit de traitement étant agencé de manière
à calculer un effet de projection d'ombres à partir d'une inégalité de la surface
en rapport avec lesdites valeurs de carte de déplacement.