JP2006244426A - Texture processing device, picture drawing processing device, and texture processing method - Google Patents

Texture processing device, picture drawing processing device, and texture processing method Download PDF

Info

Publication number
JP2006244426A
JP2006244426A JP2005063113A JP2005063113A JP2006244426A JP 2006244426 A JP2006244426 A JP 2006244426A JP 2005063113 A JP2005063113 A JP 2005063113A JP 2005063113 A JP2005063113 A JP 2005063113A JP 2006244426 A JP2006244426 A JP 2006244426A
Authority
JP
Japan
Prior art keywords
texture
dimensional
parameter
texel
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2005063113A
Other languages
Japanese (ja)
Inventor
Takahiro Oguchi
貴弘 小口
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sony Interactive Entertainment Inc
Original Assignee
Sony Computer Entertainment Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sony Computer Entertainment Inc filed Critical Sony Computer Entertainment Inc
Priority to JP2005063113A priority Critical patent/JP2006244426A/en
Priority to PCT/JP2005/022536 priority patent/WO2006095481A1/en
Publication of JP2006244426A publication Critical patent/JP2006244426A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/04Texture mapping

Abstract

<P>PROBLEM TO BE SOLVED: To solve a problem wherein management of resources is not easy because various textures are used by a texture mapping method. <P>SOLUTION: A picture drawing computation processing part 34 of a shader unit 30 issues a texture command for specifying three-dimensional texel coordinate values (u, v, w) for referring to a texture structural body 52 for a texture unit 70. A texture reading part 76 of the texture unit 70 receives the three-dimensional texel coordinate values (u, v, w) from the shader unit 30 and reads texel values corresponding to two-dimensional texel coordinates (u, v) corresponding to the third texel coordinate value w in the texture structural body 52. A filter 74 interpolates a texel value read by the texture reading part 76 in accordance with filtering mode set in a register file 72 and provides an interpolated value to the picture drawing computation processing part 34 of the shader unit 30. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

この発明は、描画データを演算処理するテクスチャ処理装置、描画処理装置、およびテクスチャ処理方法に関する。   The present invention relates to a texture processing device, a drawing processing device, and a texture processing method for performing arithmetic processing on drawing data.

3次元コンピュータグラフィックスでは、一般的に3次元空間のオブジェクトを多数のポリゴンにより表現するポリゴンモデルが利用される。ポリゴンモデルの描画処理において、光源、視点位置、物体表面の反射率などを考慮してポリゴン表面に陰影をつけるシェーディングが行われる。また、写実性の高い画像を生成するために、ポリゴンモデルの表面にテクスチャ画像を貼り付けるテクスチャマッピングが行われる。   In the three-dimensional computer graphics, a polygon model that expresses an object in a three-dimensional space with a large number of polygons is generally used. In the polygon model drawing process, shading is performed to shade the polygon surface in consideration of the light source, the viewpoint position, the reflectance of the object surface, and the like. Further, in order to generate an image with high realism, texture mapping is performed in which a texture image is pasted on the surface of the polygon model.

テクスチャマッピングに使われるテクスチャは、通常は2次元テクスチャであるが、より質感の高い表現をするために、奥行き方向にもテクスチャをもたせたボリュームテクスチャが使われることがある。ボリュームテクスチャは、描画対象物の断面を描画したり、雲や炎のような3次元構造をもつ描画対象物や半透明の描画対象物にテクスチャをマッピングするために用いられる。   The texture used for texture mapping is usually a two-dimensional texture, but a volume texture with a texture in the depth direction may be used in order to express a higher texture. The volume texture is used for drawing a cross section of the drawing object, or mapping the texture to a drawing object having a three-dimensional structure such as a cloud or a flame or a translucent drawing object.

また、周囲の環境をテクスチャとして描画表面に映り込ませる環境マッピングが行われることがある。描画対象物を囲む仮想立方体の各面に環境テクスチャをあらかじめ投影しておき、立方体の各面の環境テクスチャを描画表面に写像するキューブ環境マッピングでは、環境テクスチャは6面のキューブマップの構成になる。   In addition, environment mapping may be performed in which the surrounding environment is reflected on the drawing surface as a texture. In cube environment mapping in which an environment texture is projected in advance on each surface of a virtual cube surrounding a drawing object, and the environment texture of each surface of the cube is mapped onto the drawing surface, the environment texture has a six-sided cube map configuration. .

このように、テクスチャマッピングの手法によってテクスチャにはいろいろな種類があり、その手法に特有のテクスチャ演算を専用に実行できるハードウエアを設けると、描画処理装置の回路規模が大きくなり、装置コストが高くなる。また、テクスチャマッピング手法に応じてハードウエアを構成すると、レジスタやメモリなどの資源管理も複雑になる。また、各種テクスチャを利用するために特有のパラメータを設定したり、特有の命令を実行するなど、プログラミングの手間もかかる。   As described above, there are various types of textures depending on the texture mapping method, and if hardware that can execute dedicated texture operations specific to the method is provided, the circuit scale of the drawing processing device increases and the device cost increases. Become. Further, if hardware is configured according to the texture mapping method, resource management such as registers and memories becomes complicated. In addition, it takes time and effort for programming such as setting specific parameters to use various textures and executing specific commands.

本発明はこうした課題に鑑みてなされたものであり、その目的は、各種テクスチャを統一的に利用することができるリソース管理の面で優れた描画処理技術を提供することにある。また、別の目的は、複数のテクスチャを効率良く切り替えて利用することのできる描画処理技術を提供することにある。   The present invention has been made in view of these problems, and an object of the present invention is to provide a drawing processing technique that is excellent in terms of resource management, in which various textures can be used uniformly. Another object is to provide a drawing processing technique capable of efficiently switching and using a plurality of textures.

上記課題を解決するために、本発明のある態様のテクスチャ処理装置は、テクスチャに関する値を2次元パラメータ座標に対応づけてテクセル値として格納した2次元テクスチャが複数設けられ、前記複数の2次元テクスチャの少なくとも1つを指定するための第3パラメータが前記2次元パラメータ座標における第1および第2パラメータとは別に設けられたテクスチャ構造体を格納するテクスチャ記憶部と、描画対象物の表面に適用されるテクスチャについて前記第3パラメータの指定と前記表面上の2次元パラメータ座標値の指定とを受け、前記テクスチャ構造体の内、指定された前記第3パラメータに対応する前記2次元テクスチャから、指定された前記2次元パラメータ座標値に対応するテクセル値を読み出すテクスチャ読み出し部と、読み出された前記テクセル値を補間して、前記描画対象物の表面に適用されるテクスチャに関する値を算出するフィルタとを含む。前記第3パラメータとして、前記テクスチャ構造体に含まれる前記複数の2次元テクスチャ間の関連性に応じた値が指定されることにより、異なる種類の前記テクスチャ構造体が統一的に参照される。   In order to solve the above-described problem, a texture processing apparatus according to an aspect of the present invention includes a plurality of two-dimensional textures in which values relating to texture are stored as texel values in association with two-dimensional parameter coordinates. A third parameter for designating at least one of the above is applied to the texture storage unit storing the texture structure provided separately from the first and second parameters in the two-dimensional parameter coordinates, and to the surface of the drawing object The texture is designated from the two-dimensional texture corresponding to the designated third parameter in the texture structure by receiving the designation of the third parameter and the designation of the two-dimensional parameter coordinate value on the surface. Texture reading that reads out the texel value corresponding to the two-dimensional parameter coordinate value If, by interpolating the texel values read, and a filter for calculating a value relating to a texture applied to the surface of the drawing object. By specifying a value corresponding to the relationship between the plurality of two-dimensional textures included in the texture structure as the third parameter, different types of the texture structures are uniformly referred to.

ここで、テクスチャが描画対象物の表面に適用されるとは、テクスチャのカラー値などが描画面にマッピングされることの他、テクスチャに関する値、たとえば法線ベクトルの値や関数値などが描画面に適用されることも含む趣旨である。   Here, texture is applied to the surface of the drawing object when texture color values are mapped to the drawing surface, as well as texture-related values such as normal vector values and function values. It is also intended to be applied to.

本発明の別の態様は、描画処理装置である。この装置は、テクスチャに関する値を2次元パラメータ座標に対応づけてテクセル値として格納した2次元テクスチャが複数設けられ、前記複数の2次元テクスチャの少なくとも1つを指定するための第3パラメータが前記2次元パラメータ座標における第1および第2パラメータとは別に設けられたテクスチャ構造体を格納するテクスチャ構造体を格納するテクスチャ記憶部と、描画対象物の表面に適用されるテクスチャについて前記第3パラメータの指定と前記表面上の2次元パラメータ座標値の指定とを受け、前記テクスチャ構造体の内、指定された前記第3パラメータに対応する前記2次元テクスチャから、指定された前記2次元パラメータ座標値に対応するテクセル値を読み出して、前記描画対象物の表面に適用されるテクスチャに関する補間値を算出するテクスチャ処理部と、前記テクスチャ処理部から出力される前記テクスチャに関する補間値を用いて、前記描画対象物の描画演算処理を行う描画処理部とを含む。前記テクスチャ構造体は、前記描画対象物の存在する空間内に仮想的に設けられた立方体の面に投影された環境テクスチャを面数だけ設けた構造を有する。前記描画処理部は、前記描画対象物の表面の反射ベクトルにもとづいて、前記表面に写像される環境テクスチャの面番号とその面内における2次元パラメータ座標値とを求め、求めた面番号を前記第3パラメータとして2次元パラメータ座標値とともに前記テクスチャ処理部に対して指定し、前記テクスチャ処理部は、前記テクスチャ構造体の内、前記描画処理部により前記第3パラメータとして指定された前記面番号に対応する環境テクスチャから、前記描画処理部により指定された前記2次元パラメータ座標値に対応するテクセル値を読み出し、前記描画対象物の表面に適用されるテクスチャに関する補間値を算出する。   Another aspect of the present invention is a drawing processing apparatus. This apparatus is provided with a plurality of two-dimensional textures in which values related to texture are stored as texel values in association with two-dimensional parameter coordinates, and a third parameter for designating at least one of the plurality of two-dimensional textures is the 2 A texture storage unit for storing a texture structure that is provided separately from the first and second parameters in the dimension parameter coordinates, and designation of the third parameter for the texture applied to the surface of the drawing target Corresponding to the designated two-dimensional parameter coordinate value from the two-dimensional texture corresponding to the designated third parameter in the texture structure. Texture to be read and applied to the surface of the drawing object Including a texture processing unit for calculating an interpolation value related, using interpolation value for the texture output from the texture processing unit, and a drawing processing unit for drawing processing of the drawing object. The texture structure has a structure in which the number of environmental textures projected on a cube surface virtually provided in the space where the drawing target exists is provided. The drawing processing unit obtains the surface number of the environmental texture mapped to the surface and the two-dimensional parameter coordinate value in the surface based on the reflection vector of the surface of the drawing object, A third parameter is specified to the texture processing unit together with a two-dimensional parameter coordinate value, and the texture processing unit sets the surface number specified as the third parameter by the drawing processing unit in the texture structure. A texel value corresponding to the two-dimensional parameter coordinate value designated by the drawing processing unit is read from the corresponding environment texture, and an interpolation value related to the texture applied to the surface of the drawing object is calculated.

本発明のさらに別の態様は、テクスチャのデータ構造である。このテクスチャのデータ構造は、テクスチャに関する値を2次元パラメータ座標に対応づけてテクセル値として格納した2次元テクスチャが複数設けられ、前記複数の2次元テクスチャの少なくとも1つを指定するための第3パラメータが前記2次元パラメータ座標における第1および第2パラメータとは別に設けられた構造体を有し、前記2次元パラメータ座標値および前記第3パラメータを指定したテクスチャの読み出し命令により、指定された第3パラメータに対応する前記2次元テクスチャから、指定された前記2次元パラメータ座標値に対応する前記テクセル値のサンプリングが可能に構成され、前記第3パラメータとして、前記構造体に含まれる前記複数の2次元テクスチャ間の関連性に応じた値が指定されることにより、異なる種類の前記構造体の統一的な参照が可能に構成されてなる。   Yet another aspect of the present invention is a texture data structure. The texture data structure includes a plurality of two-dimensional textures in which texture-related values are stored as texel values in association with two-dimensional parameter coordinates, and a third parameter for designating at least one of the plurality of two-dimensional textures. Has a structure provided separately from the first and second parameters in the two-dimensional parameter coordinates, and the third specified by the texture read command specifying the two-dimensional parameter coordinate values and the third parameter The texel value corresponding to the specified two-dimensional parameter coordinate value can be sampled from the two-dimensional texture corresponding to the parameter, and the plurality of two-dimensional elements included in the structure as the third parameter By specifying a value according to the relationship between textures, Unified Reference Type of the structure so that it may be configured.

本発明のさらに別の態様は、テクスチャ処理方法である。この方法は、テクスチャに関する値を2次元パラメータ座標に対応づけてテクセル値として格納した2次元テクスチャが複数設けられ、前記複数の2次元テクスチャの少なくとも1つを指定するための第3パラメータが前記2次元パラメータ座標における第1および第2パラメータとは別に設けられたテクスチャ構造体を保持したテクスチャメモリに対して、描画対象物の表面に適用されるテクスチャについて前記第3パラメータと前記表面上の2次元パラメータ座標値を指定したテクスチャの読み出し命令を実行することにより、指定された前記第3パラメータに対応する前記2次元テクスチャから、指定された前記2次元パラメータ座標値に対応するテクセル値をサンプリングするステップと、サンプリングされた前記テクセル値を補間して、前記描画対象物の表面に適用されるテクスチャに関する値を算出するステップとを含み、前記第3パラメータとして、前記テクスチャ構造体に含まれる前記複数の2次元テクスチャ間の関連性に応じた値が指定されることにより、異なる種類の前記テクスチャ構造体が統一的に参照される。   Yet another embodiment of the present invention is a texture processing method. In this method, a plurality of two-dimensional textures in which texture-related values are stored as texel values in association with two-dimensional parameter coordinates are provided, and a third parameter for designating at least one of the plurality of two-dimensional textures is the 2 For a texture memory holding a texture structure provided separately from the first and second parameters in the dimension parameter coordinates, the third parameter and the two-dimensional on the surface for the texture applied to the surface of the drawing object Sampling a texel value corresponding to the specified two-dimensional parameter coordinate value from the two-dimensional texture corresponding to the specified third parameter by executing a texture read command specifying the parameter coordinate value And interpolate the sampled texel values Calculating a value related to the texture applied to the surface of the drawing object, and the third parameter is a value corresponding to the relationship between the plurality of two-dimensional textures included in the texture structure Is specified, different types of the texture structures are uniformly referred to.

なお、以上の構成要素の任意の組合せ、本発明の表現を方法、装置、システム、コンピュータプログラム、データ構造などの間で変換したものもまた、本発明の態様として有効である。   It should be noted that any combination of the above-described constituent elements and a representation of the present invention converted between a method, an apparatus, a system, a computer program, a data structure, etc. are also effective as an aspect of the present invention.

本発明によれば、テクスチャマッピングの利便性を高めるとともに、テクスチャ処理の効率を向上させることができる。   According to the present invention, the convenience of texture mapping can be improved and the efficiency of texture processing can be improved.

図1は、実施の形態に係る描画処理装置100の構成図である。描画処理装置100は、3次元モデル情報にもとづいて2次元画面に表示するための描画データを生成するレンダリング処理を行う。   FIG. 1 is a configuration diagram of a drawing processing apparatus 100 according to the embodiment. The drawing processing apparatus 100 performs a rendering process for generating drawing data to be displayed on a two-dimensional screen based on the three-dimensional model information.

ラスタライザ10は、メモリもしくは他のプロセッサや頂点シェーダなどから描画対象となるプリミティブの頂点データを取得し、描画するスクリーンに対応したピクセル情報に変換する。描画プリミティブは、3次元オブジェクトをポリゴンモデルで表した場合の点、線、三角形、四角形などの幾何学図形の描画単位であり、頂点単位で表されるデータである。ラスタライザ10は、3次元空間上の描画プリミティブを投影変換により描画平面上の図形に変換するビュー変換を行い、さらに、描画平面上の図形を描画平面の水平方向に沿ってスキャンしながら、1列毎に量子化されたピクセルに変換する。   The rasterizer 10 acquires vertex data of a primitive to be drawn from a memory or another processor or a vertex shader, and converts it into pixel information corresponding to a screen to be drawn. The drawing primitive is a drawing unit of a geometric figure such as a point, a line, a triangle, or a quadrangle when a three-dimensional object is represented by a polygon model, and is data expressed in a vertex unit. The rasterizer 10 performs view conversion in which drawing primitives in a three-dimensional space are converted into graphics on the drawing plane by projection conversion, and further, one column is scanned while scanning the drawing on the drawing plane along the horizontal direction of the drawing plane. Every time it is converted to a quantized pixel.

ラスタライザ10により、描画プリミティブがピクセル展開され、各ピクセルについて、RGB3原色で表されるカラー値、透明度を示すアルファ値、奥行きを示すZ値、テクスチャ属性を参照するためのパラメータ座標であるUV座標値などを含むピクセル情報が算出される。   The rasterizer 10 develops pixels of the rendering primitive, and for each pixel, a color value expressed by RGB three primary colors, an alpha value indicating transparency, a Z value indicating depth, and a UV coordinate value which is a parameter coordinate for referring to a texture attribute Pixel information including such as is calculated.

ラスタライザ10は、1つ以上のピクセルを含む所定サイズのピクセル集合の単位で上記のラスタライズ処理を行い、ラスタライズ処理後のピクセル集合をバッファリングしながら、ピクセル集合の単位でシェーダユニット30に順次供給する。ラスタライザ10からシェーダユニット30に供給されたピクセル集合は、シェーダユニット30においてパイプライン処理される。ピクセル集合は、ラスタライザ10が一度に処理するピクセルをまとめたものであり、ラスタライズ処理の単位であり、また同時に、シェーダユニット30における描画演算処理の単位にもなっている。   The rasterizer 10 performs the above-described rasterization process in units of a pixel set of a predetermined size including one or more pixels, and sequentially supplies the pixel sets after the rasterization process to the shader unit 30 in units of pixel sets. . The pixel set supplied from the rasterizer 10 to the shader unit 30 is pipeline processed in the shader unit 30. The pixel set is a collection of pixels processed by the rasterizer 10 at a time, and is a unit of rasterization processing, and at the same time, a unit of drawing calculation processing in the shader unit 30.

シェーダユニット30は、非同期動作する複数のピクセルシェーダを含み、それぞれが担当するピクセル集合を処理することでピクセルの描画処理を並列に実行する。シェーダユニット30は、ラスタライザ10からピクセル集合単位で分配されるピクセル情報をもとに、シェーディング処理を行ってピクセルのカラー値を求め、さらに、テクスチャマッピングを行う場合は、テクスチャユニット70から得られるテクスチャのカラー値を合成して最終的なピクセルのカラー値を算出し、メモリ50にピクセルデータを書き込む。   The shader unit 30 includes a plurality of pixel shaders that operate asynchronously, and performs pixel drawing processing in parallel by processing a set of pixels each of which is responsible. The shader unit 30 obtains the color value of the pixel by performing shading processing based on the pixel information distributed from the rasterizer 10 in units of pixel sets, and further, when texture mapping is performed, the texture obtained from the texture unit 70 The final color value of the pixel is calculated by combining these color values, and the pixel data is written in the memory 50.

テクスチャユニット70は、シェーダユニット30において処理されるピクセルにテクスチャデータをマッピングする処理を行う。本実施の形態では、テクスチャユニット70は、複数の2次元テクスチャを設けたテクスチャ構造体(以下、単に「テクスチャ構造体」と呼ぶ)を利用する。テクスチャ構造体に含まれる2次元テクスチャには、テクスチャのカラー値などの属性値が2次元パラメータ座標(u,v)に対応づけてテクセル値として格納される。   The texture unit 70 performs processing for mapping texture data to pixels processed in the shader unit 30. In the present embodiment, texture unit 70 uses a texture structure provided with a plurality of two-dimensional textures (hereinafter simply referred to as “texture structure”). In the two-dimensional texture included in the texture structure, an attribute value such as a texture color value is stored as a texel value in association with the two-dimensional parameter coordinates (u, v).

なお、テクスチャ構造体に含まれる2次元テクスチャは、特別な場合として、テクセルの位置座標として第1パラメータuだけをもたせた1次元テクスチャであってもよい。2次元テクスチャにおいて、第2パラメータvが常に0であるとして、v方向を無視することで、1次元テクスチャを2次元テクスチャの特殊な場合として扱うことができる。そこで、以下では、特殊な場合として1次元テクスチャも含める趣旨でテクスチャの次元を一般的に2次元として説明する。   Note that the two-dimensional texture included in the texture structure may be a one-dimensional texture having only the first parameter u as the position coordinates of the texel as a special case. In the two-dimensional texture, assuming that the second parameter v is always 0, the one-dimensional texture can be handled as a special case of the two-dimensional texture by ignoring the v direction. Therefore, in the following description, the texture dimension is generally assumed to be two-dimensional for the purpose of including a one-dimensional texture as a special case.

テクスチャ構造体に含まれる複数の2次元テクスチャの少なくとも1つからテクセル値を参照するために、テクスチャ構造体に含まれる2次元テクスチャの少なくとも1つを指定するための第3パラメータwが、テクセル位置を指定する2次元パラメータ座標(u,v)における第1パラメータuおよび第2パラメータvとは別に設けられる。   In order to refer to the texel value from at least one of the plurality of two-dimensional textures included in the texture structure, the third parameter w for designating at least one of the two-dimensional textures included in the texture structure is a texel position. Are provided separately from the first parameter u and the second parameter v in the two-dimensional parameter coordinates (u, v) for designating.

ポリゴン面上のピクセルにマッピングされるテクスチャは、第3パラメータwとポリゴン面上に定義される2次元パラメータ座標(u,v)との組み合わせた3次元パラメータ座標(u,v,w)によって指定される。以下、パラメータ座標をテクセル座標と呼び、第3パラメータwも第3テクセル座標wと呼ぶが、第3テクセル座標wは、基本的に、テクスチャ構造体に含まれる複数の2次元テクスチャの少なくとも1つを指定するために使われる値であり、2次元テクセル座標は、テクスチャの幅と高さに対応するが、第3テクセル座標は、必ずしもテクスチャの奥行きに対応するものではないことに留意する。第3テクセル座標wがどのように意味づけられるかは、テクスチャ構造体に含まれる複数の2次元テクスチャ間の関連性に依存するからである。   The texture to be mapped to the pixels on the polygon surface is specified by the three-dimensional parameter coordinates (u, v, w) in combination with the third parameter w and the two-dimensional parameter coordinates (u, v) defined on the polygon surface. Is done. Hereinafter, the parameter coordinates are referred to as texel coordinates, and the third parameter w is also referred to as third texel coordinate w. The third texel coordinate w is basically at least one of a plurality of two-dimensional textures included in the texture structure. Note that while the two-dimensional texel coordinates correspond to the width and height of the texture, the third texel coordinates do not necessarily correspond to the depth of the texture. This is because how the third texel coordinate w is given depends on the relationship between a plurality of two-dimensional textures included in the texture structure.

テクスチャユニット70は、シェーダユニット30からピクセルにマッピングされるテクスチャ構造体の3次元テクセル座標値(u,v,w)を取得し、テクスチャ構造体の内、第3テクセル座標wに対応する2次元テクスチャから2次元テクセル座標値(u,v)に対応するテクセル値を読み出し、読み出したテクセル値を補間し、シェーダユニット30にその補間値を供給する。   The texture unit 70 acquires the three-dimensional texel coordinate value (u, v, w) of the texture structure mapped to the pixel from the shader unit 30, and the two-dimensional corresponding to the third texel coordinate w in the texture structure. A texel value corresponding to the two-dimensional texel coordinate value (u, v) is read from the texture, the read texel value is interpolated, and the interpolated value is supplied to the shader unit 30.

シェーダユニット30は、さらに、メモリ50に保持された描画データに対して、フォギング、アルファブレンディング等の処理を行い、最終的なピクセルのカラー値を求め、メモリ50のピクセルデータを更新する。   The shader unit 30 further performs processing such as fogging and alpha blending on the drawing data held in the memory 50, obtains a final pixel color value, and updates the pixel data in the memory 50.

メモリ50は、シェーダユニット30により生成されたピクセルデータをスクリーン座標で格納するフレームバッファとして機能する領域をもつ。フレームバッファに格納されたピクセルデータは、最終描画画像であることも、シェーディング処理過程にある中間画像であることもある。フレームバッファに記憶されたピクセルデータは、表示装置に出力されて表示される。   The memory 50 has an area that functions as a frame buffer that stores pixel data generated by the shader unit 30 in screen coordinates. The pixel data stored in the frame buffer may be a final drawn image or an intermediate image in the process of shading. The pixel data stored in the frame buffer is output to the display device and displayed.

図2は、シェーダユニット30およびテクスチャユニット70の構成を示す図である。   FIG. 2 is a diagram illustrating the configuration of the shader unit 30 and the texture unit 70.

シェーダユニット30のレジスタファイル32、テクスチャユニット70のレジスタファイル72にはそれぞれ、テクスチャマッピングを行うために必要なコンフィグレーション情報が設定される。コンフィグレーション情報には、メモリ50に格納されたテクスチャ構造体52を一括して参照するためのベースアドレス、テクスチャマッピングの際のフィルタリングモードなどの各種パラメータが含まれる。   Configuration information necessary for texture mapping is set in each of the register file 32 of the shader unit 30 and the register file 72 of the texture unit 70. The configuration information includes various parameters such as a base address for collectively referring to the texture structures 52 stored in the memory 50 and a filtering mode for texture mapping.

シェーダユニット30の描画演算処理部34は、レジスタファイル32に設定されたコンフィグレーション情報にもとづいて、テクスチャ構造体52からテクスチャを参照するための3次元テクセル座標値(u,v,w)を指定したテクスチャ命令をテクスチャユニット70に対して発行することにより、テクスチャユニット70からピクセルにマッピングされるテクスチャの補間値を取得する。描画演算処理部34は、テクスチャユニット70から取得したテクスチャの補間値をもちいて最終的なピクセルのカラー値を算出し、描画データ54としてメモリ50に書き込む。   The drawing operation processing unit 34 of the shader unit 30 designates three-dimensional texel coordinate values (u, v, w) for referring to the texture from the texture structure 52 based on the configuration information set in the register file 32. By issuing the texture command to the texture unit 70, the texture interpolation value of the texture mapped to the pixel is acquired from the texture unit 70. The drawing calculation processing unit 34 calculates the final color value of the pixel using the texture interpolation value acquired from the texture unit 70, and writes it in the memory 50 as the drawing data 54.

テクスチャユニット70のテクスチャ読み出し部76は、シェーダユニット30から3次元テクセル座標値(u,v,w)を受け取る。テクスチャ読み出し部76は、レジスタファイル72に保持されたテクスチャ構造体52のベースアドレスに、第3テクセル座標値wに依存して決まるオフセット値を加算することにより、指定された第3テクセル座標値wに対応するテクスチャの参照アドレスを生成する。テクスチャ読み出し部76は、その参照アドレスで指定されるテクスチャから、レジスタファイル72に設定されたフィルタリングモードのしたがって、2次元テクセル座標(u,v)に対応するテクセル値を読み出す。テクスチャ読み出し部76は、読み出したテクセル値をフィルタ74に与える。   The texture reading unit 76 of the texture unit 70 receives the three-dimensional texel coordinate values (u, v, w) from the shader unit 30. The texture reading unit 76 adds the offset value determined depending on the third texel coordinate value w to the base address of the texture structure 52 held in the register file 72, thereby specifying the specified third texel coordinate value w. A texture reference address corresponding to is generated. The texture reading unit 76 reads the texel value corresponding to the two-dimensional texel coordinates (u, v) in accordance with the filtering mode set in the register file 72 from the texture specified by the reference address. The texture reading unit 76 gives the read texel value to the filter 74.

なお、テクスチャ読み出し部76は、メモリ50に格納されたテクスチャ構造体52を直接参照せずに、テクスチャユニット70内に設けられたキャッシュメモリにキャッシュされたテクスチャ構造体52を参照するように構成してもよい。   The texture reading unit 76 is configured to refer to the texture structure 52 cached in the cache memory provided in the texture unit 70 without directly referring to the texture structure 52 stored in the memory 50. May be.

描画演算処理部34は、3次元テクセル座標値(u,v,w)以外に、描画対象オブジェクトの描画詳細度を示すLOD(level of detail)値をパラメータとして指定したテクスチャ命令を発行することもできる。その場合、テクスチャ読み出し部76は、ミップマップテクスチャの構造をもつテクスチャ構造体52において、LOD値に対応する解像度レベルのミップマップテクスチャを参照する。   In addition to the three-dimensional texel coordinate value (u, v, w), the drawing calculation processing unit 34 may issue a texture command specifying a LOD (level of detail) value indicating the drawing detail level of the drawing target object as a parameter. it can. In that case, the texture reading unit 76 refers to the mipmap texture having a resolution level corresponding to the LOD value in the texture structure 52 having the structure of the mipmap texture.

フィルタ74は、レジスタファイル72に設定されたフィルタリングモードにしたがって、テクスチャ読み出し部76により読み出されたテクセル値の補間を行い、補間値をシェーダユニット30の描画演算処理部34に与える。   The filter 74 performs interpolation of the texel value read by the texture reading unit 76 according to the filtering mode set in the register file 72, and provides the interpolation value to the drawing calculation processing unit 34 of the shader unit 30.

フィルタ74は、多段構成の内挿演算器を用いて、u、v2方向のバイリニア補間結果に対して、さらにw方向またはミップマップの解像度レベルの方向に補間を行うトライリニアサンプリングを実行することができる。また、フィルタ74は、多段構成の内挿演算器を選択的に機能させることにより、トライリニアサンプリング以外に、モノリニアサンプリングやバイリニアサンプリングも実行することができる。   The filter 74 may perform trilinear sampling that performs interpolation in the direction of the w direction or the resolution level of the mipmap on the bilinear interpolation result in the u and v2 directions using a multistage interpolation calculator. it can. The filter 74 can also perform monolinear sampling and bilinear sampling in addition to trilinear sampling by selectively functioning a multistage interpolation calculator.

モノリニアサンプリングでは、第3テクセル座標wに対応する2つの近傍テクスチャのそれぞれから、指定テクセル座標(u,v)の最近傍テクセルがサンプリングされ、2つの近傍テクスチャ間で補間される。また、LOD値が指定された場合は、ミップマップの解像度レベルの内、LOD値に対応する2つの近傍解像度レベルのテクスチャのそれぞれから、指定テクセル座標(u,v)の最近傍テクセルがサンプリングされ、2つの近傍解像度レベル間で補間される。   In monolinear sampling, the nearest texel of the designated texel coordinate (u, v) is sampled from each of the two neighboring textures corresponding to the third texel coordinate w, and is interpolated between the two neighboring textures. When the LOD value is designated, the nearest texel of the designated texel coordinate (u, v) is sampled from each of the two neighboring resolution level textures corresponding to the LOD value among the resolution levels of the mipmap. Interpolated between two neighboring resolution levels.

バイリニアサンプリングでは、第3テクセル座標wに対応するテクスチャから指定テクセル座標(u,v)の4近傍テクセルがサンプリングされ、u、vの2方向に補間される。また、LOD値が指定された場合は、ミップマップの解像度レベルの内、LOD値に対応するテクスチャから指定テクセル座標(u,v)の4近傍テクセルがサンプリングされ、u、vの2方向に補間される。   In bilinear sampling, four neighboring texels at designated texel coordinates (u, v) are sampled from the texture corresponding to the third texel coordinates w, and are interpolated in two directions u and v. When the LOD value is specified, four neighboring texels at the specified texel coordinates (u, v) are sampled from the texture corresponding to the LOD value within the resolution level of the mipmap and interpolated in two directions u and v. Is done.

トライリニアサンプリングでは、第3テクセル座標wに対応する2つの近傍テクスチャのそれぞれから、指定テクセル座標(u,v)の4近傍テクセルがサンプリングされ、各テクスチャでu、vの2方向に補間された上で、2つの近傍テクスチャ間でさらに補間される。また、LOD値が指定された場合は、ミップマップの解像度レベルの内、LOD値に対応する2つの近傍解像度レベルのテクスチャのそれぞれから、指定テクセル座標(u,v)の4近傍テクセルがサンプリングされ、各解像度レベルでu、vの2方向に補間された上で、2つの近傍解像度レベル間でさらに補間される。   In the trilinear sampling, four neighboring texels of designated texel coordinates (u, v) are sampled from each of two neighboring textures corresponding to the third texel coordinate w, and interpolated in two directions of u and v with each texture. Above, further interpolation is performed between two neighboring textures. When the LOD value is designated, four neighboring texels at the designated texel coordinates (u, v) are sampled from each of the two neighboring resolution level textures corresponding to the LOD value among the resolution levels of the mipmap. Then, after interpolating in two directions u and v at each resolution level, further interpolation is performed between two neighboring resolution levels.

フィルタ74は、レジスタファイル72に設定されたフィルタリングモードによっていずれかの補間に切り替えて実行する。なお、フィルタ74は、いずれの内挿演算器も機能させずに、指定テクセル座標(u,v)の最近傍テクセルをサンプリングしてそのまま出力するポイントサンプリングも実行することができる。   The filter 74 is switched to one of the interpolations according to the filtering mode set in the register file 72 and executed. Note that the filter 74 can also perform point sampling in which the nearest texel of the designated texel coordinate (u, v) is sampled and output as it is without causing any interpolation calculator to function.

さらに、フィルタ74は、内挿演算器の差分器、乗算器、および加算器の機能構成を適宜流用して、演算処理に多少の変形を加えることにより、線形補間以外の演算を行うことも可能であり、バイリニア補間やトライリニア補間以外の有用な演算を行うこともできる。これにより、フィルタ74は、後述のテクセル座標(u,v)の偏差分を求める計算や、テクセル座標(u,v)がマッピングされる描画面のLOD値を求める計算を実行することができる。   Furthermore, the filter 74 can perform operations other than linear interpolation by appropriately modifying the functional configuration of the difference unit, multiplier, and adder of the interpolation operation unit and adding some modifications to the operation processing. It is also possible to perform useful calculations other than bilinear interpolation and trilinear interpolation. Accordingly, the filter 74 can execute a calculation for obtaining a deviation of texel coordinates (u, v), which will be described later, and a calculation for obtaining a LOD value of a drawing surface to which the texel coordinates (u, v) are mapped.

図3は、図2のメモリ50に格納されたテクスチャ構造体52のデータ構造を説明する図である。テクスチャ構造体52は、既に説明したように、2次元テクスチャを複数設けたものであり、第3パラメータwによりいずれかの2次元テクスチャを指定できるように構成されている。ここでは、複数の2次元テクスチャを格納するデータ構造の一例として、複数の2次元テクスチャが同図の縦方向に配置された構成を説明するが、第3パラメータwによっていずれかの2次元テクスチャをアドレス指定できる構成であれば、複数の2次元テクスチャのメモリ上での配置の形態は問わない。   FIG. 3 is a diagram for explaining the data structure of the texture structure 52 stored in the memory 50 of FIG. As already described, the texture structure 52 is provided with a plurality of two-dimensional textures, and is configured such that any two-dimensional texture can be designated by the third parameter w. Here, as an example of a data structure for storing a plurality of two-dimensional textures, a configuration in which a plurality of two-dimensional textures are arranged in the vertical direction in the figure will be described. Any arrangement of a plurality of two-dimensional textures on the memory is possible as long as it can be addressed.

また、以下では、便宜上、同図のように縦方向に並べて配置された複数の2次元テクスチャの縦方向について述べる場合に、「レイヤ」という言葉を使うが、これは、複数の2次元テクスチャが層状に関連性をもつことを意味するものではなく、単に縦方向の並びの位置を指しているだけである。   In the following, for convenience, the term “layer” is used to describe the vertical direction of a plurality of two-dimensional textures arranged side by side in the vertical direction as shown in FIG. It does not mean that there is a relationship in the form of a layer, it simply refers to the position of the vertical alignment.

さらに、各レイヤの2次元テクスチャは、段階的に解像度を異ならせた一組のミップマップテクスチャの構造をもつことができる。同図の横方向にはミップマップの解像度レベル(以下、単に「ミップレベル」という)が図示されている。   Furthermore, the two-dimensional texture of each layer can have a structure of a set of mipmap textures having different resolutions in stages. In the horizontal direction of the figure, the resolution level of the mipmap (hereinafter simply referred to as “mip level”) is shown.

ミップレベル0について、縦方向に見た場合、レイヤ0、レイヤ1、レイヤ2の順に、高さと幅が共通するテクスチャA0、テクスチャA1、テクスチャA2が配置される。ミップレベル1についても、レイヤ0、レイヤ1、レイヤ2の順に、高さと幅が共通するテクスチャB0、テクスチャB1、テクスチャB2が配置される。ミップレベル1のテクスチャB0〜B2の幅と高さはそれぞれ、ミップレベル0のテクスチャA0〜A2の幅と高さの半分である。同様に、ミップレベル2のレイヤ0〜2に配置されるテクスチャC0〜C2の幅と高さはそれぞれ、ミップレベル1のレイヤ0〜2のテクスチャB0〜B2の幅と高さのさらに半分である。   When the mip level 0 is viewed in the vertical direction, texture A0, texture A1, and texture A2 having the same height and width are arranged in the order of layer 0, layer 1, and layer 2. Also for mip level 1, texture B0, texture B1, and texture B2 having the same height and width are arranged in the order of layer 0, layer 1, and layer 2. The width and height of the textures B0 to B2 at the mip level 1 are half the width and height of the textures A0 to A2 at the mip level 0, respectively. Similarly, the widths and heights of the textures C0 to C2 arranged in the layers 0 to 2 of the mip level 2 are respectively half the widths and heights of the textures B0 to B2 of the layers 0 to 2 of the mip level 1. .

横方向に見た場合、レイヤ0には、ミップレベル0のテクスチャA0、ミップレベル1のテクスチャB0、ミップレベル2のテクスチャC0の順にミップレベルの異なるテクスチャが配置されている。同様に、レイヤ1、レイヤ2にもミップレベルの異なるテクスチャが格納されている。   When viewed in the horizontal direction, in layer 0, textures having different mip levels are arranged in the order of texture A0 of mip level 0, texture B0 of mip level 1, and texture C0 of mip level 2. Similarly, textures with different mip levels are also stored in layers 1 and 2.

テクスチャ構造体52のレイヤ数およびミップレベル数は、レジスタファイル72の設定により変更可能である。テクスチャ構造体52にミップマップテクスチャの構造を設けるかどうかもレジスタファイル72の設定により選択することができる。ミップマップテクスチャを用いない場合は、同一サイズの2次元テクスチャが各レイヤに一つずつ設けられた構成となる。図3で言えば、ミップマップテクスチャを用いないテクスチャ構造体52は、ミップレベル0のテクスチャA0、A1、A2だけが存在するデータ構造となる。   The number of layers and the number of mip levels in the texture structure 52 can be changed by setting the register file 72. Whether or not to provide a mipmap texture structure to the texture structure 52 can also be selected by setting the register file 72. When the mipmap texture is not used, the configuration is such that one layer of two-dimensional texture of the same size is provided for each layer. In FIG. 3, the texture structure 52 that does not use the mipmap texture has a data structure in which only the textures A0, A1, and A2 of the mip level 0 exist.

また、テクスチャ構造体52に、レイヤの構造を設けるかどうかもレジスタファイル72の設定により選択可能である。レイヤの構造を設けない場合は、複数のミップレベルのテクスチャが1レイヤ分だけ設けられた構成となる。図3で言えば、レイヤ構造を設けないテクスチャ構造体52は、レイヤ0のテクスチャA0、B0、C0だけが存在するデータ構造となる。テクスチャ構造体52には、このようなレイヤが一つでミップレベルが複数のテクスチャも特別な場合として含まれる。さらにレイヤが1つでミップレベルを設けない通常の1枚のテクスチャもテクスチャ構造体52の特別な場合として扱う。   Whether the texture structure 52 is provided with a layer structure can be selected by setting the register file 72. When a layer structure is not provided, a structure in which a plurality of mip-level textures are provided for one layer is provided. In FIG. 3, the texture structure 52 without the layer structure has a data structure in which only the textures A0, B0, and C0 of the layer 0 exist. The texture structure 52 includes a texture having a single layer and a plurality of mip levels as a special case. Further, a normal texture having one layer and no mip level is also handled as a special case of the texture structure 52.

テクスチャ読み出し部76は、メモリ50に格納されたテクスチャ構造体52に対して、レイヤ番号NとミップレベルMを指定することにより、指定したレイヤNに属する指定したミップレベルMのテクスチャを参照する。たとえば、レイヤ2、ミップレベル1を指定すると、レイヤ2に属するミップレベル1のテクスチャB1を参照することができる。テクスチャ読み出し部76は、指定したレイヤおよびミップレベルのテクスチャ内において、2次元テクセル座標(u,v)を指定することで、テクスチャのテクセル値をサンプリングする。   The texture reading unit 76 refers to the texture of the specified mip level M belonging to the specified layer N by specifying the layer number N and the mip level M for the texture structure 52 stored in the memory 50. For example, when layer 2 and mip level 1 are designated, texture B1 of mip level 1 belonging to layer 2 can be referred to. The texture reading unit 76 samples the texel value of the texture by specifying the two-dimensional texel coordinates (u, v) in the texture of the specified layer and mip level.

テクセル値は、テクスチャに関する値として、RGB3色のカラー値であってもよく、カラー値のインデックスであってもよい。後者の場合は、カラールックアップテーブルを参照してインデックスが実際のカラー値に変換される。また、テクスチャマッピングの一例としてバンプマッピングを行う場合は、テクスチャに法線ベクトルを格納することになり、その場合、テクセル値は法線ベクトルの値である。また、パラメータにもとづいてプログラムによってテクスチャを生成するプロシージャルテクスチャ(procedural texture)を利用する場合は、テクセル値はパラメータ値や関数値となる。   The texel value may be a color value of three RGB colors or a color value index as a value related to the texture. In the latter case, the index is converted into an actual color value by referring to the color lookup table. When bump mapping is performed as an example of texture mapping, a normal vector is stored in the texture. In this case, the texel value is the value of the normal vector. In addition, when using a procedural texture that generates a texture by a program based on a parameter, the texel value is a parameter value or a function value.

図4〜図6を参照して、テクスチャ構造体52からのテクセル値のサンプリングのいくつかの例を説明する。   Several examples of sampling texel values from the texture structure 52 will be described with reference to FIGS.

図4は、バイリニアサンプリングを説明する図である。テクスチャ読み出し部76は、第3テクセル座標wに対応するレイヤとして参照レイヤNを求め、また、指定されたLOD値に対応するミップレベルとして参照ミップレベルMを求める。テクスチャ読み出し部76は、参照レイヤNと参照ミップレベルMにより指定されるテクスチャ51aから、テクセル座標値(u,v)で表される点の近傍にある4つのテクセル53aを読み出す。   FIG. 4 is a diagram for explaining bilinear sampling. The texture reading unit 76 obtains the reference layer N as the layer corresponding to the third texel coordinate w, and obtains the reference mip level M as the mip level corresponding to the designated LOD value. The texture reading unit 76 reads four texels 53 a in the vicinity of the point represented by the texel coordinate value (u, v) from the texture 51 a specified by the reference layer N and the reference mip level M.

フィルタ74は、この4近傍のテクセル53aの値をu方向およびv方向に線形補間することにより、テクセル座標値(u,v)に対応する補間値を求める。   The filter 74 obtains an interpolation value corresponding to the texel coordinate value (u, v) by linearly interpolating the values of the four neighboring texels 53a in the u direction and the v direction.

図5は、ミップレベル間のトライリニアサンプリングを説明する図である。テクスチャ読み出し部76は、第3テクセル座標wに対応するレイヤとして参照レイヤNを求め、また、指定されたLOD値に対応するミップレベルとして、2つの参照ミップレベルM、M+1を求める。テクスチャ読み出し部76は、参照レイヤNと第1参照ミップレベルMにより指定される第1テクスチャ51aから、テクセル座標値(u,v)で表される点の近傍にある4つのテクセル53aを読み出す。また、テクスチャ読み出し部76は、参照レイヤNと第2参照ミップレベルM+1により指定される第2テクスチャ51aから、テクセル座標値(u,v)で表される点の近傍の4つのテクセル53bを読み出す。   FIG. 5 is a diagram for explaining trilinear sampling between mip levels. The texture reading unit 76 obtains the reference layer N as a layer corresponding to the third texel coordinate w, and obtains two reference mip levels M and M + 1 as mip levels corresponding to the designated LOD value. The texture reading unit 76 reads four texels 53a in the vicinity of the point represented by the texel coordinate value (u, v) from the first texture 51a specified by the reference layer N and the first reference mip level M. The texture reading unit 76 reads four texels 53b in the vicinity of the point represented by the texel coordinate value (u, v) from the second texture 51a specified by the reference layer N and the second reference mip level M + 1. .

フィルタ74は、第1参照ミップレベルMの4近傍のテクセル53aの値と、第2参照ミップレベルの4近傍のテクセル53bの値を、u、v、ミップレベルの3方向に線形に補間するトライリニア補間を行うことにより、テクセル座標値(u,v)に対応する補間値を算出する。   The filter 74 performs a linear interpolation between the value of the texel 53a near 4 of the first reference mip level M and the value of the texel 53b near 4 of the second reference mip level in three directions u, v, and mip level. By performing linear interpolation, an interpolation value corresponding to the texel coordinate value (u, v) is calculated.

図6は、レイヤ間のモノリニアサンプリングを説明する図である。テクスチャ読み出し部76は、第3テクセル座標wに対応するレイヤとして、2つの参照レイヤN、N+1を求め、また、指定されたLOD値に対するミップレベルとして参照ミップレベルMを求める。テクスチャ読み出し部76は、第1参照レイヤNとミップレベルMにより指定される第1テクスチャ51cから、テクセル座標値(u,v)で表される点の最近傍にあるテクセル53cを読み出す。また、テクスチャ読み出し部76は、第2参照レイヤN+1とミップレベルMにより指定される第1テクスチャ51dから、テクセル座標値(u,v)で表される点の最近傍にあるテクセル53dを読み出す。   FIG. 6 is a diagram for explaining monolinear sampling between layers. The texture reading unit 76 obtains two reference layers N and N + 1 as layers corresponding to the third texel coordinate w, and obtains a reference mip level M as a mip level for the designated LOD value. The texture reading unit 76 reads the texel 53c that is closest to the point represented by the texel coordinate value (u, v) from the first texture 51c specified by the first reference layer N and the mip level M. Further, the texture reading unit 76 reads the texel 53d that is closest to the point represented by the texel coordinate value (u, v) from the first texture 51d specified by the second reference layer N + 1 and the mip level M.

フィルタ74は、第1参照レイヤNのテクセル53cの値と、第2参照レイヤN+1のテクセル53dの値を線形補間することにより、テクセル座標値(u,v,w)に対応する補間値を算出する。   The filter 74 calculates an interpolated value corresponding to the texel coordinate value (u, v, w) by linearly interpolating the value of the texel 53c of the first reference layer N and the value of the texel 53d of the second reference layer N + 1. To do.

図6において、2つの参照レイヤN、N+1の各々において、テクセル座標値(u,v)で表される点の近傍にある4つのテクセルをサンプリングし、2つの参照レイヤN、N+1間でu、v、wの3方向に線形補間するトライリニア補間を行うこともできる。   In FIG. 6, in each of the two reference layers N and N + 1, four texels in the vicinity of the point represented by the texel coordinate value (u, v) are sampled, and u, between the two reference layers N and N + 1, Trilinear interpolation that linearly interpolates in the three directions v and w can also be performed.

図7は、テクスチャユニット70によるテクスチャマッピング処理の手順を説明するフローチャートである。   FIG. 7 is a flowchart for explaining the procedure of the texture mapping process by the texture unit 70.

シェーダユニット30は、テクスチャユニット70に対して、テクスチャ構造体52を参照するためのテクセル座標値(u,v,w)とLOD値を指定する(S10)。ここで、シェーダユニット30から入力されるLOD値は、後述のテクセル座標の偏差分により決まる描画表面上の内部的なLOD値と区別する意味で、外部LOD値と呼ぶ。外部LOD値は、描画対象物のZ値などに応じて決められる。   The shader unit 30 designates texel coordinate values (u, v, w) and LOD values for referring to the texture structure 52 to the texture unit 70 (S10). Here, the LOD value input from the shader unit 30 is called an external LOD value in order to distinguish it from an internal LOD value on the drawing surface determined by a deviation of texel coordinates described later. The external LOD value is determined according to the Z value of the drawing object.

より具体的には、シェーダユニット30は、外部LOD値と第3テクセル座標値wをパラメータに指定したテクスチャセット命令tsetを発行し、その後、2次元テクセル座標値(u,v)をパラメータに指定したテクスチャロード命令tldを発行する。テクスチャユニット70は、テクスチャロード命令tldの発行を受けて、テクスチャマッピングの動作を開始する。   More specifically, the shader unit 30 issues a texture set command tset specifying the external LOD value and the third texel coordinate value w as parameters, and then specifies the two-dimensional texel coordinate value (u, v) as parameters. Issued texture load instruction tld. The texture unit 70 starts the texture mapping operation in response to the issue of the texture load instruction tld.

テクスチャユニット70は、入力されたパラメータのデータ型の変換を行う。シェーダユニット30は、浮動小数点数で演算を行うが、テクスチャユニット70は、テクスチャマッピングのハードウエアを効率良く利用するために、計算を速く実行できる固定小数点数を用いる。そこで、テクスチャユニット70は、入力されたテクセル座標などのパラメータのデータ型を浮動小数点から固定小数点に変換する。   The texture unit 70 converts the data type of the input parameter. The shader unit 30 performs an operation with a floating-point number, but the texture unit 70 uses a fixed-point number that can execute the calculation quickly in order to efficiently use the texture mapping hardware. Therefore, the texture unit 70 converts the data type of parameters such as the input texel coordinates from floating point to fixed point.

フィルタ74は、テクセル座標(u,v)におけるu方向、v方向の傾きを示す偏差分を次のように算出する(S12)。   The filter 74 calculates a deviation indicating the inclination in the u direction and the v direction in the texel coordinates (u, v) as follows (S12).

縦横2ピクセルの描画領域において、4ピクセル(x,y)、(x+1,y)、(x,y+1)、(x+1,y+1)のそれぞれのテクセル座標が(U0,V0)、(U1,V1)、(U2,V2)、(U3,V3)であるとする。   In the drawing area of 2 pixels vertically and horizontally, the texel coordinates of 4 pixels (x, y), (x + 1, y), (x, y + 1), (x + 1, y + 1) are (U0, V0), (U1, V1). , (U2, V2), (U3, V3).

フィルタ74は、ピクセル座標(x,y)の変化に対するテクセル座標(u,v)の変化量du/dx、du/dy、dv/dx、dv/dyを次式の偏差分により求める。
du/dx=((U1−U0)+(U3−U2))/2
dv/dx=((V1−V0)+(V3−V2))/2
du/dy=((U2−U0)+(U3−U1))/2
dv/dy=((V2−V0)+(V3−V1))/2
The filter 74 obtains a change amount du / dx, du / dy, dv / dx, dv / dy of the texel coordinate (u, v) with respect to a change of the pixel coordinate (x, y) by a deviation of the following expression.
du / dx = ((U1-U0) + (U3-U2)) / 2
dv / dx = ((V1-V0) + (V3-V2)) / 2
du / dy = ((U2-U0) + (U3-U1)) / 2
dv / dy = ((V2-V0) + (V3-V1)) / 2

これらの偏差分は、テクセル座標がスクリーンのx方向、y方向に局所的に変化する量を示すものであり、テクスチャがマッピングされる曲面のLOD値を求めるために利用される。   These deviations indicate the amount by which the texel coordinates locally change in the x and y directions of the screen, and are used to obtain the LOD value of the curved surface to which the texture is mapped.

フィルタ74は、テクセル座標(u,v)の偏差分にもとづいて、次のようにテクセル座標(u,v)におけるLOD値を算出する(S14)。   Based on the deviation of the texel coordinates (u, v), the filter 74 calculates the LOD value at the texel coordinates (u, v) as follows (S14).

Px=[(du/dx)+(dv/dx)1/2
Py=[(du/dy)+(dv/dy)1/2
LOD=log(max(Px、Py))
Px = [(du / dx) 2 + (dv / dx) 2 ] 1/2
Py = [(du / dy) 2 + (dv / dy) 2 ] 1/2
LOD = log 2 (max (Px, Py))

このようにして計算されるテクセル座標(u,v)のLOD値を、シェーダユニット30から指定される外部LOD値と区別する意味で内部LOD値と呼ぶ。フィルタ74は、内部LOD値に外部LOD値をオフセットとして加算する。外部LOD値によりオフセットされたLOD値をバイアスLOD値と呼ぶ。   The LOD value of the texel coordinates (u, v) calculated in this way is referred to as an internal LOD value in order to distinguish it from the external LOD value specified from the shader unit 30. The filter 74 adds the external LOD value as an offset to the internal LOD value. The LOD value offset by the external LOD value is called a bias LOD value.

フィルタ74は、バイアスLOD値に応じてそのテクスチャを描画する際のフィルタを選択する(S16)。フィルタには、縮小フィルタと拡大フィルタがあり、バイアスLOD値が所定の値以下の場合、すなわち描画詳細度が所定のレベル以下である場合は、テクスチャの拡大を行う拡大フィルタを選択し、そうでない場合、すなわち描画詳細度が所定のレベルよりも高い場合は、テクスチャの縮小を行う縮小フィルタを選択する。   The filter 74 selects a filter for drawing the texture according to the bias LOD value (S16). The filter includes a reduction filter and an enlargement filter. When the bias LOD value is equal to or lower than a predetermined value, that is, when the drawing detail level is equal to or lower than a predetermined level, the enlargement filter for enlarging the texture is selected. In this case, that is, when the drawing detail level is higher than a predetermined level, a reduction filter for reducing the texture is selected.

フィルタ74は、ミップレベルにおける補正処理を行う(S18)。テクスチャユニット70は、まずステップS14で求めたバイアスLOD値によってミップレベルを求める。ミップレベル間の補間を行わない場合は、バイアスLOD値に0.5を加算し、整数値に丸めることによりLOD値に最も近いミップレベルMを求める。ミップレベル間の補間を行う場合は、バイアスLOD値を整数値に丸めた値を第1ミップレベルMとして求め、第1ミップレベルに1を加えた値を第2ミップレベルM+1として求める。これによりバイアスLOD値の近傍の2つのミップレベルが得られる。   The filter 74 performs correction processing at the mip level (S18). The texture unit 70 first obtains the mip level based on the bias LOD value obtained in step S14. When interpolation between mip levels is not performed, 0.5 is added to the bias LOD value and rounded to an integer value to obtain the mip level M closest to the LOD value. When interpolation between mip levels is performed, a value obtained by rounding the bias LOD value to an integer value is obtained as the first mip level M, and a value obtained by adding 1 to the first mip level is obtained as the second mip level M + 1. As a result, two mip levels in the vicinity of the bias LOD value are obtained.

次に、フィルタ74は、こうして求めたミップレベルMにもとづいてテクセル座標値(u,v)とテクスチャサイズを補正する。テクセル座標値(u,v)は、ミップレベル0のテクスチャについて指定されたものであるから、ミップレベルMのテクスチャを参照するときは、ミップレベルMのテクスチャサイズに対応した値に補正する必要がある。ミップレベルMに対応した第1、第2テクセル座標値u、vは、元のミップレベル0における第1、第2テクセル座標値u、vをそれぞれ2で除算することにより得られる。なお、w方向はミップレベルとは無関係であるから、第3テクセル座標値wは補正されない。 Next, the filter 74 corrects the texel coordinate value (u, v) and the texture size based on the mip level M thus obtained. Since the texel coordinate value (u, v) is specified for the texture of the mip level 0, when referring to the texture of the mip level M, it is necessary to correct it to a value corresponding to the texture size of the mip level M. is there. The first and second texel coordinate values u and v corresponding to the mip level M are obtained by dividing the first and second texel coordinate values u and v at the original mip level 0 by 2 M , respectively. Since the w direction is independent of the mip level, the third texel coordinate value w is not corrected.

また、フィルタ74は、レジスタファイル72に設定されているミップレベル0のテクスチャサイズをミップレベルMに対応するサイズに補正する。これは元のミップレベル0のテクスチャの高さおよび幅をそれぞれ2で除算することにより得られる。 Further, the filter 74 corrects the texture size of the mip level 0 set in the register file 72 to a size corresponding to the mip level M. This is obtained by dividing the height and width of the original mip level 0 texture by 2M , respectively.

テクスチャ読み出し部76は、テクスチャ構造体52の2次元テクスチャ内でテクセルを指定するテクセル番号を求める(S20)。テクスチャ内に格納されたテクセルを2次元配列とみなしたとき、テクセル番号は、テクスチャ内のテクセルを指定する2次元配列のインデックスである。   The texture reading unit 76 obtains a texel number that designates a texel within the two-dimensional texture of the texture structure 52 (S20). When the texels stored in the texture are regarded as a two-dimensional array, the texel number is an index of the two-dimensional array that specifies the texels in the texture.

テクセル座標値(u,v)は実数値であるが、テクセル番号は、テクセル座標値(u,v)を整数に丸めた添え字(i,j)で表される。テクセル座標(u,v)で示される点の4近傍のテクセルをテクセル番号で指定する場合は、テクセル番号は(i,j)、(i+1,j)、(i,j+1)、(i+1,j+1)の4つになる。   The texel coordinate value (u, v) is a real value, but the texel number is represented by a subscript (i, j) obtained by rounding the texel coordinate value (u, v) to an integer. When a texel number near the point indicated by the texel coordinates (u, v) is designated by a texel number, the texel numbers are (i, j), (i + 1, j), (i, j + 1), (i + 1, j + 1). 4).

テクスチャ構造体52の場合、2次元テクスチャがレイヤ方向とミップレベル方向に複数設けられているため、レイヤ番号を指定する第3インデックスk、ミップレベルを指定する第4インデックスmをさらに追加して、テクセル番号を(i,j,k,m)で表す。たとえば、2つのレイヤN、N+1の間で内挿を行う場合は、テクセル番号を(i,j,N,M)、(i,j,N+1,M)と指定する。また、2つのミップレベルM、M+1の間で内挿を行う場合は、テクセル番号を(i,j,N,M)、(i,j,N,M+1)と指定する。   In the case of the texture structure 52, since a plurality of two-dimensional textures are provided in the layer direction and the mip level direction, a third index k for specifying the layer number and a fourth index m for specifying the mip level are further added. The texel number is represented by (i, j, k, m). For example, when interpolation is performed between two layers N and N + 1, the texel numbers are designated as (i, j, N, M) and (i, j, N + 1, M). When interpolation is performed between two mip levels M and M + 1, the texel numbers are designated as (i, j, N, M) and (i, j, N, M + 1).

フィルタ74は、フィルタリングに使用する内挿係数を算出する(S22)。内挿係数は、ミップレベルMに対応するように補正された第1、第2テクセル座標値u、vの小数部で与えられる。u方向の内挿係数αはミップレベルMにおける第1テクセル座標uの値の小数部、v方向の内挿係数βはミップレベルMにおける第2テクセル座標vの値の小数部である。また、w方向の補間、すなわちレイヤ間の内挿を行う場合は、w方向の内挿係数γは、第3テクセル座標値wの値の小数部で与えられる。LOD値に応じた補間、すなわちミップレベル間で内挿を行う場合は、ミップレベル方向の内挿係数δは、バイアスLOD値の小数部で与えられる。   The filter 74 calculates an interpolation coefficient used for filtering (S22). The interpolation coefficient is given by the decimal part of the first and second texel coordinate values u and v corrected to correspond to the mip level M. The u-direction interpolation coefficient α is the decimal part of the value of the first texel coordinate u at the mip level M, and the v-direction interpolation coefficient β is the decimal part of the value of the second texel coordinate v at the mip level M. When interpolation in the w direction, that is, interpolation between layers, is performed, the interpolation coefficient γ in the w direction is given by the decimal part of the value of the third texel coordinate value w. When interpolation according to the LOD value, that is, interpolation between mip levels, the interpolation coefficient δ in the mip level direction is given by the fractional part of the bias LOD value.

テクスチャ読み出し部76は、テクスチャの参照アドレスを算出する(S24)。テクスチャ読み出し部76は、コンフィグレーション時にレジスタファイル72に設定されたテクスチャ構造体52のベースアドレスに、各レイヤに属する各ミップレベルのテクスチャのサイズをレイヤ番号がN、ミップマップレベルがMになるまで加算していくことで、指定されたレイヤ番号NおよびミップレベルMのテクスチャを参照するためのアドレスを算出する。   The texture reading unit 76 calculates a texture reference address (S24). The texture reading unit 76 sets the texture size of each mip level belonging to each layer to the base address of the texture structure 52 set in the register file 72 during configuration until the layer number is N and the mipmap level is M. By adding, an address for referring to the texture of the designated layer number N and mip level M is calculated.

テクスチャ読み出し部76は、ステップS24で得たテクスチャの参照アドレスを基準にして、ステップS20で得たテクセル番号で指定されたテクセルをサンプリングする(S26)。ポイントサンプリングの場合は、1つのテクセルがサンプリングされるが、バイリニア補間をする場合は、4近傍テクセルがサンプリングされる。   The texture reading unit 76 samples the texel designated by the texel number obtained in step S20 based on the texture reference address obtained in step S24 (S26). In the case of point sampling, one texel is sampled, but in the case of bilinear interpolation, four neighboring texels are sampled.

フィルタ74は、サンプリングされたテクセルをバイリニア補間、トライリニア補間などによりフィルタリングする(S28)。フィルタ74は、フィルタリングにより得られた補間値をシェーダユニット30で扱う浮動小数点にフォーマット変換して出力する(S30)。   The filter 74 filters the sampled texel by bilinear interpolation, trilinear interpolation, or the like (S28). The filter 74 converts the interpolation value obtained by filtering into a floating point handled by the shader unit 30 and outputs it (S30).

上記のテクスチャマッピング処理の手順では説明を省略したが、テクセル座標がテクスチャをサンプルしない位置にあるときのラップモードとして、クランプ処理、リピート処理のいずれかが行われる。テクセルをサンプリングする際、テクスチャ画像のエッジをまたがることがあるため、ラップモードの処理が必要となる。クランプ処理では、テクセル座標を所定の値の範囲にクランプする。リピート処理では、テクセル番号を循環させることで、同じテクスチャが繰り返されるように扱う。   Although description is omitted in the procedure of the texture mapping process, either a clamp process or a repeat process is performed as a wrap mode when the texel coordinates are at a position where the texture is not sampled. When sampling a texel, the texture image may be crossed over, so processing in the wrap mode is required. In the clamping process, the texel coordinates are clamped within a predetermined value range. In repeat processing, texel numbers are circulated so that the same texture is repeated.

以上で述べた本実施の形態の描画処理装置100が利用するテクスチャ構造体52は、一般的には、3次元テクセル座標(u,v,w)で統一的に参照できるようにした複数の2次元テクスチャの集まりであるが、構成上は、複数の2次元テクスチャ間にいかなる関連性をもたせても、あるいは、何ら関連性をもたせなくてもよく、用途に合わせて自由に利用することができる。   The texture structure 52 used by the drawing processing apparatus 100 according to the present embodiment described above is generally a plurality of 2 that can be referred to in a unified manner using three-dimensional texel coordinates (u, v, w). Although it is a collection of dimensional textures, it does not need to have any relationship between two or more two-dimensional textures, or it can be used freely according to the application. .

たとえば、テクスチャ構造体52は、いわゆる「レイヤテクスチャ」として利用することができる。レイヤテクスチャは、複数の2次元テクスチャが互いに関連性をもって層をなして形成されたものであり、アプリケーションによってはテクスチャを層状に重ね合わせることを前提とすることもある。この場合、第3テクセル座標wは、レイヤ番号を指定するために用いられる。なお、上記の実施の形態でテクスチャ構造体52を説明する際に用いた「レイヤ」という言葉は、「レイヤテクスチャ」でいうところの狭義の意味でのレイヤを意味するものではなく、単にテクスチャ構造体52内に並べて配置された複数の2次元テクスチャの位置を特定する意味で用いた。   For example, the texture structure 52 can be used as a so-called “layer texture”. The layer texture is formed by layering a plurality of two-dimensional textures in association with each other, and depending on the application, the texture may be premised on being layered. In this case, the third texel coordinate w is used to specify a layer number. The term “layer” used in describing the texture structure 52 in the above embodiment does not mean a layer in the narrow sense of the term “layer texture”, but simply a texture structure. This is used to identify the positions of a plurality of two-dimensional textures arranged side by side in the body 52.

また、テクスチャ構造体52は、いわゆる「ボリュームテクスチャ」として利用することもある。ボリュームテクスチャは、複数の2次元テクスチャの間に奥行き方向の関連性をもたせ、幅と高さの他、奥行きの次元をもつテクスチャとして構成される。この場合、第3テクセル座標wは、奥行き値を指定するために用いられる。ボリュームテクスチャでは、テクスチャ構造体52のレイヤは奥行きに対応するため、レイヤ間の補間が意味をなす。   The texture structure 52 may be used as a so-called “volume texture”. The volume texture has a relation in the depth direction between a plurality of two-dimensional textures, and is configured as a texture having a dimension of depth in addition to the width and height. In this case, the third texel coordinate w is used to specify the depth value. In the volume texture, since the layer of the texture structure 52 corresponds to the depth, interpolation between layers makes sense.

なお、上記の実施の形態では、テクスチャ構造体52の最大レイヤ数は、ハードウエアの実装によって、8、16、32などに制限されることになるが、テクスチャ構造体52をボリュームテクスチャとして利用する場合、奥行き方向をさらに増やしたいことがある。たとえば、プロシージャルテクスチャを利用する場合、パーリン(Perlin)によるノイズ生成アルゴリズムにより、ノイズテクスチャをいくつも生成し、それらを何層にも重ね合わせることで質感をもたせる。このような3次元構造のテクスチャでは、奥行き方向として、たとえば64レイヤを必要とすることもある。   In the above embodiment, the maximum number of layers of the texture structure 52 is limited to 8, 16, 32, etc. depending on hardware implementation, but the texture structure 52 is used as a volume texture. In some cases, it may be desirable to further increase the depth direction. For example, when a procedural texture is used, a number of noise textures are generated by a noise generation algorithm based on Perlin, and the texture is given by superimposing them on multiple layers. In such a three-dimensional texture, for example, 64 layers may be required as the depth direction.

このような場合、テクスチャ構造体52の各テクスチャのテクセルのコンポーネントをレイヤとして利用することで、レイヤ数を増やすことが可能である。テクスチャの各テクセルは、一般にはRGB値とアルファ値を格納するために4コンポーネントをもつ。このコンポーネントをレイヤに対応づけて、各テクセルを4レイヤの値のセットとして扱うことにすれば、仮にテクスチャ構造体52の最大レイヤ数が16であっても、16×4=64レイヤとして扱うことができる。これにより、ノイズテクスチャとして、64レイヤの多重化が可能になる。   In such a case, the number of layers can be increased by using the texel component of each texture of the texture structure 52 as a layer. Each texel of the texture typically has four components for storing RGB and alpha values. If this component is associated with a layer and each texel is handled as a set of values of 4 layers, even if the maximum number of layers of the texture structure 52 is 16, it is handled as 16 × 4 = 64 layers. Can do. As a result, 64 layers can be multiplexed as a noise texture.

シェーダユニット30は、ノイズテクスチャを生成するために、第3テクセル座標値wとして、0から63までの値を指定したテクスチャ命令を実行することになる。しかし、テクスチャユニット70では、あくまでも16レイヤのテクスチャ構造体52を処理するため、テクスチャ読み出し部76は、第3テクセル座標値wを4で除算した商と余りを求め、商によって0から15までのレイヤ番号を取得し、余りによってコンポーネント番号を取得する。テクスチャ読み出し部76は、取得したレイヤ番号とコンポーネント番号を用いて、指定レイヤのテクスチャ内で指定コンポーネントを参照することで、テクスチャ構造体52から該当するテクセルをサンプリングすることができる。   The shader unit 30 executes a texture command specifying a value from 0 to 63 as the third texel coordinate value w in order to generate a noise texture. However, since the texture unit 70 processes the 16-layer texture structure 52 to the last, the texture reading unit 76 obtains a quotient and a remainder obtained by dividing the third texel coordinate value w by 4, and the quotient from 0 to 15 is obtained. Get the layer number, and get the component number by the remainder. The texture reading unit 76 can sample the corresponding texel from the texture structure 52 by referring to the designated component in the texture of the designated layer using the acquired layer number and component number.

以上、テクスチャ構造体52を、一般的に、複数の独立した2次元テクスチャの集まりとして説明し、いわゆる「レイヤテクスチャ」や「ボリュームテクスチャ」としても利用できることを説明したが、テクスチャ構造体52は、さらに、キューブ環境マッピング(以下、単にキューブマッピングという)において使用する6面の環境テクスチャを格納するために用いることもできる。以下、テクスチャ構造体52を用いて、本実施の形態の描画処理装置100によりキューブマッピング処理を行う方法を説明する。   As described above, the texture structure 52 is generally described as a collection of a plurality of independent two-dimensional textures, and has been described as being usable as a so-called “layer texture” or “volume texture”. Further, it can be used to store six-sided environment textures used in cube environment mapping (hereinafter simply referred to as cube mapping). Hereinafter, a method of performing the cube mapping process by the drawing processing apparatus 100 of the present embodiment using the texture structure 52 will be described.

図8は、キューブマッピングにおける描画対象物を囲む仮想的な立方体とその面を示す図である。キューブマッピングでは、同図のように、描画対象物の存在するワールド座標空間に定義されたワールド座標系(x,y,z)のxy面、yz面、zx面に対して各面が平行である仮想立方体を想定する。仮想立方体の各面の向きは、ポジティブX、ネガティブX、ポジティブY、ネガティブY、ポジティブZ、ネガティブZの6方向であり、この6方向により仮想立方体の各面を識別する。立方体の各面には描画対象物に写像される環境テクスチャがあらかじめ投影されている。   FIG. 8 is a diagram showing a virtual cube surrounding a drawing object in cube mapping and its surface. In cube mapping, as shown in the figure, each plane is parallel to the xy plane, yz plane, and zx plane of the world coordinate system (x, y, z) defined in the world coordinate space in which the drawing object exists. Assume a virtual cube. The orientation of each face of the virtual cube has six directions of positive X, negative X, positive Y, negative Y, positive Z, and negative Z, and each face of the virtual cube is identified by these six directions. An environmental texture to be mapped onto the drawing object is projected in advance on each surface of the cube.

図9は、図8の仮想立方体の展開図において、テクスチャ座標(S,T)の各軸S、Tの方向とワールド座標(x,y,z)の各軸x、y、zの方向の対応関係を説明する図である。テクスチャ座標(S,T)のS軸、T軸は、同図に示す方向に定義されている。ポジティブX面については、テクスチャ座標のS軸はワールド座標のz軸の負の方向(−z)にあり、テクスチャ座標のT軸はワールド座標のy軸の負の方向(−y)にある。ネガティブX面については、S軸はワールド座標のz軸の正の方向(z)、T軸はワールド座標のy軸の負の方向(−y)にある。   FIG. 9 is a development view of the virtual cube of FIG. 8 in the direction of each axis S, T of the texture coordinates (S, T) and the direction of each axis x, y, z of the world coordinates (x, y, z). It is a figure explaining a correspondence. The S-axis and T-axis of the texture coordinates (S, T) are defined in the direction shown in FIG. For the positive X plane, the texture coordinate S-axis is in the negative direction (-z) of the world coordinate z-axis, and the texture coordinate T-axis is in the negative direction (-y) of the world coordinate y-axis. For the negative X plane, the S axis is in the positive z-axis direction of the world coordinates (z), and the T axis is in the negative y-axis direction of the world coordinates (-y).

同様に、ポジティブY面のS軸、T軸は、それぞれワールド座標のx軸の正の方向(x)、z軸の正の方向(z)にあり、ネガティブY面のS軸、T軸は、それぞれワールド座標のx軸の正の方向(x)、z軸の負の方向(−z)にある。また、ポジティブZ面のS軸、T軸は、それぞれワールド座標のx軸の正の方向(x)、y軸の負の方向(−y)にあり、ネガティブZ面のS軸、T軸は、それぞれワールド座標のx軸の負の方向(−x)、y軸の負の方向(−y)にある。   Similarly, the S axis and T axis of the positive Y plane are respectively in the positive direction (x) of the x axis of the world coordinates and the positive direction (z) of the z axis, and the S axis and T axis of the negative Y plane are , Respectively in the positive direction (x) of the x-axis of the world coordinates and in the negative direction (−z) of the z-axis. Further, the S axis and T axis of the positive Z plane are respectively in the positive direction (x) of the x axis of the world coordinate and the negative direction (−y) of the y axis, and the S axis and T axis of the negative Z plane are , Respectively, in the negative direction (−x) of the x axis of the world coordinates and in the negative direction (−y) of the y axis.

キューブマッピングでは、描画表面上の反射ベクトルrを算出し、反射ベクトルrの方向が仮想立方体のいずれの面と交わるかを判定する。反射ベクトルrが交わる仮想立方体の面をターゲット面と呼ぶ。ターゲット面は、反射ベクトルの最大成分(メジャー成分という)が指し示すキューブ面である。   In cube mapping, a reflection vector r on the drawing surface is calculated, and it is determined which surface of the virtual cube intersects the direction of the reflection vector r. The surface of the virtual cube where the reflection vectors r intersect is called the target surface. The target surface is a cube surface indicated by the maximum component (referred to as a major component) of the reflection vector.

ターゲット面が決まると、反射ベクトルrのメジャー成分とメジャー軸方向が決まる。反射ベクトルrの成分を(vx,vy,vz)とおくと、反射ベクトルrに対するターゲット面がポジティブXであるとき、メジャー軸方向はx軸の正の方向(これを+VXと記す)であり、メジャー成分は反射ベクトルのx成分vxである。ターゲット面がネガティブXであるとき、メジャー軸方向はx軸の負の方向(−VX)、メジャー成分は反射ベクトルのx成分vxである。   When the target surface is determined, the major component of the reflection vector r and the major axis direction are determined. When the component of the reflection vector r is (vx, vy, vz), when the target surface with respect to the reflection vector r is positive X, the major axis direction is the positive direction of the x axis (this is denoted as + VX), The major component is the x component vx of the reflection vector. When the target surface is negative X, the major axis direction is the negative x-axis direction (−VX), and the major component is the x component vx of the reflection vector.

同様に、ターゲット面がポジティブYのとき、メジャー軸方向は+VY、メジャー成分はvyであり、ターゲット面がネガティブYのとき、メジャー軸方向は−VY、メジャー成分はvyである。また、ターゲット面がポジティブZのとき、メジャー軸方向は+VZ、メジャー成分はvzであり、ターゲット面がネガティブZのとき、メジャー軸方向は−VZ、メジャー成分はvzである。   Similarly, when the target surface is positive Y, the major axis direction is + VY and the major component is vy. When the target surface is negative Y, the major axis direction is −VY and the major component is vy. When the target surface is positive Z, the major axis direction is + VZ and the major component is vz. When the target surface is negative Z, the major axis direction is −VZ and the major component is vz.

反射ベクトルrの終点(vx,vy,vz)をターゲット面上にメジャー軸方向に射影した点は、描画表面に写像されるテクスチャの点であり、その点のテクスチャ座標(Sc,Tc)は、反射ベクトルの成分を用いて表される。ここで、図9で説明したように、各キューブ面でテクスチャ座標のS軸およびT軸は、ワールド座標の対応する軸と方向が正負反対になることもある。たとえば、ターゲット面がポジティブXである場合は、テクスチャ座標のS軸、T軸は、図9で説明したように、それぞれ−z方向、−y方向であったから、ポジティブX面上のテクスチャ座標(Sc,Tc)は、反射ベクトルのz成分とy成分を用いて(−vz,−vy)で与えられる。他のターゲット面の場合も同様にテクスチャ座標を反射ベクトルrの成分を用いて表すことができる。   A point obtained by projecting the end point (vx, vy, vz) of the reflection vector r onto the target surface in the major axis direction is a texture point mapped onto the drawing surface, and the texture coordinates (Sc, Tc) of the point are It is expressed using the component of the reflection vector. Here, as described with reference to FIG. 9, the direction of the S-axis and T-axis of the texture coordinates on each cube surface may be opposite to the corresponding axis of the world coordinates. For example, when the target plane is positive X, the S-axis and T-axis of the texture coordinates are the −z direction and the −y direction, respectively, as described in FIG. (Sc, Tc) is given by (−vz, −vy) using the z component and y component of the reflection vector. Similarly, in the case of other target surfaces, the texture coordinates can be expressed using the component of the reflection vector r.

図10は、ターゲット面、ターゲット面上のテクスチャ座標(Sc,Tc)、およびメジャー成分の対応関係をまとめて示す図である。   FIG. 10 is a diagram collectively showing the correspondence between the target surface, the texture coordinates (Sc, Tc) on the target surface, and the major component.

メジャー軸方向が+VXの場合、ターゲット面はポジティブX、Scは−vz、Tcは−vy、メジャー成分はvxである。メジャー軸方向が−VXの場合、ターゲット面はネガティブX、Scはvz、Tcは−vy、メジャー成分はvxである。   When the major axis direction is + VX, the target surface is positive X, Sc is −vz, Tc is −vy, and the major component is vx. When the major axis direction is −VX, the target surface is negative X, Sc is vz, Tc is −vy, and the major component is vx.

メジャー軸方向が+VYの場合、ターゲット面はポジティブY、Scはvx、Tcはvz、メジャー成分はvyである。メジャー軸方向が−VYの場合、ターゲット面はネガティブY、Scはvx、Tcは−vz、メジャー成分はvyである。   When the major axis direction is + VY, the target surface is positive Y, Sc is vx, Tc is vz, and the major component is vy. When the major axis direction is -VY, the target surface is negative Y, Sc is vx, Tc is -vz, and the major component is vy.

メジャー軸方向が+VZの場合、ターゲット面はポジティブZ、Scはvx、Tcは−vy、メジャー成分はvzである。メジャー軸方向が−VZの場合、ターゲット面はネガティブZ、Scは−vx、Tcは−vy、メジャー成分はvzである。   When the major axis direction is + VZ, the target surface is positive Z, Sc is vx, Tc is -vy, and the major component is vz. When the major axis direction is −VZ, the target surface is negative Z, Sc is −vx, Tc is −vy, and the major component is vz.

図10に示すように、ターゲット面、テクスチャ座標(Sc,Tc)、メジャー成分の対応関係は、メジャー軸方向によって一意に決まるため、キューブマップを指定するには、メジャー軸方向を指定すればよい。   As shown in FIG. 10, since the correspondence relationship between the target surface, texture coordinates (Sc, Tc), and the major component is uniquely determined by the major axis direction, the major axis direction may be designated to designate the cube map. .

図11(a)〜(d)は、テクスチャ構造体52をキューブマップとして用いる方法を説明する図である。   FIGS. 11A to 11D are diagrams illustrating a method of using the texture structure 52 as a cube map.

図11(a)は、キューブマップ用のテクスチャ構造体52のデータ構造を示す図である。テクスチャ構造体52のレイヤ方向はキューブ面に対応づけられ、各レイヤには仮想立方体の各面の環境テクスチャであるキューブマップが2次元テクスチャとして格納される。仮想立方体の6面に対応してテクスチャ構造体52のレイヤ数は6である。レイヤ番号はキューブ面を識別するマップIDに対応している。   FIG. 11A shows the data structure of the texture structure 52 for cube maps. The layer direction of the texture structure 52 is associated with a cube surface, and a cube map that is an environmental texture of each surface of the virtual cube is stored as a two-dimensional texture in each layer. The number of layers of the texture structure 52 is 6 corresponding to the six faces of the virtual cube. The layer number corresponds to the map ID that identifies the cube surface.

マップIDは、メジャー軸方向に対応しており、メジャー軸方向が決まれば、それに対応するマップIDにより各面のキューブマップを選択することができる。マップIDとメジャー軸方向の対応関係については、同図のように、マップID0〜5のそれぞれにメジャー軸+VX、−VX、+VY、−VY、+VZ、−VZが対応づけられる。また、各ミップレベルには解像度の異なるキューブマップが設けられており、ここではミップレベル0〜2の3段階の解像度の例が示されている。   The map ID corresponds to the major axis direction. If the major axis direction is determined, the cube map of each surface can be selected by the corresponding map ID. As for the correspondence relationship between the map ID and the major axis direction, major axes + VX, −VX, + VY, −VY, + VZ, and −VZ are associated with map IDs 0 to 5 as shown in FIG. Each mip level is provided with a cube map having different resolutions. Here, an example of three levels of resolution of mip levels 0 to 2 is shown.

図11(b)は、ミップレベル0の各レイヤのテクスチャと仮想立方体の各面の対応関係を示す図である。図11(a)のマップID0のテクスチャ(マップ0と呼ぶ)は、図11(b)の仮想立方体のポジティブX面の環境テクスチャに対応する。マップID1のテクスチャ(マップ1)は、仮想立方体のネガティブX面の環境テクスチャに対応する。以下、同様にマップ2、マップ3、マップ4、マップ5は、仮想立方体のポジティブY面、ネガティブY面、ポジティブZ面、ネガティブZ面の環境テクスチャにそれぞれ対応する。   FIG. 11B is a diagram illustrating a correspondence relationship between the texture of each layer at the mip level 0 and each surface of the virtual cube. The texture of map ID 0 (referred to as map 0) in FIG. 11A corresponds to the environmental texture of the positive X plane of the virtual cube in FIG. The texture of map ID1 (map 1) corresponds to the environmental texture of the negative X plane of the virtual cube. Hereinafter, similarly, Map 2, Map 3, Map 4, and Map 5 correspond to the environmental textures of the positive Y plane, negative Y plane, positive Z plane, and negative Z plane of the virtual cube, respectively.

図11(c)は、ミップレベル0に比べて解像度が1/2になったミップレベル1の各レイヤのテクスチャと仮想立方体の各面の対応関係を示す図である。図11(d)は、ミップレベル0に比べて解像度が1/4になったミップレベル2の各レイヤのテクスチャと仮想立方体の各面の対応関係を示す図である。レイヤとキューブ面の対応関係は、図11(b)と同じである。   FIG. 11C is a diagram illustrating a correspondence relationship between the texture of each layer of the mip level 1 whose resolution is halved compared to the mip level 0 and each surface of the virtual cube. FIG. 11D is a diagram showing a correspondence relationship between the texture of each layer of the mip level 2 and the resolution of the mip level 0 of each layer of the virtual cube. The correspondence between layers and cube surfaces is the same as in FIG.

マップIDは、レイヤ番号を指定するときと同様、第3テクセル座標wにより指定することができる。したがって、3次元テクセル座標(u,v,w)とLOD値を指定するテクスチャ命令を用いて、ミップマップを用いたキューブマッピングを行うことができる。   The map ID can be specified by the third texel coordinate w as in the case of specifying the layer number. Therefore, cube mapping using a mipmap can be performed using a texture command that specifies three-dimensional texel coordinates (u, v, w) and LOD values.

図12は、描画処理装置100によるキューブマッピング処理の手順を説明するフローチャートである。   FIG. 12 is a flowchart for explaining the procedure of cube mapping processing by the drawing processing apparatus 100.

シェーダユニット30の描画演算処理部34は、描画表面の反射ベクトルrを算出する(S40)。反射ベクトルrは、視線ベクトルeと描画表面の法線ベクトルnを用いて、計算式r=2(n・e)n−eにより求めることができる。   The drawing calculation processing unit 34 of the shader unit 30 calculates the reflection vector r on the drawing surface (S40). The reflection vector r can be obtained by the calculation formula r = 2 (n · e) ne using the line-of-sight vector e and the normal vector n of the drawing surface.

描画演算処理部34は、反射ベクトルrのメジャー成分にもとづいて、マップIDに対応するメジャー軸方向と、ターゲット面におけるテクスチャ座標(Sc,Tc)を算出する(S42)。これは図10で説明した通りである。   The drawing calculation processing unit 34 calculates the major axis direction corresponding to the map ID and the texture coordinates (Sc, Tc) on the target surface based on the major component of the reflection vector r (S42). This is as described in FIG.

描画演算処理部34は、テクスチャ座標(Sc,Tc)をテクセル座標(u,v)に変換する(S44)。テクセル座標(u,v)は、テクスチャの幅、高さをそれぞれwidth、heightとすると、テクスチャ座標(Sc,Tc)をメジャー成分の絶対値|major|で除算して正規化することにより、次式のように求めることができる。   The drawing calculation processing unit 34 converts the texture coordinates (Sc, Tc) to texel coordinates (u, v) (S44). The texel coordinates (u, v) are normalized by dividing the texture coordinates (Sc, Tc) by the absolute value | major | of the major component when the width and height of the texture are width and height, respectively. It can be obtained as shown in the equation.

u=(width/2)・(Sc/|major|+1)
v=(height/2)・(Tc/|major|+1)
u = (width / 2) · (Sc / | major | +1)
v = (height / 2). (Tc / | major | +1)

ここで、テクスチャユニット70のレジスタファイル72に設定されたテクスチャの幅と高さの値と一致する値をシェーダユニット30のレジスタファイル32にも設定しておき、描画演算処理部34がレジスタファイル32から参照できるようにする。   Here, values that match the width and height values of the texture set in the register file 72 of the texture unit 70 are also set in the register file 32 of the shader unit 30, and the drawing operation processing unit 34 makes the register file 32. Can be referenced from.

描画演算処理部34は、こうして求めた2次元テクセル座標(u,v)と、マップIDを指定する第3テクセル座標wとからなる3次元テクセル座標(u,v,w)をパラメータに指定したテクスチャ命令をテクスチャユニット70に発行する。ミップマップを用いる場合は、テクスチャ命令にさらに外部LOD値をパラメータとして指定する。   The drawing calculation processing unit 34 designates the three-dimensional texel coordinates (u, v, w) including the two-dimensional texel coordinates (u, v) thus obtained and the third texel coordinates w for designating the map ID as parameters. A texture command is issued to the texture unit 70. When the mipmap is used, an external LOD value is further specified as a parameter in the texture command.

より具体的には、描画演算処理部34は、外部LOD値と、マップIDである第3テクセル座標値wとをパラメータに指定したテクスチャセット命令tsetを発行し、その後、2次元テクセル座標値(u,v)をパラメータに指定したテクスチャロード命令tldを発行する。テクスチャユニット70は、テクスチャロード命令tldの発行を受けて、テクスチャマッピングの動作を開始する。   More specifically, the drawing calculation processing unit 34 issues a texture set command tset in which the external LOD value and the third texel coordinate value w that is a map ID are specified as parameters, and then a two-dimensional texel coordinate value ( A texture load instruction tld with u, v) designated as parameters is issued. The texture unit 70 starts the texture mapping operation in response to the issue of the texture load instruction tld.

テクスチャユニット70は、描画演算処理部34から指定された3次元テクセル座標(u,v,w)と外部LOD値にもとづいて、テクスチャ構造体52を用いたキューブマッピング処理を行う(S46)。このキューブマッピング処理は、第3テクセル座標wがマップIDを示す以外は、図7のフローチャートで示したテクスチャマッピング処理と同様にして行うことができる。なお、キューブマッピングでは、レイヤ間の補間は意味をなさないため行われない。   The texture unit 70 performs a cube mapping process using the texture structure 52 based on the three-dimensional texel coordinates (u, v, w) and the external LOD value designated by the drawing calculation processing unit 34 (S46). This cube mapping process can be performed in the same manner as the texture mapping process shown in the flowchart of FIG. 7 except that the third texel coordinate w indicates the map ID. In cube mapping, interpolation between layers does not make sense and is not performed.

以上述べたように、本実施の形態の描画処理装置100によれば、3次元テクセル座標(u,v,w)を指定してテクスチャ構造体52からテクセルをサンプリングして補間することができる。第3テクセル座標wは、一般にはテクスチャ構造体52に含まれる複数の2次元テクスチャの少なくとも1つを指定するために用いられるが、テクスチャ構造体52がレイヤテクスチャとして用いられる場合は、レイヤ番号を指定するために、テクスチャ構造体52がボリュームテクスチャとして用いられる場合は、奥行きに関するパラメータを指定するためにも用いることができる。さらに、テクスチャ構造体52のレイヤをキューブ面に対応づければ、テクスチャ構造体52は、6面のキューブマップを格納したテクスチャとして扱うこともでき、第3テクセル座標としてキューブ面を指定することで、キューブマッピングを行うことができる。   As described above, according to the drawing processing apparatus 100 of the present embodiment, it is possible to specify a three-dimensional texel coordinate (u, v, w) and sample and interpolate a texel from the texture structure 52. The third texel coordinate w is generally used to specify at least one of a plurality of two-dimensional textures included in the texture structure 52. When the texture structure 52 is used as a layer texture, the layer number is set. If the texture structure 52 is used as a volume texture to specify, it can also be used to specify a parameter relating to depth. Furthermore, if the layer of the texture structure 52 is associated with the cube surface, the texture structure 52 can be handled as a texture storing a six-sided cube map, and by specifying the cube surface as the third texel coordinate, Can do cube mapping.

このように、テクスチャ構造体52は、第3テクセル座標wの意味づけ次第で、複数の独立した2次元テクスチャの集まりとして扱うことも、2次元テクスチャが層状に形成されたレイヤテクスチャとして扱うことも、奥行き方向の次元をもつボリュームテクスチャとして扱うことも、6面のキューブマップテクスチャとして扱うこともできるため、テクスチャ構造体52を処理するテクスチャマッピング用の同一のハードウエア構成、同一のインタフェースをレイヤテクスチャ、ボリュームテクスチャ、キューブマップテクスチャのいずれの用途にも兼用して用いることができる。したがって、テクスチャユニット70の回路規模を小さく抑えることができ、テクスチャユニット70内のレジスタやキャッシュ、メモリなどの資源管理も容易になる。また、インタフェースが統一されているため、テクスチャマッピング処理のプログラミングも容易である。   Thus, depending on the meaning of the third texel coordinate w, the texture structure 52 can be handled as a collection of a plurality of independent two-dimensional textures, or can be handled as a layer texture in which the two-dimensional texture is formed in layers. Since it can be handled as a volume texture having a dimension in the depth direction or as a six-sided cube map texture, the same hardware configuration and the same interface for texture mapping for processing the texture structure 52 are used as a layer texture. , Volume texture and cube map texture can be used for both purposes. Therefore, the circuit scale of the texture unit 70 can be kept small, and resource management such as registers, caches, and memories in the texture unit 70 can be facilitated. In addition, since the interface is unified, programming of the texture mapping process is easy.

また、テクスチャ構造体52を参照するためのアドレス情報や、テクスチャ構造体52を利用したテクスチャマッピングのフィルタリングモードなどの各種パラメータは、1回のコンフィグレーションによりレジスタファイルに設定することができる。レイヤを切り替えてテクスチャ構造体52内の2次元テクスチャを参照しても、レジスタの設定情報すなわちコンテキストを変更する必要がなく、コンテキスト切り替えのオーバーヘッドなしで、効率良くテクスチャマッピングを行うことができる。また、テクスチャ構造体52では、複数のテクスチャを用いることができるため、高い描画品質を実現することができる。このように、本実施の形態によれば、処理効率を維持しながら、複数のテクスチャを使い分けて描画品質の向上を図ることができる。   Various parameters such as address information for referring to the texture structure 52 and filtering mode of texture mapping using the texture structure 52 can be set in the register file by one configuration. Even if the two-dimensional texture in the texture structure 52 is referred by switching layers, it is not necessary to change register setting information, that is, context, and texture mapping can be performed efficiently without context switching overhead. In addition, since the texture structure 52 can use a plurality of textures, high rendering quality can be realized. Thus, according to the present embodiment, it is possible to improve drawing quality by using a plurality of textures while maintaining processing efficiency.

また、本実施の形態の描画処理装置100によるキューブマッピング処理では、反射ベクトルを算出し、反射ベクトルからテクセル座標を求める計算をシェーダユニット30の描画演算処理部34において行い、キューブマップを参照してテクセル値をサンプリングして補間する処理はテクスチャユニット70において行う。テクスチャユニット70は、内挿演算器によるテクスチャマッピング専用のハードウエア構成をもつため、テクスチャ演算能力が高い。一方、シェーダユニット30は、プログラムによって複雑な演算処理を実行する能力があり、反射ベクトルの算出のような複雑な演算も高速に実行できる。本実施の形態の描画処理装置100では、キューブマッピング処理の内、高度な演算能力を必要とする処理は、シェーダユニット30で行い、テクスチャ演算に係る処理は、専用のテクスチャユニット70で行うことにより、処理を分担して、描画処理装置100全体の描画処理の効率化が図られている。   Further, in the cube mapping process by the drawing processing apparatus 100 according to the present embodiment, the reflection vector is calculated, and the calculation for obtaining the texel coordinates from the reflection vector is performed in the drawing operation processing unit 34 of the shader unit 30, and the cube map is referred to. The texture unit 70 performs processing for sampling and interpolating the texel values. Since the texture unit 70 has a hardware configuration dedicated to texture mapping by the interpolation calculator, it has a high texture calculation capability. On the other hand, the shader unit 30 has an ability to execute a complicated calculation process by a program, and can execute a complicated calculation such as calculation of a reflection vector at high speed. In the rendering processing apparatus 100 according to the present embodiment, processing that requires a high level of computing ability among cube mapping processing is performed by the shader unit 30, and processing related to texture computation is performed by the dedicated texture unit 70. The processing is shared to improve the efficiency of the drawing process of the entire drawing processing apparatus 100.

以上、本発明を実施の形態をもとに説明した。実施の形態は例示であり、それらの各構成要素や各処理プロセスの組合せにいろいろな変形例が可能なこと、またそうした変形例も本発明の範囲にあることは当業者に理解されるところである。そのような変形例を説明する。   The present invention has been described based on the embodiments. The embodiments are exemplifications, and it will be understood by those skilled in the art that various modifications can be made to combinations of the respective constituent elements and processing processes, and such modifications are within the scope of the present invention. . Such a modification will be described.

上記の説明では、レイヤ間の補間およびミップレベル間の補間は、2つのレイヤ間、2つのミップレベル間で行われたが、3つ以上のレイヤもしくはミップレベルを用いて補間を行うようにしてもよい。また、サンプリングするテクセルの個数についても、4近傍テクセルに限られない。8近傍テクセルをサンプリングしてそれらのテクセル間で補間をしてもよい。   In the above description, the interpolation between layers and the interpolation between mip levels were performed between two layers and between two mip levels. However, the interpolation should be performed using three or more layers or mip levels. Also good. Further, the number of texels to be sampled is not limited to 4 neighboring texels. You may sample 8 neighboring texels and interpolate between them.

また、上記の説明では、等方性(isotropic)テクセルサンプリングを説明したが、異方性(anisotropic)フィルタリングを行ってもよい。異方性テクセルサンプリングは、スクリーンのXY面に対してテクセル座標のUV面の傾きが大きい場合に特に有効である。異方性テクセルサンプリングでは、スクリーンのXY面におけるテクセル座標の変化の大きさと方向を求め、その変化の方向に変化の大きさに応じた回数のポイントサンプリング、バイリニアサンプリング、トライリニアサンプリングなどを繰り返すことで描画品質を維持する。   In the above description, isotropic texel sampling has been described. However, anisotropic filtering may be performed. Anisotropic texel sampling is particularly effective when the UV plane of texel coordinates is large with respect to the XY plane of the screen. In anisotropic texel sampling, the magnitude and direction of changes in texel coordinates on the XY plane of the screen are obtained, and point sampling, bilinear sampling, trilinear sampling, etc. are repeated in the direction of the change according to the magnitude of the change. Maintain the drawing quality.

実施の形態に係る描画処理装置の構成図である。It is a block diagram of the drawing processing apparatus which concerns on embodiment. 図1のシェーダユニットおよびテクスチャユニットの構成を示す図である。It is a figure which shows the structure of the shader unit of FIG. 1, and a texture unit. 図2のテクスチャ構造体のデータ構造を説明する図である。It is a figure explaining the data structure of the texture structure of FIG. バイリニアサンプリングを説明する図である。It is a figure explaining bilinear sampling. ミップマップの解像度レベル間のトライリニアサンプリングを説明する図である。It is a figure explaining the trilinear sampling between the resolution levels of a mipmap. レイヤ間のモノリニアサンプリングを説明する図である。It is a figure explaining the monolinear sampling between layers. 実施の形態に係るテクスチャユニットによるテクスチャマッピング処理の手順を説明するフローチャートである。It is a flowchart explaining the procedure of the texture mapping process by the texture unit which concerns on embodiment. キューブマッピングにおける描画対象物を囲む仮想的な立方体とその面を示す図である。It is a figure which shows the virtual cube which surrounds the drawing target object in cube mapping, and its surface. 図8の仮想立方体の展開図において、テクスチャ座標の各軸の方向とワールド座標の各軸の方向の対応関係を説明する図である。FIG. 9 is a diagram for explaining a correspondence relationship between the direction of each axis of texture coordinates and the direction of each axis of world coordinates in the developed view of the virtual cube of FIG. 8. キューブマッピングにおけるターゲット面、ターゲット面上のテクスチャ座標、およびメジャー成分の対応関係をまとめて示す図である。It is a figure which shows collectively the correspondence of the target surface in cube mapping, the texture coordinate on a target surface, and a major component. テクスチャ構造体をキューブマップとして用いる方法を説明する図である。It is a figure explaining the method of using a texture structure as a cube map. 実施の形態に係る描画処理装置によるキューブマッピング処理の手順を説明するフローチャートである。It is a flowchart explaining the procedure of the cube mapping process by the drawing processing apparatus which concerns on embodiment.

符号の説明Explanation of symbols

10 ラスタライザ、 30 シェーダユニット、 32 レジスタファイル、 34 描画演算処理部、 50 メモリ、 52 テクスチャ構造体、 54 描画データ、 70 テクスチャユニット、 72 レジスタファイル、 74 フィルタ、 76 テクスチャ読み出し部、 100 描画処理装置。   10 rasterizer, 30 shader unit, 32 register file, 34 drawing operation processing unit, 50 memory, 52 texture structure, 54 drawing data, 70 texture unit, 72 register file, 74 filter, 76 texture reading unit, 100 drawing processing device.

Claims (11)

テクスチャに関する値を2次元パラメータ座標に対応づけてテクセル値として格納した2次元テクスチャが複数設けられ、前記複数の2次元テクスチャの少なくとも1つを指定するための第3パラメータが前記2次元パラメータ座標における第1および第2パラメータとは別に設けられたテクスチャ構造体を格納するテクスチャ記憶部と、
描画対象物の表面に適用されるテクスチャについて前記第3パラメータの指定と前記表面上の2次元パラメータ座標値の指定とを受け、前記テクスチャ構造体の内、指定された前記第3パラメータに対応する前記2次元テクスチャから、指定された前記2次元パラメータ座標値に対応するテクセル値を読み出すテクスチャ読み出し部と、
読み出された前記テクセル値を補間して、前記描画対象物の表面に適用されるテクスチャに関する値を算出するフィルタとを含み、
前記第3パラメータとして、前記テクスチャ構造体に含まれる前記複数の2次元テクスチャ間の関連性に応じた値が指定されることにより、異なる種類の前記テクスチャ構造体が統一的に参照されることを特徴とするテクスチャ処理装置。
A plurality of two-dimensional textures in which values relating to texture are stored as texel values in association with two-dimensional parameter coordinates are provided, and a third parameter for designating at least one of the plurality of two-dimensional textures is the two-dimensional parameter coordinates A texture storage unit for storing a texture structure provided separately from the first and second parameters;
The texture applied to the surface of the drawing object is designated by the third parameter and the two-dimensional parameter coordinate value on the surface, and corresponds to the designated third parameter in the texture structure. A texture reading unit that reads a texel value corresponding to the specified two-dimensional parameter coordinate value from the two-dimensional texture;
A filter that interpolates the read texel value and calculates a value related to the texture applied to the surface of the drawing object,
By specifying a value according to the relationship between the plurality of two-dimensional textures included in the texture structure as the third parameter, the different types of the texture structures are referred to uniformly. Characteristic texture processing apparatus.
前記テクスチャ構造体は、レイヤ単位で規定される2次元テクスチャをレイヤ数だけ設けたレイヤ構造を有し、前記第3パラメータは、前記レイヤを指定する番号であることを特徴とする請求項1に記載のテクスチャ処理装置。   2. The texture structure according to claim 1, wherein the texture structure has a layer structure in which two-dimensional textures defined in units of layers are provided for the number of layers, and the third parameter is a number for designating the layer. The texture processing apparatus described. 前記テクスチャ構造体は、奥行きレベルの異なる2次元テクスチャを奥行き方向に複数並べたボリュームテクスチャの構造を有し、前記第3パラメータは、前記奥行きに関するパラメータであることを特徴とする請求項1に記載のテクスチャ処理装置。   2. The texture structure according to claim 1, wherein the texture structure has a volume texture structure in which a plurality of two-dimensional textures having different depth levels are arranged in the depth direction, and the third parameter is a parameter related to the depth. Texture processing equipment. 前記テクスチャ読み出し部は、前記第3パラメータとして指定された奥行きに関するパラメータに対応する2つの異なる奥行きレベルの2次元テクスチャを選択し、選択された2つの異なる奥行きレベルの2次元テクスチャの各々から、指定された前記2次元パラメータ座標に対応するテクセル値を読み出し、
前記フィルタは、前記2つの異なる奥行きレベルの2次元テクスチャ間で前記テクセル値を補間することにより、前記描画対象物の表面に適用されるテクスチャに関する値を算出することを特徴とする請求項3に記載のテクスチャ処理装置。
The texture reading unit selects two-dimensional textures having two different depth levels corresponding to the depth-related parameter designated as the third parameter, and designates each of the selected two-dimensional textures having two different depth levels. Read out the texel value corresponding to the two-dimensional parameter coordinates,
The said filter calculates the value regarding the texture applied to the surface of the said drawing target object by interpolating the said texel value between the two-dimensional textures of the said two different depth levels, The value of Claim 3 characterized by the above-mentioned. The texture processing apparatus described.
前記テクスチャ構造体は、前記描画対象物の存在する空間内に仮想的に設けられた立方体の面に投影された環境テクスチャを面数だけ設けた構造を有し、前記第3パラメータは、前記面を指定する番号であることを特徴とする請求項1に記載のテクスチャ処理装置。   The texture structure has a structure in which the number of the environmental textures projected on the surface of the cube virtually provided in the space where the drawing target exists is provided, and the third parameter is the surface The texture processing apparatus according to claim 1, wherein the texture processing apparatus is a number that specifies 前記テクスチャ構造体を一括して参照するためのベースアドレスを格納するレジスタをさらに設け、
前記テクスチャ読み出し部は、前記レジスタに格納された前記ベースアドレスに対して、指定された第3パラメータに依存するオフセット値を加算することにより、指定された第3パラメータに対応する前記2次元テクスチャの参照アドレスを生成し、前記参照アドレスを基準にして、指定された2次元パラメータ座標値に対応するテクセル値を読み出すことを特徴とする請求項1から5のいずれかに記載のテクスチャ処理装置。
A register for storing a base address for collectively referring to the texture structure;
The texture reading unit adds an offset value depending on the designated third parameter to the base address stored in the register, thereby obtaining the two-dimensional texture corresponding to the designated third parameter. 6. The texture processing apparatus according to claim 1, wherein a reference address is generated, and a texel value corresponding to a designated two-dimensional parameter coordinate value is read out based on the reference address.
前記テクスチャ構造体に含まれる複数の2次元テクスチャの各々は、段階的に解像度を異ならせた一組のミップマップテクスチャであり、
前記テクスチャ読み出し部は、前記描画対象物の表面に適用されるテクスチャの描画詳細度の指定も受け、指定された第3パラメータに対応する一組のミップマップテクスチャの内、指定された描画詳細度に対応する解像度のミップマップテクスチャを選択し、選択されたミップマップテクスチャから、指定された前記2次元パラメータ座標値に対応するテクセル値を読み出すことを特徴とする請求項1から6のいずれかに記載のテクスチャ処理装置。
Each of the plurality of two-dimensional textures included in the texture structure is a set of mipmap textures having different resolutions in stages.
The texture reading unit also receives designation of the drawing detail level of the texture applied to the surface of the drawing object, and the designated drawing detail level of the set of mipmap textures corresponding to the designated third parameter 7. The mipmap texture having a resolution corresponding to 1 is selected, and the texel value corresponding to the designated two-dimensional parameter coordinate value is read from the selected mipmap texture. The texture processing apparatus described.
前記テクスチャ読み出し部は、指定された第3パラメータに対応する一組のミップマップテクスチャの内、指定された描画詳細度に対応する2つの異なる解像度のミップマップテクスチャを選択し、選択された2つの異なる解像度のミップマップテクスチャの各々から、指定された前記2次元パラメータ座標値に対応するテクセル値を読み出し、
前記フィルタは、前記2つの異なる解像度のミップマップテクスチャ間で前記テクセル値を補間することにより、前記描画対象物の表面に適用されるテクスチャに関する値を算出することを特徴とする請求項7に記載のテクスチャ処理装置。
The texture reading unit selects two different resolution mipmap textures corresponding to the specified drawing detail level from the set of mipmap textures corresponding to the specified third parameter, and selects the selected two Read out the texel values corresponding to the specified two-dimensional parameter coordinate values from each of the mipmap textures of different resolutions,
The said filter calculates the value regarding the texture applied to the surface of the said drawing target object by interpolating the said texel value between the said two mipmap textures of different resolution. Texture processing equipment.
テクスチャに関する値を2次元パラメータ座標に対応づけてテクセル値として格納した2次元テクスチャが複数設けられ、前記複数の2次元テクスチャの少なくとも1つを指定するための第3パラメータが前記2次元パラメータ座標における第1および第2パラメータとは別に設けられたテクスチャ構造体を格納するテクスチャ構造体を格納するテクスチャ記憶部と、
描画対象物の表面に適用されるテクスチャについて前記第3パラメータの指定と前記表面上の2次元パラメータ座標値の指定とを受け、前記テクスチャ構造体の内、指定された前記第3パラメータに対応する前記2次元テクスチャから、指定された前記2次元パラメータ座標値に対応するテクセル値を読み出して、前記描画対象物の表面に適用されるテクスチャに関する補間値を算出するテクスチャ処理部と、
前記テクスチャ処理部から出力される前記テクスチャに関する補間値を用いて、前記描画対象物の描画演算処理を行う描画処理部とを含み、
前記テクスチャ構造体は、前記描画対象物の存在する空間内に仮想的に設けられた立方体の面に投影された環境テクスチャを面数だけ設けた構造を有し、
前記描画処理部は、前記描画対象物の表面の反射ベクトルにもとづいて、前記表面に写像される環境テクスチャの面番号とその面内における2次元パラメータ座標値とを求め、求めた面番号を前記第3パラメータとして2次元パラメータ座標値とともに前記テクスチャ処理部に対して指定し、
前記テクスチャ処理部は、前記テクスチャ構造体の内、前記描画処理部により前記第3パラメータとして指定された前記面番号に対応する環境テクスチャから、前記描画処理部により指定された前記2次元パラメータ座標値に対応するテクセル値を読み出し、前記描画対象物の表面に適用されるテクスチャに関する補間値を算出することを特徴とする描画処理装置。
A plurality of two-dimensional textures in which values relating to texture are stored as texel values in association with two-dimensional parameter coordinates are provided, and a third parameter for designating at least one of the plurality of two-dimensional textures is the two-dimensional parameter coordinates A texture storage unit for storing a texture structure for storing a texture structure provided separately from the first and second parameters;
The texture applied to the surface of the drawing object is designated by the third parameter and the two-dimensional parameter coordinate value on the surface, and corresponds to the designated third parameter in the texture structure. A texture processing unit that reads out a texel value corresponding to the specified two-dimensional parameter coordinate value from the two-dimensional texture, and calculates an interpolation value related to the texture applied to the surface of the drawing target;
A drawing processing unit that performs drawing calculation processing of the drawing target using an interpolation value related to the texture output from the texture processing unit;
The texture structure has a structure in which only the number of environmental textures projected on a cube surface virtually provided in the space where the drawing target exists is provided,
The drawing processing unit obtains the surface number of the environmental texture mapped to the surface and the two-dimensional parameter coordinate value in the surface based on the reflection vector of the surface of the drawing object, The third parameter is specified to the texture processing unit together with the two-dimensional parameter coordinate value,
The texture processing unit includes the two-dimensional parameter coordinate value specified by the drawing processing unit from an environmental texture corresponding to the surface number specified as the third parameter by the drawing processing unit in the texture structure. The drawing processing apparatus is characterized in that the texel value corresponding to is read and an interpolation value related to the texture applied to the surface of the drawing object is calculated.
テクスチャに関する値を2次元パラメータ座標に対応づけてテクセル値として格納した2次元テクスチャが複数設けられ、前記複数の2次元テクスチャの少なくとも1つを指定するための第3パラメータが前記2次元パラメータ座標における第1および第2パラメータとは別に設けられた構造体を有し、前記2次元パラメータ座標値および前記第3パラメータを指定したテクスチャの読み出し命令により、指定された第3パラメータに対応する前記2次元テクスチャから、指定された前記2次元パラメータ座標値に対応する前記テクセル値のサンプリングが可能に構成され、前記第3パラメータとして、前記構造体に含まれる前記複数の2次元テクスチャ間の関連性に応じた値が指定されることにより、異なる種類の前記構造体の統一的な参照が可能に構成されたことを特徴とするテクスチャのデータ構造。   A plurality of two-dimensional textures in which values relating to the texture are stored as texel values in association with the two-dimensional parameter coordinates are provided, and a third parameter for designating at least one of the plurality of two-dimensional textures is the two-dimensional parameter coordinates The two-dimensional structure having a structure provided separately from the first and second parameters, and corresponding to the designated third parameter by a texture read command designating the two-dimensional parameter coordinate value and the third parameter Sampling of the texel value corresponding to the specified two-dimensional parameter coordinate value is possible from a texture, and the third parameter corresponds to the relationship between the plurality of two-dimensional textures included in the structure. Specified values, the uniform participation of different types of structures Data structure of the texture, characterized in that is configured to be. テクスチャに関する値を2次元パラメータ座標に対応づけてテクセル値として格納した2次元テクスチャが複数設けられ、前記複数の2次元テクスチャの少なくとも1つを指定するための第3パラメータが前記2次元パラメータ座標における第1および第2パラメータとは別に設けられたテクスチャ構造体を保持したテクスチャメモリに対して、描画対象物の表面に適用されるテクスチャについて前記第3パラメータと前記表面上の2次元パラメータ座標値を指定したテクスチャの読み出し命令を実行することにより、指定された前記第3パラメータに対応する前記2次元テクスチャから、指定された前記2次元パラメータ座標値に対応するテクセル値をサンプリングするステップと、
サンプリングされた前記テクセル値を補間して、前記描画対象物の表面に適用されるテクスチャに関する値を算出するステップとを含み、
前記第3パラメータとして、前記テクスチャ構造体に含まれる前記複数の2次元テクスチャ間の関連性に応じた値が指定されることにより、異なる種類の前記テクスチャ構造体が統一的に参照されることを特徴とするテクスチャ処理方法。
A plurality of two-dimensional textures in which values relating to texture are stored as texel values in association with two-dimensional parameter coordinates are provided, and a third parameter for designating at least one of the plurality of two-dimensional textures is the two-dimensional parameter coordinates For a texture memory holding a texture structure provided separately from the first and second parameters, the third parameter and the two-dimensional parameter coordinate values on the surface are applied to the texture applied to the surface of the drawing object. Sampling a texel value corresponding to the specified two-dimensional parameter coordinate value from the two-dimensional texture corresponding to the specified third parameter by executing a specified texture read command;
Interpolating the sampled texel values to calculate a value relating to a texture applied to the surface of the drawing object;
By specifying a value according to the relationship between the plurality of two-dimensional textures included in the texture structure as the third parameter, the different types of the texture structures are referred to uniformly. A characteristic texture processing method.
JP2005063113A 2005-03-07 2005-03-07 Texture processing device, picture drawing processing device, and texture processing method Pending JP2006244426A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2005063113A JP2006244426A (en) 2005-03-07 2005-03-07 Texture processing device, picture drawing processing device, and texture processing method
PCT/JP2005/022536 WO2006095481A1 (en) 2005-03-07 2005-12-08 Texture processing device, drawing processing device, and texture processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005063113A JP2006244426A (en) 2005-03-07 2005-03-07 Texture processing device, picture drawing processing device, and texture processing method

Publications (1)

Publication Number Publication Date
JP2006244426A true JP2006244426A (en) 2006-09-14

Family

ID=36953087

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005063113A Pending JP2006244426A (en) 2005-03-07 2005-03-07 Texture processing device, picture drawing processing device, and texture processing method

Country Status (2)

Country Link
JP (1) JP2006244426A (en)
WO (1) WO2006095481A1 (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008305408A (en) * 2007-06-07 2008-12-18 Nvidia Corp Extrapolation of nonresident mipmap data using resident mipmap data
JP2009165106A (en) * 2007-12-17 2009-07-23 Nvidia Corp Image distortion correction
JP2010527077A (en) * 2007-05-07 2010-08-05 クゥアルコム・インコーポレイテッド Graphics overlay after rendering
US7944453B1 (en) 2007-06-07 2011-05-17 Nvidia Corporation Extrapolation texture filtering for nonresident mipmaps
JP2011524562A (en) * 2008-05-30 2011-09-01 アドバンスト・マイクロ・ディバイシズ・インコーポレイテッド Scalable and integrated computer system
JP2015095259A (en) * 2013-11-14 2015-05-18 インテル コーポレイション Flexible filter logic for multimode filtering of graphical texture data
JP2018073388A (en) * 2016-11-02 2018-05-10 三星電子株式会社Samsung Electronics Co.,Ltd. Texture processing method and device of the same
JP2018101415A (en) * 2016-12-20 2018-06-28 三星電子株式会社Samsung Electronics Co.,Ltd. Method, apparatus, computer program and storage medium for determining lod for texturing cube map
JP2022536738A (en) * 2019-06-10 2022-08-18 フアシア ジェネラル プロセッサー テクノロジーズ インコーポレイテッド Hardware accelerator for texture mapping based on dual buffer architecture

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6320624B2 (en) * 2015-03-25 2018-05-09 三菱電機株式会社 Texture mapping apparatus, texture mapping method and program
CN113643414B (en) * 2020-05-11 2024-02-06 北京达佳互联信息技术有限公司 Three-dimensional image generation method and device, electronic equipment and storage medium
CN113658064A (en) * 2021-08-03 2021-11-16 网易(杭州)网络有限公司 Texture image generation method and device and electronic equipment

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB9611941D0 (en) * 1996-06-07 1996-08-07 Philips Electronics Nv Three-dimensional image texture mapping
JP3367509B2 (en) * 1999-12-16 2003-01-14 株式会社セガ Image generating method and image generating apparatus using the same
JP4856335B2 (en) * 2001-09-17 2012-01-18 株式会社バンダイナムコゲームス Program, information storage medium, and game apparatus
JP3589654B2 (en) * 2002-03-12 2004-11-17 独立行政法人理化学研究所 Volume rendering method and its program
JP2004164308A (en) * 2002-11-13 2004-06-10 Toshiba Denpa Products Kk Sea surface status expression method by computer graphics
JP2005025254A (en) * 2003-06-30 2005-01-27 Toshiba Corp Computer graphics plotting device

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010527077A (en) * 2007-05-07 2010-08-05 クゥアルコム・インコーポレイテッド Graphics overlay after rendering
JP2008305408A (en) * 2007-06-07 2008-12-18 Nvidia Corp Extrapolation of nonresident mipmap data using resident mipmap data
US7944453B1 (en) 2007-06-07 2011-05-17 Nvidia Corporation Extrapolation texture filtering for nonresident mipmaps
US7948500B2 (en) 2007-06-07 2011-05-24 Nvidia Corporation Extrapolation of nonresident mipmap data using resident mipmap data
JP2009165106A (en) * 2007-12-17 2009-07-23 Nvidia Corp Image distortion correction
JP2011524562A (en) * 2008-05-30 2011-09-01 アドバンスト・マイクロ・ディバイシズ・インコーポレイテッド Scalable and integrated computer system
JP2015095259A (en) * 2013-11-14 2015-05-18 インテル コーポレイション Flexible filter logic for multimode filtering of graphical texture data
US9367948B2 (en) 2013-11-14 2016-06-14 Intel Corporation Flexible filter logic for multi-mode filtering of graphical texture data
JP2018073388A (en) * 2016-11-02 2018-05-10 三星電子株式会社Samsung Electronics Co.,Ltd. Texture processing method and device of the same
JP2018101415A (en) * 2016-12-20 2018-06-28 三星電子株式会社Samsung Electronics Co.,Ltd. Method, apparatus, computer program and storage medium for determining lod for texturing cube map
US10593096B2 (en) 2016-12-20 2020-03-17 Samsung Electronics Co., Ltd. Graphics processing employing cube map texturing
JP7096661B2 (en) 2016-12-20 2022-07-06 三星電子株式会社 Methods, equipment, computer programs and recording media to determine the LOD for texturing a cubemap
JP2022536738A (en) * 2019-06-10 2022-08-18 フアシア ジェネラル プロセッサー テクノロジーズ インコーポレイテッド Hardware accelerator for texture mapping based on dual buffer architecture
JP7227404B2 (en) 2019-06-10 2023-02-21 フアシア ジェネラル プロセッサー テクノロジーズ インコーポレイテッド Hardware accelerator for texture mapping based on dual buffer architecture

Also Published As

Publication number Publication date
WO2006095481A1 (en) 2006-09-14

Similar Documents

Publication Publication Date Title
JP2006244426A (en) Texture processing device, picture drawing processing device, and texture processing method
US10867434B2 (en) Variable rate shading
US10546412B2 (en) Variable rate shading
US7142215B1 (en) Method and apparatus for processing stencil data using a programmable graphics processor
US6518974B2 (en) Pixel engine
US7742060B2 (en) Sampling methods suited for graphics hardware acceleration
US5704024A (en) Method and an apparatus for generating reflection vectors which can be unnormalized and for using these reflection vectors to index locations on an environment map
US8319789B2 (en) Image generation device and image generation method
JP4977712B2 (en) Computer graphics processor and method for rendering stereoscopic images on a display screen
US7038678B2 (en) Dependent texture shadow antialiasing
JP7096661B2 (en) Methods, equipment, computer programs and recording media to determine the LOD for texturing a cubemap
US20050243101A1 (en) Image generation apparatus and image generation method
WO2008013605A1 (en) Real-time gpu rendering of piecewise algebraic surfaces
WO2006048961A1 (en) Drawing device and drawing method
US7405735B2 (en) Texture unit, image rendering apparatus and texel transfer method for transferring texels in a batch
US7027047B2 (en) 3D graphics rendering engine for processing an invisible fragment and a method therefor
US7525553B2 (en) Computer graphics processor and method for generating a computer graphics image
JPH11161819A (en) Image processor, its method and recording medium recording image processing program
US20100302259A1 (en) Drawing data processing method, graphics drawing system and graphics drawing data generation program
JP2018032301A (en) Image data processing method in image processing processor and program therefor
US7385604B1 (en) Fragment scattering
JP4060375B2 (en) Spotlight characteristic forming method and image processing apparatus using the same
KR101227155B1 (en) Graphic image processing apparatus and method for realtime transforming low resolution image into high resolution image
JP4692956B2 (en) Drawing processing apparatus and drawing processing method

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20061003

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20061128

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20061226