JP2013050895A - Game device, game device control method, and program - Google Patents
Game device, game device control method, and program Download PDFInfo
- Publication number
- JP2013050895A JP2013050895A JP2011189348A JP2011189348A JP2013050895A JP 2013050895 A JP2013050895 A JP 2013050895A JP 2011189348 A JP2011189348 A JP 2011189348A JP 2011189348 A JP2011189348 A JP 2011189348A JP 2013050895 A JP2013050895 A JP 2013050895A
- Authority
- JP
- Japan
- Prior art keywords
- image
- pixel
- pixel position
- value
- pixel 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
Links
Images
Abstract
Description
本発明は、ゲーム世界を表す仮想空間に配置されるオブジェクトの輪郭を描画するのに好適なゲーム装置、ゲーム装置の制御方法、ならびに、これらをコンピュータにて実現するプログラムに関する。 The present invention relates to a game device suitable for drawing an outline of an object arranged in a virtual space representing a game world, a control method for the game device, and a program for realizing these on a computer.
従来から、各種のキャラクターや物体等のオブジェクトが登場するゲーム世界を、仮想空間に配置されるポリゴンや、制御点の位置や重みにより形状が定められるサーフェスを組み合わせることによって表現し、仮想空間を見た様子を表す画像を生成する技術が提案されている。 Traditionally, a game world in which objects such as various characters and objects appear is expressed by combining polygons arranged in the virtual space and surfaces whose shapes are determined by the positions and weights of the control points. There has been proposed a technique for generating an image representing the appearance.
これらの技術では、仮想空間内に配置される視点と視線方向に基づいて仮想空間内に投影面が設定される。 In these techniques, a projection plane is set in the virtual space based on the viewpoint and the line-of-sight direction arranged in the virtual space.
そして、ポリゴンやサーフェスの各箇所と視点とを結ぶ線分が投影面と交差する交差点に当該箇所を投影する透視投影の技術や、ポリゴンやサーフェスの各箇所から視線方向に平行に視点に近付くように伸ばした半直線が投影面と交差する交差点に当該箇所を投影する平行投影の技術を用いて、仮想空間内の様子を表す画像が生成される。 And, the perspective projection technology that projects the part to the intersection where the line connecting each point of the polygon or surface and the viewpoint intersects the projection plane, or the polygon or surface from the part of the polygon or the surface to approach the viewpoint parallel to the line of sight An image representing the state in the virtual space is generated by using a parallel projection technique in which the half-line extended to the point where the half line intersects the projection plane is projected.
ここで、透視投影や平行投影を用いるだけでは、仮想空間内の様子を表す画像では、オブジェクトの輪郭が線画として描画されることはない。 Here, if only perspective projection or parallel projection is used, the outline of the object is not drawn as a line drawing in the image representing the state in the virtual space.
そこで、視点の位置や視線方向が変化した場合であっても、オブジェクトの輪郭を得る技術が提案されている。 Therefore, a technique has been proposed for obtaining the contour of an object even when the position of the viewpoint or the line-of-sight direction changes.
ここで、特許文献1には、画像の輪郭をエッジ抽出フィルタにより抽出して2値化する際の閾値を動的に定める技術が開示されている。本技術は、輪郭で区切られる2つの領域が異なる色であることを前提としている。 Here, Patent Document 1 discloses a technique for dynamically determining a threshold value when an image contour is extracted by an edge extraction filter and binarized. The present technology is based on the premise that the two regions separated by the contour are different colors.
特許文献2には、オブジェクトを表す立体モデルと、当該立体モデルを拡大しポリゴンの法線ベクトルを反転させた裏モデルと、を用意して、視点方向から見えるポリゴンのみを描画することにより輪郭を描画する技術が開示されている。本技術は、オブジェクトの周囲の輪郭を描くのに好適である。 In Patent Document 2, a stereo model representing an object and a back model obtained by enlarging the stereo model and inverting the normal vector of the polygon are prepared, and the outline is drawn by drawing only the polygon visible from the viewpoint direction. A technique for drawing is disclosed. This technique is suitable for drawing an outline around an object.
これらの技術によれば、仮想空間内の様子を表す画像において、オブジェクトと背景を区切る輪郭を描画することができる。 According to these techniques, it is possible to draw an outline that separates the object and the background in an image representing a state in the virtual space.
しかしながら、上記の先行技術よりも簡易に輪郭を描画できるような技術が強く求められている。 However, there is a strong demand for a technique capable of drawing an outline more easily than the above prior art.
さらに、前景と背景の色が類似している場合であっても、輪郭を描けるようにしたいという要望がある。たとえば、白色のキャラクターを前景とし、白色の仮想世界を背景とする場合や、キャラクターの肌色の顎を前景とし、肌色の首を背景とする場合等である。 Furthermore, there is a desire to be able to draw an outline even when the foreground and background colors are similar. For example, when a white character is the foreground and the white virtual world is the background, or when the skin color jaw of the character is the foreground and the skin color neck is the background.
本発明は、上記のような課題を解決するもので、ゲーム世界を表す仮想空間に配置されるオブジェクトの輪郭を描画するのに好適なゲーム装置、ゲーム装置の制御方法、ならびに、これらをコンピュータにて実現するプログラムを提供することを目的とする。 The present invention solves the above-described problems. A game device suitable for drawing an outline of an object placed in a virtual space representing a game world, a control method for the game device, and these are stored in a computer. The purpose is to provide a program to be realized.
以上の目的を達成するため、本発明の原理にしたがって、下記の発明を開示する。 In order to achieve the above object, the following invention is disclosed in accordance with the principle of the present invention.
本発明の第1の観点に係るゲーム装置は、
ゲーム世界を表す仮想空間内に配置される複数のオブジェクトを当該仮想空間内に設定される視点から当該仮想空間内に設定される視線方向に見た様子を表す第1画像と、前記複数のオブジェクトのうち当該第1画像における各画素位置に描画されている箇所の前記視点に対する奥行を表す奥行値を各画素位置における画素値とする第2画像と、を生成する生成部、
前記第2画像に輪郭抽出フィルタを適用することにより、第3画像を得る抽出部、
前記第1画像を背景として、前記第3画像により表される輪郭を描画することにより、第4画像を得る描画部
を備えるように構成する。
A game device according to a first aspect of the present invention includes:
A first image representing a state in which a plurality of objects arranged in a virtual space representing the game world are viewed from a viewpoint set in the virtual space in a line-of-sight direction set in the virtual space; and the plurality of objects A generation unit that generates a second image having a depth value representing a depth with respect to the viewpoint at a position drawn at each pixel position in the first image as a pixel value at each pixel position,
An extraction unit that obtains a third image by applying a contour extraction filter to the second image;
The image processing apparatus includes a drawing unit that obtains a fourth image by drawing an outline represented by the third image with the first image as a background.
また、本発明のゲーム装置において、
前記生成部は、
前記第2画像の画素値がとりうる最大値を、当該第2画像における各画素位置の画素値の初期値とし、
前記複数のオブジェクトのそれぞれについて、
(a)当該オブジェクトが投影される領域を求め、
(b)前記求められた領域内の画素位置のそれぞれについて、当該画素位置の前記第2画像における画素値が当該オブジェクトの当該画素位置に投影される箇所に対する奥行値よりも小さければ、当該箇所が当該画素位置に投影される画素値を求めて、前記第1画像における当該画素位置の画素値を当該求められた画素値に更新し、前記第2画像における当該画素位置の画素値を当該オブジェクトの奥行値に更新する
処理を繰り返すことにより、前記第1画像と、前記第2画像と、を生成する
ように構成することができる。
In the game device of the present invention,
The generator is
The maximum value that the pixel value of the second image can take is an initial value of the pixel value at each pixel position in the second image,
For each of the plurality of objects,
(A) Find the area where the object is projected,
(B) For each pixel position in the obtained area, if the pixel value in the second image at the pixel position is smaller than the depth value for the position projected on the pixel position of the object, the position is The pixel value projected to the pixel position is obtained, the pixel value at the pixel position in the first image is updated to the obtained pixel value, and the pixel value at the pixel position in the second image is changed to the object value. By repeating the process of updating to the depth value, the first image and the second image can be generated.
また、本発明のゲーム装置において、
前記各画素位置に対する奥行値は、前記視点から前記オブジェクトのうち当該画素位置に投影される箇所へのベクトルと、前記視線方向の単位ベクトルと、の内積に、前記第2画像の画素値がとりうる範囲の整数を値域とする単調増加関数を適用することにより得られる
ように構成することができる。
In the game device of the present invention,
The depth value for each pixel position is the pixel value of the second image, which is the inner product of the vector from the viewpoint to the portion of the object projected onto the pixel position and the unit vector in the line-of-sight direction. It can be configured to be obtained by applying a monotonically increasing function whose range is an integer of a possible range.
また、本発明のゲーム装置において、
前記輪郭抽出フィルタは、
前記第3画像における各画素位置の画素値の初期値を0とし、
前記第2画像における各画素位置を左から右に、隣り合う画素位置を走査して、左の画素位置の画素値が右の画素位置の画素値より大きければ、当該左の画素位置の画素値と当該右の画素位置の画素値との差で、前記第3画像における当該左の画素位置の画素値を更新し、
前記第2画像における各画素位置を右から左に、隣り合う画素位置を走査して、右の画素位置の画素値が左の画素位置の画素値より大きければ、当該右の画素位置の画素値と当該左の画素位置の画素値との差で、前記第3画像における当該右の画素位置の画素値を更新する
ように構成することができる。
In the game device of the present invention,
The contour extraction filter is:
The initial value of the pixel value at each pixel position in the third image is set to 0,
If each pixel position in the second image is scanned from left to right and adjacent pixel positions are scanned, and the pixel value at the left pixel position is greater than the pixel value at the right pixel position, the pixel value at the left pixel position And the pixel value of the left pixel position in the third image is updated with the difference between the pixel value of the right pixel position and the pixel value of the right pixel position,
If each pixel position in the second image is scanned from right to left and adjacent pixel positions are scanned, and the pixel value at the right pixel position is greater than the pixel value at the left pixel position, the pixel value at the right pixel position The pixel value at the right pixel position in the third image can be updated by the difference between the pixel value at the left pixel position and the pixel value at the left pixel position.
また、本発明のゲーム装置において、
前記輪郭抽出フィルタは、さらに、
前記第2画像における各画素位置を上から下に、隣り合う画素位置を走査して、上の画素位置の画素値が下の画素位置の画素値より大きければ、当該上の画素位置の画素値と当該下の画素位置の画素値との差で、前記第3画像における当該上の画素位置の画素値を更新し、
前記第2画像における各画素位置を下から上に、隣り合う画素位置を走査して、下の画素位置の画素値が上の画素位置の画素値より大きければ、当該下の画素位置の画素値と当該上の画素位置の画素値との差で、前記第3画像における当該下の画素位置の画素値を更新する
ように構成することができる。
In the game device of the present invention,
The contour extraction filter further includes:
If each pixel position in the second image is scanned from top to bottom and adjacent pixel positions are scanned, and the pixel value at the upper pixel position is greater than the pixel value at the lower pixel position, the pixel value at the upper pixel position And the pixel value at the upper pixel position in the third image is updated with the difference between the pixel value at the lower pixel position and the pixel value at the lower pixel position,
If each pixel position in the second image is scanned from the bottom to the top and adjacent pixel positions are scanned, and the pixel value at the lower pixel position is larger than the pixel value at the upper pixel position, the pixel value at the lower pixel position The pixel value at the lower pixel position in the third image can be updated by the difference between the pixel value at the upper pixel position and the pixel value at the upper pixel position.
また、本発明のゲーム装置において、
前記輪郭抽出フィルタは、前記隣り合う画素位置の画素値の差にかえて、当該差に前記第3画像の画素値がとりうる範囲の整数を値域とする単調増加関数を適用することにより得られる値で、前記第3画像における画素値を更新する
ように構成することができる。
In the game device of the present invention,
The contour extraction filter is obtained by applying a monotonically increasing function whose range is an integer of a range that can be taken by the pixel value of the third image, instead of the difference between the pixel values of the adjacent pixel positions. The pixel value in the third image can be updated with the value.
また、本発明のゲーム装置において、
前記描画部は、前記第4画像の各画素位置について、
(a)当該画素位置の前記第3画像における画素値が0であれば、当該画素位置の前記第1画像における画素値を、前記第4画像における当該画素位置の画素値とし、
(b)当該画素位置の前記第3画像における画素値が0でなければ、所定の色相ならびに彩度を有し、当該画素位置の前記第3画像における画素値を暗度とする色を表す画素値を、前記第4画像における当該画素位置の画素値とする
ように構成することができる。
In the game device of the present invention,
The drawing unit, for each pixel position of the fourth image,
(A) If the pixel value in the third image at the pixel position is 0, the pixel value in the first image at the pixel position is set as the pixel value at the pixel position in the fourth image;
(B) If the pixel value in the third image at the pixel position is not 0, the pixel has a predetermined hue and saturation and represents a color having the pixel value in the third image at the pixel position as darkness The value can be configured to be a pixel value of the pixel position in the fourth image.
また、本発明のゲーム装置において、
前記描画部は、前記第4画像の各画素位置について、当該画素位置の前記第1画像における画素値により表される色を、当該画素位置の前記第3画像における画素値により表される強さで暗くした色を表す画素値を、前記第4画像における当該画素位置の画素値とする
ように構成することができる。
In the game device of the present invention,
For each pixel position of the fourth image, the drawing unit displays the color represented by the pixel value in the first image at the pixel position, and the intensity represented by the pixel value in the third image at the pixel position. The pixel value representing the darkened color can be configured to be the pixel value at the pixel position in the fourth image.
本発明の第2の観点に係る制御方法は、生成部、抽出部、描画部を有するゲーム装置が実行し、
前記生成部が、ゲーム世界を表す仮想空間内に配置される複数のオブジェクトを当該仮想空間内に設定される視点から当該仮想空間内に設定される視線方向に見た様子を表す第1画像と、前記複数のオブジェクトのうち当該第1画像における各画素位置に描画されている箇所の前記視点に対する奥行を表す奥行値を各画素位置における画素値とする第2画像と、を生成する生成工程、
前記抽出部が、前記第2画像に輪郭抽出フィルタを適用することにより、第3画像を得る抽出工程、
前記描画部が、前記第1画像を背景として、前記第3画像により表される輪郭を描画することにより、第4画像を得る描画工程
を備えるように構成する。
The control method according to the second aspect of the present invention is executed by a game device having a generation unit, an extraction unit, and a drawing unit,
A first image representing a state in which the generation unit viewed a plurality of objects arranged in a virtual space representing a game world from a viewpoint set in the virtual space in a line-of-sight direction set in the virtual space; A generation step of generating a second image having a depth value representing a depth with respect to the viewpoint at a position drawn at each pixel position in the first image among the plurality of objects as a pixel value at each pixel position;
An extraction step in which the extraction unit obtains a third image by applying a contour extraction filter to the second image;
The drawing unit includes a drawing step of drawing a contour represented by the third image with the first image as a background to obtain a fourth image.
本発明の第3の観点に係るプログラムは、コンピュータを、
ゲーム世界を表す仮想空間内に配置される複数のオブジェクトを当該仮想空間内に設定される視点から当該仮想空間内に設定される視線方向に見た様子を表す第1画像と、前記複数のオブジェクトのうち当該第1画像における各画素位置に描画されている箇所の前記視点に対する奥行を表す奥行値を各画素位置における画素値とする第2画像と、を生成する生成部、
前記第2画像に輪郭抽出フィルタを適用することにより、第3画像を得る抽出部、
前記第1画像を背景として、前記第3画像により表される輪郭を描画することにより、第4画像を得る描画部
として機能させるように構成する。
A program according to a third aspect of the present invention provides a computer,
A first image representing a state in which a plurality of objects arranged in a virtual space representing the game world are viewed from a viewpoint set in the virtual space in a line-of-sight direction set in the virtual space; and the plurality of objects A generation unit that generates a second image having a depth value representing a depth with respect to the viewpoint at a position drawn at each pixel position in the first image as a pixel value at each pixel position,
An extraction unit that obtains a third image by applying a contour extraction filter to the second image;
The first image is used as a background, and the contour represented by the third image is drawn to function as a drawing unit that obtains the fourth image.
本発明のプログラムは、コンパクトディスク、フレキシブルディスク、ハードディスク、光磁気ディスク、ディジタルビデオディスク、磁気テープ、半導体メモリ等のコンピュータ読取可能な情報記憶媒体に記録することができる。 The program of the present invention can be recorded on a computer-readable information storage medium such as a compact disk, flexible disk, hard disk, magneto-optical disk, digital video disk, magnetic tape, and semiconductor memory.
上記プログラムは、プログラムが実行されるコンピュータとは独立して、コンピュータ通信網を介して配布・販売することができる。また、上記情報記憶媒体は、コンピュータとは独立して配布・販売することができる。 The above program can be distributed and sold via a computer communication network independently of the computer on which the program is executed. The information storage medium can be distributed and sold independently from the computer.
本発明によれば、ゲーム世界を表す仮想空間に配置されるオブジェクトの輪郭を描画するのに好適なゲーム装置、ゲーム装置の制御方法、ならびに、これらをコンピュータにて実現するプログラムを提供することができる。 According to the present invention, it is possible to provide a game device suitable for drawing an outline of an object placed in a virtual space representing the game world, a control method for the game device, and a program for realizing these on a computer. it can.
以下に本発明の実施形態を説明する。以下では、理解を容易にするため、ゲーム用の情報処理装置を利用して本発明が実現される実施形態を説明するが、以下に説明する実施形態は説明のためのものであり、本願発明の範囲を制限するものではない。したがって、当業者であればこれらの各要素もしくは全要素をこれと均等なものに置換した実施形態を採用することが可能であるが、これらの実施形態も本発明の範囲に含まれる。 Embodiments of the present invention will be described below. In the following, for ease of understanding, an embodiment in which the present invention is realized using a game information processing device will be described. However, the embodiment described below is for explanation, and the present invention It does not limit the range. Therefore, those skilled in the art can employ embodiments in which each or all of these elements are replaced with equivalent ones, and these embodiments are also included in the scope of the present invention.
(情報処理装置)
図1は、プログラムを実行することにより、本実施形態のゲーム装置として機能しうる典型的な情報処理装置の概要構成を示す模式図である。以下、本図を参照して説明する。
(Information processing device)
FIG. 1 is a schematic diagram illustrating a schematic configuration of a typical information processing apparatus that can function as the game apparatus of the present embodiment by executing a program. Hereinafter, a description will be given with reference to FIG.
本図に示す情報処理装置100は、いわゆるコンシューマゲーム機に相当するもので、CPU(Central Processing Unit)101、ROM(Read Only Memory)102、RAM(Random Access Memory)103、インターフェース104、コントローラ105、外部メモリ106、画像処理部107、DVD−ROM(Digital Versatile Disc ROM)ドライブ108、NIC(Network Interface Card)109、音声処理部110、マイク111、ハードディスク(Hard Disk;HD)121、カメラ131を有する。各種の入出力装置は、適宜省略することができる。
An
情報処理装置100を典型的なコンシューマゲーム機として機能させる場合には、まず、ユーザは、ゲーム用プログラムおよびデータを記憶したDVD−ROMをDVD−ROMドライブ108に装着する。ついで、ユーザが電源を投入すると、当該ゲームプログラムが実行され、ユーザはゲームをプレイすることができるようになる。
When functioning the
ただし、本実施形態においては、典型的には、DVD−ROMから、アプリケーションがHD 121にインストールされる。なお、DVD−ROMは、DVD−ROMドライブ108に装着される。そして、当該HD 121に記憶されたプログラムを実行することによって、ゲームを含む各種のアプリケーションが実行されることとする。
However, in this embodiment, typically, an application is installed in the
なお、携帯型のゲーム装置においては、携帯可能とするために、HD 121を省略することも可能である。この場合、DVD−ROMドライブ108は利用されない。そして、ユーザは、ROMカセット用スロットにEEPROM(Electrically Erasable Programmable ROM)カセットを装着する。EEPROMカセットには、アプリケーション用プログラムが書き込まれている。そして、当該プログラムが実行されることとなる。このほか、外部メモリ106にアプリケーション用プログラムをインストールすることも可能である。
Note that in a portable game device, the
さて、CPU 101は、情報処理装置100全体の動作を制御し、各構成要素と接続され制御信号やデータをやりとりする。また、CPU 101は、レジスタ(図示せず)という高速アクセスが可能な記憶域を備える。CPU 101は、レジスタに対してALU(Arithmetic Logic Unit)(図示せず)を用いて、各種演算を行うことができる。行われる演算は、例えば、加減乗除等の算術演算や、論理和、論理積、論理否定等の論理演算、ビット和、ビット積、ビット反転、ビットシフト、ビット回転等のビット演算などである。さらに、CPU 101は、マルチメディア処理対応のための加減乗除等の飽和演算や、三角関数等、ベクトル演算などを高速に行えるように構成されていてもよい。また、CPU 101は、コプロセッサを備えることにより、このような高速演算を実現してもよい。
The
ROM 102には、電源投入直後に実行されるIPL(Initial Program Loader)が記録されている。IPLが実行されることにより、DVD−ROMに記録されたプログラムは、RAM 103に読み出される。ついで、CPU 101による当該プログラムの実行が開始される。また、ROM 102には、オペレーティングシステムのプログラムや各種のデータが記録されている。オペレーティングシステムは、情報処理装置100全体の動作を制御するために必要とされる。
The
RAM 103は、データやプログラムを一時的に記憶する。RAM 103には、HD 121やDVD−ROM等から読み出されたプログラムやデータ、その他通信対戦ゲームの進行やチャット通信に必要なデータが保持される。また、CPU 101は、RAM 103に変数領域を設ける。CPU 101は、当該変数に格納された値に対して直接ALUを作用させて演算してもよい。また、CPU 101は、RAM 103に格納された値を一旦レジスタに格納してからレジスタに対して演算を行い、演算結果をメモリに書き戻してもよい。
The
コントローラ105は、インターフェース104を介して接続される。コントローラ105は、ユーザがゲーム実行の際に行う操作入力を受け付ける。
The
なお、コントローラ105は、必ずしも情報処理装置100に対して外付けにされている必要はなく、一体に形成されていても良い。携帯可能な画像処理装置のコントローラ105は、各種のボタンやスイッチから構成される。コントローラ105は、当該ボタンやスイッチに対する押圧操作を操作入力として扱う。このほか、タッチスクリーンを利用した情報処理装置100では、ユーザがペンや指を利用してタッチスクリーンをなぞった軌跡を操作入力として扱う。
The
外部メモリ106は、インターフェース104を介して着脱自在に接続される。外部メモリ106には、ゲーム等のプレイ状況(過去の成績等)を示すデータ、ゲームの進行状態を示すデータ、ネットワーク対戦の場合のチャット通信のログ(記録)のデータなどが記憶される。外部メモリ106は書き換え可能である。ユーザがコントローラ105を介して必要な指示入力を行うと、これらのデータは適宜外部メモリ106に記録される。
The
上述の通り、アプリケーションプログラムを外部メモリ106にインストールして実行するような形態を採用することもできる。これは、外部メモリ106が大容量である場合に好適である。
As described above, it is possible to adopt a form in which the application program is installed in the
DVD−ROMドライブ108に装着されるDVD−ROMには、ゲームを実現するためのプログラムとゲームに付随する画像データや音声データが記録される。CPU 101の制御によって、DVD−ROMドライブ108は、装着されたDVD−ROMに対する読み出し処理を行って、必要なプログラムやデータを読み出す。読み出されたプログラムやデータは、RAM 103等に一時的に記憶される。
A DVD-ROM mounted on the DVD-
画像処理部107は、まず、DVD−ROMから読み出されたデータをCPU 101や画像処理部107が備える画像演算プロセッサ(図示せず)によって加工処理する。ついで、画像処理部107は、加工処理により得た画像情報を、フレームメモリ(図示せず)に記録する。フレームメモリは、画像処理部107に搭載されている。フレームメモリに記録された画像情報は、所定の同期タイミングでビデオ信号に変換され、画像処理部107に接続されるモニタ(図示せず)へ出力される。これにより、各種の画像表示が可能となる。
The
携帯可能な画像処理装置のモニタとしては、小型の液晶ディスプレイを利用するのが典型的である。コントローラ105としてタッチスクリーンが利用される場合には、当該タッチスクリーンの表示パネルがモニタとして機能する。自宅で遊ぶためのゲーム装置のモニタとしては、CRT(Cathode Ray Tube)やプラズマディスプレイなどの表示装置を利用することも可能である。
As a monitor of a portable image processing apparatus, a small liquid crystal display is typically used. When a touch screen is used as the
画像演算プロセッサは、2次元の画像の重ね合わせ演算やαブレンディング等の透過演算、各種の飽和演算を高速に実行できる。 The image calculation processor can execute a two-dimensional image overlay calculation, a transmission calculation such as α blending, and various saturation calculations at high speed.
また、レンダリング画像を得る演算を高速実行することも可能である。レンダリング画像は、所定の視点位置から仮想3次元空間に配置されたポリゴンを所定の視線の方向へ俯瞰した画像である。レンダリング画像は、当該3次元空間内に配置され、各種のテクスチャ情報が付加されたポリゴン情報を、Zバッファ法などによりレンダリングすることにより得られる。 It is also possible to execute a calculation for obtaining a rendered image at high speed. The rendering image is an image obtained by bird's-eye view of a polygon arranged in a virtual three-dimensional space from a predetermined viewpoint position in a predetermined line of sight. The rendered image is obtained by rendering polygon information, which is arranged in the three-dimensional space and to which various kinds of texture information are added, by the Z buffer method or the like.
さらに、CPU 101と画像演算プロセッサが協調動作することにより、フォント情報にしたがって、文字列を2次元画像として描画することが可能である。なお、フォント情報は、文字の形状を定義する。文字列を表す画像は、フレームメモリや各ポリゴン表面へ描画される。
Further, the
NIC 109は、インターネット接続機器(図示せず)と、CPU 101との仲立ちを行うインターフェースである。NIC 109は、情報処理装置100をインターネット等のコンピュータ通信網(図示せず)に接続する際に用いられる。インターネット接続機器は、LAN(Local Area Network)を構成する際に用いられる10BASE−T/100BASE−T規格にしたがうものや、電話回線を用いてインターネットに接続するためのアナログモデム、ISDN(Integrated Services Digital Network)モデム、ADSL(Asymmetric Digital Subscriber Line)モデム、ケーブルテレビジョン回線を用いてインターネットに接続するためのケーブルモデム等であっても良い。
The
また、NIC 109経由でコンピュータ通信網から入手した情報を元に、HD 121等にアプリケーションプログラムをインストールすることも可能である。
An application program can be installed in the
音声処理部110は、HD 121やDVD−ROMから読み出した音声データをアナログ音声信号に変換し、接続されたスピーカ(図示せず)から出力させる。また、CPU 101の制御の下、音声処理部110は、ゲームの進行の中で発生させるべき効果音や楽曲データを生成する。そして、音声処理部110は、生成した効果音や楽曲データに対応した音声をスピーカや、ヘッドホン(図示せず)、イヤフォン(図示せず)から出力させる。
The audio processing unit 110 converts audio data read from the
音声処理部110は、HD 121やDVD−ROMに記録された音声データがMIDIデータである場合には、音源データを参照して、MIDIデータをPCMデータに変換する。なお、音声処理部110は、MIDI音源データを有する。また、当該音声データがADPCM形式やOgg Vorbis形式等の圧縮済音声データである場合には、音声処理部110は、これを展開してPCMデータに変換する。PCMデータを、そのサンプリング周波数に応じたタイミングでD/A(Digital/Analog)変換し、スピーカに出力することにより、音声出力が可能となる。
When the audio data recorded on the
さらに、情報処理装置100には、インターフェース104を介してマイク111を接続することができる。この場合、マイク111からのアナログ信号に対しては、情報処理装置100は、適当なサンプリング周波数でA/D変換を行う。すなわち、マイク111からの音声信号は、PCM形式のディジタル信号に変換される。したがって、音声処理部110でミキシング等の処理を行うことが可能となる。
Furthermore, a
本実施形態で利用する情報処理装置100は、上述のように、HD 121等の大容量外部記憶装置を用いるのが典型的である。HD 121は、ROM 102、RAM 103、外部メモリ106、DVD−ROMドライブ108に装着されるDVD−ROM等と同じ機能を果たすこともできる。
As described above, the
さらに、本実施形態で利用する情報処理装置100には、カメラ131が接続されている。このカメラ131は、現実世界の様子を動画ならびに静止画で撮影する。カメラ131によりユーザの顔の表情や体の姿勢を撮影し、CPU 101や専用ハードウェア(図示せず)を利用して画像認識を行うことにより、ユーザの顔の位置や表情、体の各部位の位置を取得することができる。コントローラ105に対する指示操作にかえて、画像認識により得られた各種の情報を利用することも可能である。
Furthermore, a
このほか、キーボードや、マウスなどを接続する形態も採用することができる。キーボードは、ユーザからの文字列の編集入力を受け付ける。そして、マウスは、各種の位置の指定および選択入力を受け付ける。また、本実施形態の情報処理装置100にかえて、汎用のパーソナルコンピュータやサーバ用コンピュータ等を利用することもできる。
In addition, a form in which a keyboard, a mouse, or the like is connected can also be employed. The keyboard receives a character string editing input from the user. The mouse then accepts various position designations and selection inputs. In addition, a general-purpose personal computer, a server computer, or the like can be used instead of the
以上で説明した情報処理装置100は、コンシューマ向けゲーム装置に相当するものである。しかしながら、各種の入出力処理が可能な電子機器であれば、本発明のゲーム装置を実現することができる。したがって、携帯電話、携帯ゲーム機器、カラオケ装置、一般的なビジネス用コンピュータなど、種々の計算機上で本発明のゲーム装置を実現することが可能である。
The
たとえば、ビジネス用コンピュータは、上記情報処理装置100と同様に、CPU、RAM、ROM、DVD−ROMドライブ、および、NIC、HDを構成要素として有する。また、ビジネス用コンピュータは、情報処理装置100よりも簡易な機能を備えた画像処理部を備える。そして、ビジネス用コンピュータにおいては、外部記憶装置としてフレキシブルディスク、光磁気ディスク、磁気テープ等が利用できる。ビジネス用コンピュータにおいては、コントローラ105ではなく、キーボードやマウスなどが入力装置として利用されるのが典型的である。
For example, similarly to the
本発明に係るゲーム装置は、情報処理装置100において、DVD−ROMやハードディスク121に記録されたゲーム用のプログラムを、CPU 101が実行し、情報処理装置100の各部を制御することによって実現することが可能である。
The game apparatus according to the present invention is realized by the
また、専用の電子回路、あるいは、FPGA(Field Programmable Gate Array)等のような再構成可能な電子回路により、本発明に係るゲーム装置の各部を実現することも可能である。 Each unit of the game device according to the present invention can be realized by a dedicated electronic circuit or a reconfigurable electronic circuit such as an FPGA (Field Programmable Gate Array).
以下、本発明に係る各種の態様について説明する。以下では、理解を容易にするため、情報処理装置100にてゲーム用のプログラムを実現する場合を例として取り上げる。
Hereinafter, various aspects according to the present invention will be described. Hereinafter, in order to facilitate understanding, a case where a game program is realized in the
図2は、本実施形態に係るゲーム装置の概要構成を示す説明図である。以下、本図を参照して説明する。 FIG. 2 is an explanatory diagram showing a schematic configuration of the game device according to the present embodiment. Hereinafter, a description will be given with reference to FIG.
本実施形態に係るゲーム装置201は、生成部202、抽出部203、描画部204を備え、以下のように構成する。
The
本実施形態に係るゲーム装置201は、ゲーム世界を表す仮想空間内に配置される複数のオブジェクトを当該仮想空間内に設定される視点から当該仮想空間内に設定される視線方向に見た様子を表す画像を画面に表示する際に、当該画像において、当該複数のオブジェクトに適切な輪郭線を描くものである。
The
以下、理解を容易にするため、仮想空間内のオブジェクトや処理の対象となる画像を例示しながら説明するが、本発明の原理は、これらのオブジェクトや画像に限定されるものではなく、適宜変更が可能である。 Hereinafter, for ease of understanding, the object in the virtual space and the image to be processed will be described as an example. However, the principle of the present invention is not limited to these objects and images, and may be changed as appropriate. Is possible.
図3は、仮想空間内に配置されるオブジェクトの例を示す説明図である。以下、本図を参照して説明する。なお、本図は、製図における通常の規則を適用して描いているため、輪郭線が描かれているが、実際には、仮想空間内に輪郭線そのものは存在しない。 FIG. 3 is an explanatory diagram illustrating an example of objects arranged in the virtual space. Hereinafter, a description will be given with reference to FIG. Note that since this drawing is drawn by applying the normal rules for drafting, a contour line is drawn, but actually, the contour line itself does not exist in the virtual space.
本図に示す例では、仮想空間301内に、キャラクターの頭部を表す球オブジェクト302と、キャラクターの頸部を表す円柱オブジェクト303と、キャラクターの背景に配置される板オブジェクト304と、が配置されている。
In the example shown in this figure, a
本例では、円柱オブジェクト303は、球オブジェクト302と交差しており、球オブジェクト302の中心305からずれた箇所を円柱オブジェクト303の中心軸306が通過している。
In this example, the
円柱オブジェクト303と、球オブジェクト302と、は、いずれも白色であるが、板オブジェクト304は、これらとは異なる色彩である。そこで、板オブジェクト304の色彩は、ハッチングにより描かれている。
The
これらのオブジェクト302、303、304を、仮想空間301内に設定された視点307から視線308の方向へ、見た様子を、透視投影もしくは平行投影によって描画することにより、仮想空間内の様子を表す画像を得ることができる。
A state in which the
なお、本例では、理解を容易にするため、あらゆる方向から光が当たる環境光源を想定しているが、1つもしくは複数の点光源や平行光源を仮想空間301内に配置したり、これら各種の光源を組み合わせて利用することも可能である。
In this example, an environmental light source that is irradiated with light from all directions is assumed for easy understanding. However, one or a plurality of point light sources and parallel light sources may be arranged in the
また、本例では、オブジェクトとして球や円柱、板を採用しているが、オブジェクトとして、多角形(ポリゴン)を採用したり、曲面を表すサーフェスを採用することも可能である。 In this example, a sphere, a cylinder, or a plate is used as the object, but a polygon (polygon) or a surface representing a curved surface can be used as the object.
オブジェクト302、303、304の位置や向き、色彩や、視点307の位置や、視線308の向き等の情報は、RAM 103内に記憶される。
Information such as the positions and orientations and colors of the
すなわち、生成部202は、ゲーム世界を表す仮想空間301内に配置される複数のオブジェクトを当該仮想空間301内に設定される視点から当該仮想空間301内に設定される視線方向に見た様子を表す第1画像を生成する。
That is, the
図4は、第1画像の例を示す説明図である。以下、本図を参照して説明する。 FIG. 4 is an explanatory diagram illustrating an example of the first image. Hereinafter, a description will be given with reference to FIG.
第1画像401は、縦横に桝目状に画素が並んだビットマップ形式の画像である。本図では、理解を容易にするため、画素数を極めて少なく設定しているが、画素数は任意に変更が可能である。また、本図では、理解を容易にするため、第1画像401の外周に枠線を描いているが、画素同士の境界線は描いていない(以下同様)。
The
第1画像401の中央には、球オブジェクト302と円柱オブジェクト303とが白色で描画されている。上記のように、環境光源を想定しているため、両者の境界線は、描画されていない。このため、キャラクターの顎の輪郭がわかりにくくなっている。
In the center of the
また、第1画像401の周縁には、板オブジェクト304が見えている。すなわち、視点306から視線307の方向に仮想空間301を見たときに、その視界は板オブジェクト304で覆われている。
A
また、球オブジェクト302ならびに円柱オブジェクト303と、板オブジェクト304と、は、白色か、ハッチングがなされているか、の差があるため、その境界はわかるが、やはり輪郭線は描かれていない。
In addition, since there is a difference between the
従来、第1画像401に対して輪郭線を施す際には、第1画像401に対して、輪郭抽出フィルタを適用していた。この輪郭抽出フィルタとは、ハイパスフィルタに相当するものである。
Conventionally, when applying a contour line to the
最も単純な輪郭抽出フィルタは、ある画素と、当該画素に隣接する画素と、の画素値の差が、閾値を超えた場合に、当該ある画素を輪郭であるとみなすものである。 The simplest contour extraction filter regards a certain pixel as a contour when the difference in pixel value between a certain pixel and a pixel adjacent to the pixel exceeds a threshold value.
輪郭抽出フィルタには、どの画素同士を比較するか、閾値をどのように設定するか、によって、各種のバリエーションが提案されている。また、輪郭抽出フィルタには、画素値の差を輪郭の色の濃さとして採用する手法もある。 Various variations of the contour extraction filter have been proposed depending on which pixels are compared and how the threshold value is set. In addition, there is a technique for adopting a difference in pixel values as the color density of an outline in the outline extraction filter.
図5は、第1画像401に対して、輪郭抽出フィルタを適用した従来例を示す説明図である。以下、本図を参照して説明する。
FIG. 5 is an explanatory diagram showing a conventional example in which a contour extraction filter is applied to the
本例の輪郭抽出フィルタは、ある画素と、当該ある画素の右側もしくは下側の画素と、の画素値の差があらかじめ定めた閾値を超えた場合に、当該ある画素を輪郭とするものである。 The contour extraction filter according to this example is configured so that a certain pixel is contoured when a difference in pixel value between a certain pixel and a pixel on the right or lower side of the certain pixel exceeds a predetermined threshold value. .
本図には、示す第1画像401に単純に輪郭抽出フィルタを適用して得られる従来例の画像451を示す。従来例の画像451では、球オブジェクト302と板オブジェクト304との境界、ならびに、円柱オブジェクト303と板オブジェクト304との境界を表す輪郭452が描かれている。上記の境界においては、第1画像401で描画される色彩が異なるからである。
This figure shows a
なお、輪郭452が左右非対称となっているのは、本例で適用した輪郭抽出フィルタが左右非対称であるからである。
The reason why the
一方、球オブジェクト302と円柱オブジェクト303とは、第1画像401で同じ色彩で描かれているため、その境界は、輪郭抽出フィルタを単純に適用するだけでは得られない。
On the other hand, since the
そこで、本実施形態では、以下のような技術を採用する。すなわち、生成部202は、複数のオブジェクトのうち当該第1画像401における各画素位置に描画されている箇所の視点307に対する奥行を表す奥行値を各画素位置における画素値とする第2画像を生成する。
Therefore, in this embodiment, the following technique is adopted. That is, the
図6は、第2画像の様子を示す説明図である。以下、本図を参照して説明する。 FIG. 6 is an explanatory diagram showing a state of the second image. Hereinafter, a description will be given with reference to FIG.
本図に示すように、第2画像501は第1画像401と幅、高さとも同じサイズの画像である。第1画像401は、カラー画像とすることも、グレイスケール画像とすることも可能であるが、第2画像501は、グレイスケール画像とするのが典型的である。
As shown in the figure, the
本図においては、理解を容易にするため、グレイスケール画像における白、灰色、黒を、各画素のハッチングの濃さによって表現している。 In this figure, for easy understanding, white, gray, and black in a gray scale image are expressed by the hatching density of each pixel.
第2画像501における各画素は、画素値として、その画素に描かれているオブジェクトの部分の、視点307に対する奥行が採用されている。視点307に対する奥行としては、以下のようなものを採用することができる。
(a)視点307を原点、視線方向に伸びる座標軸をZ軸としたときの、その画素に描かれているオブジェクトの部分の、Z軸における座標値。いわゆるZ値である。
(b)視点307と、その画素に描かれているオブジェクトの部分と、の距離。
(c)上記(a)(b)において、その画素に描かれているオブジェクトの部分ではなく、オブジェクトの代表点(中心点や重心等、仮想空間301内におけるオブジェクトの位置を定める点。)を採用する態様。すなわち、その画素に描かれているオブジェクトの代表点のZ値や、当該オブジェクトの代表点と視点307との距離。
Each pixel in the
(A) The coordinate value on the Z-axis of the part of the object drawn on the pixel when the
(B) The distance between the
(C) In (a) and (b) above, not the object portion drawn in the pixel but the representative point of the object (the point that determines the position of the object in the
すなわち、奥行としては、視点307に対して、各オブジェクトがどの程度離れているか、あるいは、どの程度近いか、を表す数値パラメータであれば、任意のものを採用することができる。
That is, as the depth, any numerical parameter can be adopted as long as it is a numerical parameter indicating how far each object is from the
各画素値は、8ビットで明暗を表現するグレイスケール画像では、0〜255の何れかの整数値をとり、16ビットで明暗を表現するグレイスケール画像では、0〜65535の何れかの整数値をとる。他のビット数により第2画像501を表現する場合にも、各画素値は、0〜上限値の間のいずれかの値をとるのが一般的である。
Each pixel value takes an integer value of 0 to 255 in a grayscale image that expresses light and dark with 8 bits, and any integer value of 0 to 65535 in a grayscale image that expresses light and dark with 16 bits. Take. Even when the
そこで、視点307から視線308の方向に見えるオブジェクトの奥行を、上記の0〜上限値の間に適切にマッピングする。
Therefore, the depth of the object seen from the
最も単純には、視点307から視線308の方向に見えるオブジェクトの各部のうち、視点に最も近い最近点から、視点から最も遠い最遠点までの奥行を、上記の0〜上限値の間に均等に割り振るという手法が考えられる。
Most simply, the depth from the nearest point closest to the viewpoint to the farthest point farthest from the viewpoint among the parts of the object seen from the
また、3次元グラフィックスの技術を利用して第1画像401を生成する際には、仮想空間内に配置されるオブジェクトのうち、描画対象となるオブジェクトを、奥行の範囲で選択することがある。この場合に、当該奥行の範囲の下限から上限までを、画素値の0から上限値までに均等に割り振ることとしても良い。
Further, when the
本図では、上記(a)を採用した例を表示している。したがって、板オブジェクト304は、視点307から遠いから、白色に近い、薄いハッチングで描かれており、球オブジェクト302や円柱オブジェクト303は、視点307に近いから、板オブジェクト304に比べて黒色に近い、濃いハッチングで描かれている。
In this figure, the example which employ | adopted said (a) is displayed. Therefore, the
また、球オブジェクト302は、円柱オブジェクト303よりも視点307に近いから、両者の間にもハッチングの濃さに差がある。
Also, since the
そこで、本実施形態は、この奥行の差を用いて、輪郭を得るのである。 Therefore, in the present embodiment, the contour is obtained by using the difference in depth.
すなわち、本実施形態では、抽出部203が、第2画像501に輪郭抽出フィルタを適用することにより、第3画像を得る。
That is, in the present embodiment, the
図7は、第2画像501に輪郭抽出フィルタを適用して得られる第3画像の様子を表す説明図である。以下、本図を参照して説明する。
FIG. 7 is an explanatory diagram illustrating a state of a third image obtained by applying a contour extraction filter to the
上記のように、輪郭抽出フィルタは、画素値に大きな差があるところを輪郭とみなすフィルタである。したがって、図4の従来例で利用した輪郭抽出フィルタを第2画像501に適用すると、視点307に対する奥行が異なる箇所が、輪郭として抽出されることになる。
As described above, the contour extraction filter is a filter that regards a portion having a large difference in pixel values as a contour. Therefore, when the contour extraction filter used in the conventional example of FIG. 4 is applied to the
本図に示すように、第3画像601で抽出されている輪郭602は、球オブジェクト302、円柱オブジェクト303、板オブジェクト304の三者の間のすべての境界を描くものである。
As shown in this figure, the
すなわち、本図の第3画像601では、輪郭602として、キャラクターの頭部の輪郭602a、キャラクターの頸部の輪郭602bのほか、キャラクターの顎部の輪郭602cが描かれている。
That is, in the
このように、従来例では不可能であって輪郭抽出が、本実施形態では簡単な画像処理を行うことで可能となるのである。 As described above, contour extraction is impossible in the conventional example and can be performed by performing simple image processing in the present embodiment.
最後に、描画部204は、第1画像401を背景として、第3画像601により表される輪郭602を描画することにより、第4画像を得る。
Finally, the
図8は、第3画像601により表された輪郭602を、第1画像401に上書きして描画することにより得られる第4画像の様子を示す説明図である。以下、本図を参照して説明する。
FIG. 8 is an explanatory diagram showing a state of a fourth image obtained by drawing the
本図に示すように、第4画像701では、第1画像401に描かれていた球オブジェクト302、円柱オブジェクト303、板オブジェクト304の境界に、輪郭602が描画されている。
As shown in the figure, in the
本図では、輪郭602として、黒色を採用して描画しているが、本例のように、画素が輪郭602に相当するか否かのみを判定する手法では、第1画像401に対して輪郭602を描画する際の色は、任意の色とすることができる。
In this drawing, black is used as the
このほか、輪郭602の濃さを設定する態様では、輪郭602の濃さに応じて第1画像401の画素値の明度を暗くする、という手法により、輪郭を描くこともできる。すなわち、遠近の差が大きいところは暗くなり、遠近の差が小さいところは色にほとんど変化がない、という態様である。
In addition, in the aspect in which the darkness of the
さらに、輪郭602の濃さを設定する態様では、第4画像701において輪郭602を描く際に、あらかじめ、輪郭602の色を定めておき、輪郭602の濃さを「不透明度」として採用して、第1画像401とαブレンディングすることにより、輪郭を描くこととしても良い。
Further, in the aspect of setting the darkness of the
なお、上記の、輪郭の濃さに応じて画素の明度を暗くする、という手法は、輪郭602の色を黒と定めて、第1画像401とαブレンディングする手法に相当する。
Note that the above-described method of darkening the brightness of the pixel according to the density of the contour corresponds to a method of α blending with the
図9は、本実施形態に係る処理の制御の流れを示すフローチャートである。以下、本図を参照して説明する。 FIG. 9 is a flowchart showing the flow of processing control according to this embodiment. Hereinafter, a description will be given with reference to FIG.
本処理は、情報処理装置が本実施形態に係るゲーム装置201を実現するためのプログラムを実行することによって開始される。
This process is started when the information processing apparatus executes a program for realizing the
本処理が開始されると、ゲーム装置201の生成部202は、RAM 103等に記憶された仮想空間内の種々の情報から、第1画像401と、第2画像501と、を生成する(ステップS801)。
When this processing is started, the
生成部202は、まず第1画像401を生成し、次に第2画像501を生成することとしても良いが、第1画像401と第2画像501を並行して生成するのが典型的である。
The
本実施形態では、生成部202は、CPU 101の制御の下、画像処理部107が動作することによって実現され、RAM 103に、第1画像401と、第2画像501と、が出力される。
In the present embodiment, the
なお、情報処理装置100の構成によっては、第1画像401や第2画像501等、画像処理部107により出力される画像の出力先は、RAM 103のうち、画像処理部107との連携が密に構成されている画像処理専用のビデオRAM領域やフレームバッファ領域とすることで、処理の高速化を図ることができる。
Depending on the configuration of the
ついで、ゲーム装置201の抽出部203は、第2画像501に対して輪郭抽出フィルタを適用して、第3画像601を得る(ステップS802)。
Next, the
ここで、抽出部203は、CPU 101の制御の下、RAM 103内に記憶された第2画像501に対して、画像処理部107が動作することにより実現され、輪郭抽出フィルタの適用結果である第3画像601は、RAM 103に出力される。
Here, the
最後に、ゲーム装置201の描画部204は、第1画像401に対して、第3画像601により表される輪郭602を描画することにより、第4画像701を得る(ステップS803)。
Finally, the
本実施形態では、描画部204は、CPU 101の制御の下、RAM 103内に記憶された第1画像401と第3画像601を参照して、画像処理部107が第1画像401に輪郭602を描画することにより実現され、描画の結果得られる第4画像701は、RAM 103に出力される。
In the present embodiment, the
本実施形態によれば、簡易な画像処理によって、従来は抽出することができなかった輪郭を、適切に抽出することができるようになる。 According to the present embodiment, outlines that could not be extracted conventionally can be appropriately extracted by simple image processing.
本実施例は、上記の実施例において、第1画像401と第2画像501とを並行して生成する好適実施形態である。
This example is a preferred embodiment in which the
図10は、本実施例に係る第1画像401と第2画像501との生成処理の制御の流れを示すフローチャートである。以下、本図を参照して説明する。
FIG. 10 is a flowchart illustrating a flow of control of generation processing of the
本図に示す生成処理は、図9に示すフローチャートのステップS801に相当するものである。 The generation process shown in this figure corresponds to step S801 in the flowchart shown in FIG.
本処理が開始されると、CPU 101は、RAM 103内に、第1画像401用の第1画像バッファと、第2画像501用の第2画像バッファと、を確保する(ステップS811)。
When this process is started, the
たとえば、第1画像401を24ビットカラー、第2画像501を8ビットグレイスケールとし、大きさを横wドット、縦hドットとした場合には、第1画像401用に3×w×hバイト、第2画像501用にw×hバイトのメモリ領域が必要となる。
For example, if the
ついで、CPU 101は、第1画像バッファと第2画像バッファをクリアする(ステップS812)。
Next, the
第1画像バッファは、所定の背景色、たとえば、無限遠方を表す色等を表す画素値で初期化される。第2画像バッファは、最も遠い奥行を表す値、すなわち、第2画像501の画素値の最大値で初期化される。たとえば、第2画像501を8ビットグレイスケールで描く場合、第2画像501の画素値の最大値は255である。
The first image buffer is initialized with a pixel value representing a predetermined background color, for example, a color representing infinity. The second image buffer is initialized with a value representing the farthest depth, that is, the maximum pixel value of the
そして、RAM 103内に記憶されている情報に基づいて、仮想空間301内に配置されている描画対象となるオブジェクトのそれぞれにつき、次の処理を繰り返す(ステップS813)。
Then, based on the information stored in the
まず、視点306の位置、視線307の方向に基づいて、当該オブジェクトが第1画像401内に投影される領域を計算する(ステップS814)。
First, based on the position of the
次に当該領域内の画素の画素位置のそれぞれについて、次の処理を繰り返す(ステップS815)。 Next, the following processing is repeated for each pixel position of the pixel in the region (step S815).
まず、当該オブジェクトのうち、繰り返しにおいて現在注目している画素の画素位置に投影されている部分の奥行を取得する(ステップS816)。 First, the depth of the portion of the object that is projected at the pixel position of the pixel currently focused on in repetition is acquired (step S816).
上記のように、当該オブジェクトの投影部分の奥行としては、投影部分のZ値、投影部分と視点306との距離、当該オブジェクトの代表点のZ値、あるいは、当該オブジェクトの代表点と視点306との距離などを採用することができる。
As described above, the depth of the projection part of the object includes the Z value of the projection part, the distance between the projection part and the
そして、得られた奥行を、0から、第2画像501における画素値の最大値までの、整数値にマッピングして、奥行値を得る(ステップS817)。
Then, the obtained depth is mapped to an integer value from 0 to the maximum pixel value in the
ついで、第2画像バッファにおける当該画素位置の画素値を取得する(ステップS818)。 Next, the pixel value of the pixel position in the second image buffer is acquired (step S818).
そして、マッピングの結果得られた奥行値が、取得された第2画像バッファ内の画素値より、小さいかを判定する(ステップS819)。 Then, it is determined whether the depth value obtained as a result of mapping is smaller than the obtained pixel value in the second image buffer (step S819).
マッピング値の方が小さければ(ステップS819;Yes)、当該オブジェクトは、今までに描画されたオブジェクトよりも視点に近いことになる。そこで、第1画像バッファ内の当該画素位置に、当該オブジェクトの色の画素値を書き込み(ステップS820)、第2画像バッファ内の当該画素位置に、奥行値を書き込み(ステップS821)、ステップS822に進む。 If the mapping value is smaller (step S819; Yes), the object is closer to the viewpoint than the objects drawn so far. Therefore, the pixel value of the color of the object is written to the pixel position in the first image buffer (step S820), the depth value is written to the pixel position in the second image buffer (step S821), and the process goes to step S822. move on.
一方、マッピングの結果得られた値が、取得された第2画像バッファ内の画素値以上である場合(ステップS819;No)、当該オブジェクトは、今までに描画されたオブジェクトよりも視点に近いとはいえない。そこで、そのままステップS822に進む。 On the other hand, when the value obtained as a result of mapping is equal to or greater than the pixel value in the acquired second image buffer (step S819; No), the object is closer to the viewpoint than the object drawn so far. I can't say that. Therefore, the process proceeds to step S822 as it is.
この処理を、当該領域内の全画素の画素位置について繰り返す(ステップS822)。 This process is repeated for the pixel positions of all the pixels in the area (step S822).
ステップS815〜ステップS822の繰り返し処理が終わると、当該オブジェクトの描画が完了したこととなる。 When the repetitive processing from step S815 to step S822 is completed, the drawing of the object is completed.
そこで、ここまでの処理を、描画対象となるオブジェクトのすべてについて繰り返す(ステップS823)。 Therefore, the processing so far is repeated for all the objects to be rendered (step S823).
ステップS813〜ステップS823の繰り返し処理が終わると、全オブジェクトの描画が完了したこととなり、第1画像バッファには第1画像401が、第2画像バッファには第2画像501が、それぞれ生成されている。
When the repetitive processing from step S813 to step S823 is completed, drawing of all objects is completed, and the
3次元グラフィックスでは、奥行値に相当する情報を用いてあらかじめオブジェクトをZ軸方向にソートし、遠い順に描画する、という手法を用いることもあるが、本実施形態は、この態様と組み合わせることも可能である。また、オブジェクトをZ軸方向の遠近に基づいてソートしない場合であっても、どのオブジェクトがどのオブジェクトを隠すか、を適切に判定することが可能である。 In the three-dimensional graphics, a method of sorting objects in the Z-axis direction in advance using information corresponding to the depth value and drawing in order from the far side may be used, but this embodiment may be combined with this aspect. Is possible. Even when objects are not sorted based on perspective in the Z-axis direction, it is possible to appropriately determine which object hides which object.
本態様によれば、画素に投影されるオブジェクトの部分ごとに遠近を判定した場合は特に、オブジェクトを適切に第1画像401に描画することができる。
According to this aspect, the object can be appropriately drawn on the
また、第1画像401の描画の際の遠近判定に用いる情報を、そのまま第2画像501として利用することができるため、メモリならびに計算時間の節約が可能となる。
In addition, since information used for perspective determination when the
本実施形態は、上記実施例における奥行値の計算の好適実施形態の一つに相当するものである。 This embodiment corresponds to one of the preferred embodiments of the depth value calculation in the above-described example.
すなわち、本実施例では、各画素位置に対する奥行値として、視点307からオブジェクトのうち当該画素位置に投影される箇所へのベクトルと、視線方向の単位ベクトルと、の内積に、第2画像501の画素値がとりうる範囲の整数を値域とする単調増加関数を適用することにより得られる。
That is, in the present embodiment, as the depth value for each pixel position, the inner product of the vector from the
ここで、視点307からオブジェクトの投影部分へ向かうベクトルと、視線308の方向の単位ベクトルと、の内積は、いわゆるZ値に相当するものである。
Here, the inner product of the vector from the
また、Z値を、0〜255の整数値や、0〜65535の整数値にマッピングする手法としては、一般的な3次元グラフィックスの手法では、視点に近い側は細かく、視点に遠い側は荒く割り振るのが一般的である。 In addition, as a method for mapping the Z value to an integer value of 0 to 255 or an integer value of 0 to 65535, in a general 3D graphics method, the side closer to the viewpoint is fine, and the side far from the viewpoint is Rough allocation is common.
一方で、オブジェクトの色彩が近似し、近い位置に配置されている場合には、Z値も近い値になる。そこで、このような場合には、描画対象となるオブジェクトの奥行範囲を設定し、最も近い奥行から最も遠い奥行までを均等に割り振ることもできる。 On the other hand, when the colors of the objects are approximate and arranged at close positions, the Z value is also close. Therefore, in such a case, the depth range of the object to be drawn can be set, and the range from the nearest depth to the farthest depth can be equally allocated.
このほか、特定のキャラクターを綺麗に描画したい場合等には、当該キャラクターを構成するオブジェクトと、それ以外のオブジェクトを分類して、キャラクターを構成するオブジェクトが含まれる奥行範囲を求める。たとえば、キャラクターの代表点のZ値から前後の所定範囲を、当該奥行範囲とする。 In addition, when it is desired to draw a specific character neatly, an object constituting the character and other objects are classified to obtain a depth range including the object constituting the character. For example, a predetermined range before and after the Z value of the representative point of the character is set as the depth range.
そして、当該奥行範囲内については、細かく割り振り、それ以外の範囲については荒く割り振る、等の手法を採用しても良い。 Then, a technique such as finely allocating the depth range and roughly allocating the other ranges may be adopted.
いずれの手法においても、奥行値は、視点307から遠ければ遠いほど、すなわち、Z値が大きければ大きいほど、大きくなるような値である。したがって、Z値から奥行値への変換は、単調増加関数(単調な非減少関数)を適用することによって得られる。
In any method, the depth value is a value that increases as the distance from the
さて、上記のように、奥行値は、3次元グラフィックスによりオブジェクトを描画する際に使用するものである。このため、画像処理部107が専用ハードウェアで実現されている場合には、オブジェクトや視点306、視線307の情報、マッピングの割り振りの情報を与えると、第1画像401がRAM 103内に生成され、その副作用として、第2画像501が生成されることがある。
As described above, the depth value is used when an object is drawn by three-dimensional graphics. Therefore, when the
このような態様では特に、高速に、第1画像401と第2画像501とを生成することができる。
In such an aspect, in particular, the
上記実施例の説明では、輪郭抽出フィルタとして、第2画像501におけるある画素と、当該ある画素の右側もしくは下側の画素と、の画素値の差があらかじめ定めた閾値を超えた場合に、当該ある画素を輪郭とするものを採用していた。
In the description of the above embodiment, when the difference in pixel value between a certain pixel in the
以下、理解を容易にするため、第1画像401、第2画像501第3画像601、第4画像701の大きさが、いずれも、幅w、高さhであるとし、横方向の座標値x (0≦x<w)、縦方向の座標値y (0≦y<h)の位置(x,y)における画素値を、それぞれ、s[x,y]、d[x,y]、r[x,y]、g[x,y]とし、x軸は左から右へ、y軸は上から下へ、それぞれ伸びるものとする。
Hereinafter, in order to facilitate understanding, the sizes of the
ただし、態様によっては、軸の方向は逆向きにしても良い。 However, depending on the mode, the axis direction may be reversed.
第1画像401と第4画像701がカラー画像の場合には、s[x,y]およびg[x,y]は、RGB表現による3要素のベクトル値とするのが典型的である。
When the
また、第2画像501は、グレイスケール画像であるから、d[x,y]は、スカラー値とするのが典型的である。
Further, since the
また、第3画像601の画素値s[x,y]も、スカラー値とするのが典型的である。
The pixel value s [x, y] of the
また、グレイスケール画像における画素値の最大値をMとする。8ビットグレイスケールでは、M=255であり、16ビットグレイスケールでは、M=65535である。 Also, let M be the maximum pixel value in a grayscale image. In the 8-bit gray scale, M = 255, and in the 16-bit gray scale, M = 65535.
グレイスケール画像のある画素の画素値がvである場合、ネガポジ変換をした画素値はM-vであるから、第3画像601として、輪郭の画素をネガ表現(画素値が大きい、暗い画素)とするか、ポジ表現(画素値が小さい、明るい画素)とするか、は任意に選択が可能である。なお、図7においては、ネガ表現を採用し、黒(暗い画素)で輪郭602が描かれている。
When the pixel value of a certain pixel in the grayscale image is v, the pixel value obtained by negative / positive conversion is Mv. Therefore, the
以下では、理解を容易にするため、ネガ表現で説明を行うが、上記の変換式により、ポジ表現で実施をすることも容易である。 In the following, in order to facilitate understanding, explanation will be given in negative expression, but it is also easy to implement in positive expression by the above conversion formula.
さて、上記実施例で採用されている輪郭抽出フィルタは、第2画像501の画素値d[-,-]から、第3画像601の画素値r[-,-]を、以下のように求めるものである。
Now, the contour extraction filter employed in the above embodiment obtains the pixel value r [−, −] of the
すなわち、0≦x<w-1かつ0≦y<h-1について、
r[x,y] = M (|d[x,y]-d[x+1,y]|>T あるいは |d[x,y]-d[x,y+1]|>T)
= 0 (上記以外)
0≦y<hについて、
r[w-1,y] = 0,
0≦x<wかつy=h-1について、
r[x,h-1] = 0,
ただし、Tは、所定の閾値である。
That is, for 0 ≦ x <w-1 and 0 ≦ y <h-1,
r [x, y] = M (| d [x, y] -d [x + 1, y] |> T or | d [x, y] -d [x, y + 1] |> T)
= 0 (other than above)
For 0 ≦ y <h,
r [w-1, y] = 0,
For 0 ≦ x <w and y = h-1,
r [x, h-1] = 0,
However, T is a predetermined threshold value.
これは、まず最初に、0≦x<wかつ0≦y<hのすべてについて、
r[x,y] ← 0
と初期化してから、次に、0≦x<w-1かつ0≦y<h-1のそれぞれについて、「|d[x,y]-d[x+1,y]|>T あるいは |d[x,y]-d[x,y+1]|>T」が成立した場合に
r[x,y] ← M
のように代入したものと同じである。
First of all, for all 0 ≦ x <w and 0 ≦ y <h,
r [x, y] ← 0
Then, for each of 0 ≦ x <w−1 and 0 ≦ y <h−1, “| d [x, y] -d [x + 1, y] |> T or | d [x, y] -d [x, y + 1] |> T ”
r [x, y] ← M
Is the same as
この輪郭抽出フィルタでは、あるオブジェクトの描画結果に対する輪郭の大きさは、当該オブジェクトの描画結果の大きさとほぼ同じであるが、輪郭は、図7、図8に示すように、当該オブジェクトの描画結果から、すこしだけ左上にずれた状態で抽出される。 In this contour extraction filter, the size of the contour with respect to the drawing result of an object is substantially the same as the size of the drawing result of the object, but the contour is drawn as shown in FIGS. Are extracted with a slight shift to the upper left.
このほか、輪郭をオブジェクトの描画結果の外側に描く手法もある。第1の手法は、オブジェクトの左右の輪郭を抽出するものである。すなわち、0≦x<wかつ0≦y<hのすべてについて、
r[x,y] ← 0
と初期化してから、0≦x<w-1かつ0≦y<hのそれぞれについて、d[x,y]>d[x+1,y]+Tが成立した場合に
r[x,y] ← M
のように代入し、d[x,y]+T<d[x+1,y]が成立した場合に
r[x+1,y] ← M
のように代入したものである。
In addition, there is a method of drawing the outline outside the drawing result of the object. The first technique is to extract the left and right contours of the object. That is, for all 0 ≦ x <w and 0 ≦ y <h,
r [x, y] ← 0
When d [x, y]> d [x + 1, y] + T is satisfied for each of 0 ≦ x <w-1 and 0 ≦ y <h
r [x, y] ← M
When d [x, y] + T <d [x + 1, y] is satisfied
r [x + 1, y] ← M
Is substituted as follows.
この手法は、左右方向の操作のみを行うものであり、オブジェクトの描画領域の左右外側に、そのオブジェクトの輪郭が抽出される。 In this method, only an operation in the left-right direction is performed, and the outline of the object is extracted outside the drawing area of the object.
図11は、閾値比較により左右から輪郭を抽出した第3画像601を示す説明図である。以下、本図を参照して説明する。
FIG. 11 is an explanatory diagram showing a
本図のように、第3画像601では、水平方向に輪郭602が抽出されており、キャラクターの頭頂部や顎底部などの上下で、輪郭602が途切れている。
As shown in this figure, in the
第2の手法は、オブジェクトの上下の輪郭を抽出するものである。すなわち、0≦x<wかつ0≦y<hのすべてについて、
r[x,y] ← 0
と初期化してから、0≦x<wかつ0≦y<h-1のそれぞれについて、d[x,y]>d[x,y+1]+Tが成立した場合に
r[x,y] ← M
のように代入し、d[x,y]+T<d[x,y+1]が成立した場合に
r[x,y+1] ← M
のように代入したものである。
The second method is to extract the upper and lower contours of the object. That is, for all 0 ≦ x <w and 0 ≦ y <h,
r [x, y] ← 0
When d [x, y]> d [x, y + 1] + T is satisfied for each of 0 ≦ x <w and 0 ≦ y <h−1
r [x, y] ← M
When d [x, y] + T <d [x, y + 1] holds
r [x, y + 1] ← M
Is substituted as follows.
この手法は、上下方向の操作のみを行うものであり、オブジェクトの描画領域の上下外側に、そのオブジェクトの輪郭が抽出される。 In this method, only the operation in the vertical direction is performed, and the outline of the object is extracted outside the drawing area of the object.
図12は、閾値比較により上下から輪郭を抽出した第3画像601を示す説明図である。以下、本図を参照して説明する。
FIG. 12 is an explanatory diagram showing a
本図のように、第3画像601では、垂直方向に輪郭602が抽出されており、キャラクターの左右で、輪郭602が途切れている。
As shown in the figure, in the
第3の手法は、上記の第1の手法と第2の手法を両方とも適用するものである。 The third method applies both the first method and the second method.
図13は、閾値比較により上下左右から輪郭を抽出した第3画像601を示す説明図であり、図14は、上下左右から抽出された輪郭を用いて得られる第4画像701を示す説明図である。以下、本図を参照して説明する。
FIG. 13 is an explanatory diagram showing a
本図のように、第3画像601では、水平、垂直の両方向で輪郭602が抽出されており、輪郭602の途切れはない。
As shown in the figure, in the
また、第4画像701においては、輪郭602は、左右対象に、球オブジェクト302や円柱オブジェクト303の外側に付されることになっている。
In the
なお、上記の手法では、左右外側、上下外側に輪郭が抽出されるようにするため、大小関係の比較の結果に基づいて、輪郭を表す画素値の代入先を、r[x,y]とr[x+1,y]の間で、あるいは、r[x,y]とr[x,y+1]の間で、それぞれ切り替えることとしているが、画像処理部107の構成によっては、代入先をすべてr[x,y]とすることによって、高速な計算が可能となる場合もある。代入先は、以下の各態様においても、同様に選択が可能である。
In the above method, in order to extract the contours on the left and right outer sides and the upper and lower outer sides, the substitution destination of the pixel value representing the contour is set as r [x, y] based on the comparison result of the magnitude relationship. Switching between r [x + 1, y] or between r [x, y] and r [x, y + 1] is performed, but depending on the configuration of the
これらの手法は、隣接する画素の奥行の差が閾値Tよりも大きい場合に、視点307から遠い側の画素に、最大値Mを与えることにより、輪郭を抽出する。
In these methods, when the depth difference between adjacent pixels is larger than the threshold T, a contour is extracted by giving a maximum value M to a pixel far from the
これらの輪郭を第4画像701において描く色をc(RGBのベクトル値)とする。すると、0≦x<wかつ0≦y<hのすべてについて、
g[x,y] = s[x,y] (r[x,y] = 0);
= c (r[x,y] > 0)
を実行することによって、第4画像701を生成することができる。
The color in which these contours are drawn in the
g [x, y] = s [x, y] (r [x, y] = 0);
= c (r [x, y]> 0)
The
また、第1画像401が記憶されている第1画像バッファに対して(r[x,y] = M)の場合に画素位置(x,y)に色cを上書きすることによって、第4画像701を生成することとしても良い。
In addition, when (r [x, y] = M) with respect to the first image buffer in which the
このほか、0≦x<wかつ0≦y<hのすべてについて、
g[x,y] = (M-r[x,y])/M×s[x,y] + r[x,y]/M×c
のように、透明度を表すパラメータとして(M-r[x,y])/Mやr[x,y]/Mを利用することによって、第4画像701を生成しても良い。
In addition, for all 0 ≦ x <w and 0 ≦ y <h,
g [x, y] = (Mr [x, y]) / M × s [x, y] + r [x, y] / M × c
As described above, the
上記第1の手法から第3の手法までは、用途や計算量、オブジェクトが移動する方向やオブジェクトにより構成されるキャラクターの形状などに応じて、適宜選択することが可能である。 The first method to the third method can be appropriately selected according to the usage, the amount of calculation, the direction in which the object moves, the shape of the character constituted by the object, and the like.
上記実施例では、画素値の差と閾値とを比較して輪郭を抽出していたが、輪郭に濃さを想定することも可能である。 In the above-described embodiment, the contour is extracted by comparing the difference between the pixel values and the threshold value, but it is also possible to assume the darkness of the contour.
すなわち、まず、実施例4と同様に、第3画像601における各画素位置の画素値の初期値を0とする。
That is, first, as in the fourth embodiment, the initial value of the pixel value at each pixel position in the
この後に、実施例4の第1の手法に類似する手法として、
第2画像501における各画素位置を左から右に、隣り合う画素位置を走査して、左の画素位置の画素値が右の画素位置の画素値より大きければ、当該左の画素位置の画素値と当該右の画素位置の画素値との差で、第3画像601における当該左の画素位置の画素値を更新し、
第2画像501における各画素位置を右から左に、隣り合う画素位置を走査して、右の画素位置の画素値が左の画素位置の画素値より大きければ、当該右の画素位置の画素値と当該左の画素位置の画素値との差で、第3画像601における当該右の画素位置の画素値を更新する
手法がある。
After this, as a method similar to the first method of Example 4,
If each pixel position in the
If each pixel position in the
この手法では、0≦x<w-1かつ0≦y<hのそれぞれについて、d[x,y]>d[x+1,y]が成立した場合に
r[x,y] ← d[x,y]-d[x+1,y]
のように代入し、d[x,y]<d[x+1,y]が成立した場合に
r[x+1,y] ← d[x+1,y]-d[x,y]
のように代入する。
In this method, if d [x, y]> d [x + 1, y] holds for each of 0 ≦ x <w-1 and 0 ≦ y <h
r [x, y] ← d [x, y] -d [x + 1, y]
When d [x, y] <d [x + 1, y] is satisfied
r [x + 1, y] ← d [x + 1, y] -d [x, y]
Substitute as follows.
また、実施例4の第2の手法に類似する手法として、
第2画像501における各画素位置を上から下に、隣り合う画素位置を走査して、上の画素位置の画素値が下の画素位置の画素値より大きければ、当該上の画素位置の画素値と当該下の画素位置の画素値との差で、第3画像601における当該上の画素位置の画素値を更新し、
第2画像501における各画素位置を下から上に、隣り合う画素位置を走査して、下の画素位置の画素値が上の画素位置の画素値より大きければ、当該下の画素位置の画素値と当該上の画素位置の画素値との差で、第3画像601における当該下の画素位置の画素値を更新する
手法もある。
In addition, as a method similar to the second method of Example 4,
If each pixel position in the
If each pixel position in the
この手法では、0≦x<wかつ0≦y<h-1のそれぞれについて、d[x,y]>d[x,y+1]が成立した場合に
r[x,y] ← d[x,y]-d[x,y+1]
のように代入し、d[x,y]<d[x,y+1]が成立した場合に
r[x,y+1] ← d[y+1]-d[x,y]
のように代入する。
In this method, if d [x, y]> d [x, y + 1] holds for each of 0 ≦ x <w and 0 ≦ y <h−1
r [x, y] ← d [x, y] -d [x, y + 1]
When d [x, y] <d [x, y + 1] holds
r [x, y + 1] ← d [y + 1] -d [x, y]
Substitute as follows.
さらに、実施例4の第3の手法と同様に、これらを組み合わせることもできる。 Furthermore, as in the third method of the fourth embodiment, these can be combined.
これらの手法では、輪郭の濃さが、0〜Mまでの多段階で表現される。 In these methods, the contour density is expressed in multiple stages from 0 to M.
このほか、隣接する画素の差が所定の閾値よりも小さい場合には、差の代入を実行しない、という手法を採用しても良い。 In addition, when the difference between adjacent pixels is smaller than a predetermined threshold, a method may be adopted in which substitution of the difference is not executed.
このような閾値としては、たとえば、第2画像501内で最も大きい奥行値と最も小さい奥行値との差を、所定の定数(たとえば、2、3、4、5等)で割った結果等を採用することができる。
As such a threshold value, for example, the result of dividing the difference between the largest depth value and the smallest depth value in the
なお、差に対して閾値を採用しない場合には、第3画像301は、オブジェクトの凹凸に基づいた濃淡のある影に類似することとなり、差に対して閾値を採用する場合には、第3画像301は、ある程度濃い部分のみ、影として描いたものに類似することになる。
Note that when the threshold is not used for the difference, the
図15は、上下左右から濃さを考慮しつつ抽出した輪郭の様子を示す説明図である。以下、本図を参照して説明する。なお、本図では、色の濃さ(暗さ)を、ハッチングの濃さで表現している。 FIG. 15 is an explanatory diagram showing the contours extracted from the top, bottom, left, and right in consideration of the darkness. Hereinafter, a description will be given with reference to FIG. In this figure, the color density (darkness) is expressed by hatching density.
本図に示すように、球オブジェクト302と板オブジェクト304の間は大きく離れ、円柱オブジェクト303と板オブジェクト304の間は大きく離れているから、輪郭602のうち、球オブジェクト302と板オブジェクト304の境界ならびに円柱オブジェクト303と板オブジェクト304の境界は、濃くて暗くなっている。
As shown in the figure, since the
また、輪郭602のうち、球オブジェクト302と円柱オブジェクト303の間の顎は、薄くて明るくなっている。
In the
さらに、本例では、差に閾値を設けており、球オブジェクト302内や円柱オブジェクト303内では、奥行値の差が閾値よりも小さいため、輪郭としては認識されず、白色で描かれている。
Furthermore, in this example, a threshold value is provided for the difference. In the
このように、濃さが得られた輪郭602を利用する場合、輪郭602の基本色をc(RGBのベクトル値)としたときに、0≦x<wかつ0≦y<hのすべてについて、
g[x,y] = (M-r[x,y])×s[x,y] + r[x,y]×c
を実行することによって、半透明な輪郭を描いた第4画像701を生成することができる。
In this way, when using the
g [x, y] = (Mr [x, y]) × s [x, y] + r [x, y] × c
By executing the above, it is possible to generate a
ここで、c=(0,0,0)、すなわち、輪郭602の基本色を黒とした場合には、第4画像701の各画素位置(x,y)について、当該画素位置(x,y)の第1画像401における画素値s[x,y]により表される色を、当該画素位置の第3画像601における画素値r[x,y]により表される強さで暗くした色を表す画素値(M-r[x,y])×s[x,y]を、第4画像における当該画素位置の画素値としたことになる。
Here, when c = (0,0,0), that is, when the basic color of the
このほか、
g[x,y] = s[x,y] (r[x,y] = 0);
= (M-r[x,y])×c (r[x,y] > 0)
として、不透明な輪郭を描いた第4画像701を生成しても良い。
other than this,
g [x, y] = s [x, y] (r [x, y] = 0);
= (Mr [x, y]) × c (r [x, y]> 0)
As a result, a
これは、第4画像701の各画素位置について、
(a)当該画素位置(x,y)の第3画像601における画素値r[x,y]が0であれば、当該画素位置(x,y)の第1画像401における画素値s[x,y]を、第4画像701における当該画素位置の画素値s[x,y]とし、
(b)当該画素位置(x,y)の第3画像601における画素値r[x,y]が0でなければ、所定の色相ならびに彩度を有し、当該画素位置の第3画像601における画素値r[x,y]を暗度とする色を表す画素値(M-r[x,y])×cを、第4画像701における当該画素位置の画素値g[x,y]とする
ことに相当する。
This is for each pixel position of the
(A) If the pixel value r [x, y] in the
(B) If the pixel value r [x, y] in the
図16は、濃さのある不透明な輪郭を用いて生成された第4画像701の様子を表す説明図である。以下、本図を参照して説明する。
FIG. 16 is an explanatory diagram illustrating a state of the
本図に示す第4画像701の輪郭602は、図13のうち、白色の部分(r[x,y] = 0に相当)は、第1画像401上に描画せず、有色の部分(r[x,y] > 0に相当)は、第1画像401上にそのまま描画したものであり、輪郭602に濃淡が付されている。
In the
本手法によると、輪郭の濃淡を簡易な計算に自然に表現することができるようになる。 According to this method, the contour density can be naturally expressed by simple calculation.
なお、本実施例においては、隣り合う画素の画素値の差を、そのまま第3画像601における輪郭602の濃さとして採用したが、当該差に0からMまでの整数を値域とする単調増加関数(単調非増加関数)を適用することにより得られる値を、第3画像601における輪郭602の濃さとして採用しても良い。
In this embodiment, the difference between the pixel values of adjacent pixels is used as it is as the darkness of the
このほか、画像処理部107が用意している画像処理演算機能を利用する場合等には、以下のように輪郭を描く手法を採用しても良い。すなわち、
clamp01(x) = 0 (x≦0);
= x (0<x<1);
= 1 (1≦x)
なる関数clamp01(x)、パラメータK、閾値threshold、パラメータc_scaleに基づいて、
opacity = clamp01(clamp01(K×(|d[x,y]-d[x+1,y]| +
|d[x,y]-d[x,y+1]|) -
threshold)×c_scale
により、パラメータopacityを計算する。
In addition, when using an image processing calculation function prepared by the
clamp01 (x) = 0 (x ≦ 0);
= x (0 <x <1);
= 1 (1 ≦ x)
Based on function clamp01 (x), parameter K, threshold threshold, parameter c_scale
opacity = clamp01 (clamp01 (K × (| d [x, y] -d [x + 1, y] | +
| d [x, y] -d [x, y + 1] |)-
threshold) × c_scale
To calculate the parameter opacity.
ここで、パラメータKは、画素値の差をどれだけ強調するかを調整するものであり、閾値thresholdは輪郭を描くか否かを決める値であり、パラメータc_scaleは、0以上1以下の範囲で輪郭の濃さを調整するものである。 Here, the parameter K adjusts how much the difference between the pixel values is emphasized, the threshold threshold is a value that determines whether or not to draw an outline, and the parameter c_scale is in the range of 0 to 1 It adjusts the darkness of the contour.
そして、計算されたopacityを用いて、
g[x,y] = (1-opacity)×s[x,y] + opacity×c
とする。
And using the calculated opacity,
g [x, y] = (1-opacity) × s [x, y] + opacity × c
And
このように、画素値の差に応じて輪郭に濃さを設ける際には、差が大きくなるほど輪郭が濃くなるような種々の濃さの設定手法を採用することができる。 In this way, when providing the darkness to the contour in accordance with the difference in pixel values, various darkness setting techniques can be employed such that the contour becomes darker as the difference increases.
以上説明したように、本発明によれば、ゲーム世界を表す仮想空間に配置されるオブジェクトの輪郭を描画するのに好適なゲーム装置、ゲーム装置の制御方法、ならびに、これらをコンピュータにて実現するプログラムを提供することができる。 As described above, according to the present invention, a game device suitable for drawing an outline of an object arranged in a virtual space representing the game world, a game device control method, and these are realized by a computer. A program can be provided.
100 情報処理装置
101 CPU
102 ROM
103 RAM
104 インターフェース
105 コントローラ
106 外部メモリ
107 画像処理部
108 DVD−ROMドライブ
109 NIC
110 音声処理部
111 マイク
121 HD
131 カメラ
201 ゲーム装置
202 生成部
203 抽出部
204 描画部
301 仮想空間
302 球オブジェクト
303 円柱オブジェクト
304 板オブジェクト
305 球オブジェクトの中心
306 円柱オブジェクトの中心軸
307 視点
308 視線
401 第1画像
451 従来例の画像
452 従来例の輪郭
501 第2画像
601 第3画像
602 輪郭
701 第4画像
100
102 ROM
103 RAM
104
110
Claims (10)
前記第2画像に輪郭抽出フィルタを適用することにより、第3画像を得る抽出部、
前記第1画像を背景として、前記第3画像により表される輪郭を描画することにより、第4画像を得る描画部
を備えることを特徴とするゲーム装置。 A first image representing a state in which a plurality of objects arranged in a virtual space representing the game world are viewed from a viewpoint set in the virtual space in a line-of-sight direction set in the virtual space; and the plurality of objects A generation unit that generates a second image having a depth value representing a depth with respect to the viewpoint at a position drawn at each pixel position in the first image as a pixel value at each pixel position,
An extraction unit that obtains a third image by applying a contour extraction filter to the second image;
A game apparatus comprising: a drawing unit that obtains a fourth image by drawing a contour represented by the third image with the first image as a background.
前記生成部は、
前記第2画像の画素値がとりうる最大値を、当該第2画像における各画素位置の画素値の初期値とし、
前記複数のオブジェクトのそれぞれについて、
(a)当該オブジェクトが投影される領域を求め、
(b)前記求められた領域内の画素位置のそれぞれについて、当該画素位置の前記第2画像における画素値が当該オブジェクトの当該画素位置に投影される箇所に対する奥行値よりも小さければ、当該箇所が当該画素位置に投影される画素値を求めて、前記第1画像における当該画素位置の画素値を当該求められた画素値に更新し、前記第2画像における当該画素位置の画素値を当該オブジェクトの奥行値に更新する
処理を繰り返すことにより、前記第1画像と、前記第2画像と、を生成する
ことを特徴とするゲーム装置。 The game device according to claim 1,
The generator is
The maximum value that the pixel value of the second image can take is an initial value of the pixel value at each pixel position in the second image,
For each of the plurality of objects,
(A) Find the area where the object is projected,
(B) For each pixel position in the obtained area, if the pixel value in the second image at the pixel position is smaller than the depth value for the position projected on the pixel position of the object, the position is The pixel value projected to the pixel position is obtained, the pixel value at the pixel position in the first image is updated to the obtained pixel value, and the pixel value at the pixel position in the second image is changed to the object value. The game apparatus, wherein the first image and the second image are generated by repeating the process of updating to a depth value.
前記各画素位置に対する奥行値は、前記視点から前記オブジェクトのうち当該画素位置に投影される箇所へのベクトルと、前記視線方向の単位ベクトルと、の内積に、前記第2画像の画素値がとりうる範囲の整数を値域とする単調増加関数を適用することにより得られる
ことを特徴とするゲーム装置。 The game device according to claim 2,
The depth value for each pixel position is the pixel value of the second image, which is the inner product of the vector from the viewpoint to the portion of the object projected onto the pixel position and the unit vector in the line-of-sight direction. It is obtained by applying a monotonically increasing function whose range is an integer of a possible range.
前記輪郭抽出フィルタは、
前記第3画像における各画素位置の画素値の初期値を0とし、
前記第2画像における各画素位置を左から右に、隣り合う画素位置を走査して、左の画素位置の画素値が右の画素位置の画素値より大きければ、当該左の画素位置の画素値と当該右の画素位置の画素値との差で、前記第3画像における当該左の画素位置の画素値を更新し、
前記第2画像における各画素位置を右から左に、隣り合う画素位置を走査して、右の画素位置の画素値が左の画素位置の画素値より大きければ、当該右の画素位置の画素値と当該左の画素位置の画素値との差で、前記第3画像における当該右の画素位置の画素値を更新する
ことを特徴とするゲーム装置。 The game device according to claim 3,
The contour extraction filter is:
The initial value of the pixel value at each pixel position in the third image is set to 0,
If each pixel position in the second image is scanned from left to right and adjacent pixel positions are scanned, and the pixel value at the left pixel position is greater than the pixel value at the right pixel position, the pixel value at the left pixel position And the pixel value of the left pixel position in the third image is updated with the difference between the pixel value of the right pixel position and the pixel value of the right pixel position,
If each pixel position in the second image is scanned from right to left and adjacent pixel positions are scanned, and the pixel value at the right pixel position is greater than the pixel value at the left pixel position, the pixel value at the right pixel position The pixel value at the right pixel position in the third image is updated by the difference between the pixel value at the left pixel position and the pixel value at the left pixel position.
前記輪郭抽出フィルタは、さらに、
前記第2画像における各画素位置を上から下に、隣り合う画素位置を走査して、上の画素位置の画素値が下の画素位置の画素値より大きければ、当該上の画素位置の画素値と当該下の画素位置の画素値との差で、前記第3画像における当該上の画素位置の画素値を更新し、
前記第2画像における各画素位置を下から上に、隣り合う画素位置を走査して、下の画素位置の画素値が上の画素位置の画素値より大きければ、当該下の画素位置の画素値と当該上の画素位置の画素値との差で、前記第3画像における当該下の画素位置の画素値を更新する
ことを特徴とするゲーム装置。 The game device according to claim 4,
The contour extraction filter further includes:
If each pixel position in the second image is scanned from top to bottom and adjacent pixel positions are scanned, and the pixel value at the upper pixel position is greater than the pixel value at the lower pixel position, the pixel value at the upper pixel position And the pixel value at the upper pixel position in the third image is updated with the difference between the pixel value at the lower pixel position and the pixel value at the lower pixel position,
If each pixel position in the second image is scanned from the bottom to the top and adjacent pixel positions are scanned, and the pixel value at the lower pixel position is larger than the pixel value at the upper pixel position, the pixel value at the lower pixel position And a pixel value at the lower pixel position in the third image is updated by a difference between the pixel value at the upper pixel position and the pixel value at the upper pixel position.
前記輪郭抽出フィルタは、前記隣り合う画素位置の画素値の差にかえて、当該差に前記第3画像の画素値がとりうる範囲の整数を値域とする単調増加関数を適用することにより得られる値で、前記第3画像における画素値を更新する
ことを特徴とするゲーム装置。 The game device according to claim 4 or 5, wherein
The contour extraction filter is obtained by applying a monotonically increasing function whose range is an integer of a range that can be taken by the pixel value of the third image, instead of the difference between the pixel values of the adjacent pixel positions. A game apparatus, wherein the pixel value in the third image is updated with a value.
前記描画部は、前記第4画像の各画素位置について、
(a)当該画素位置の前記第3画像における画素値が0であれば、当該画素位置の前記第1画像における画素値を、前記第4画像における当該画素位置の画素値とし、
(b)当該画素位置の前記第3画像における画素値が0でなければ、所定の色相ならびに彩度を有し、当該画素位置の前記第3画像における画素値を暗度とする色を表す画素値を、前記第4画像における当該画素位置の画素値とする
ことを特徴とするゲーム装置。 The game device according to any one of claims 4 to 6,
The drawing unit, for each pixel position of the fourth image,
(A) If the pixel value in the third image at the pixel position is 0, the pixel value in the first image at the pixel position is set as the pixel value at the pixel position in the fourth image;
(B) If the pixel value in the third image at the pixel position is not 0, the pixel has a predetermined hue and saturation and represents a color having the pixel value in the third image at the pixel position as darkness A game apparatus, wherein the value is a pixel value of the pixel position in the fourth image.
前記描画部は、前記第4画像の各画素位置について、当該画素位置の前記第1画像における画素値により表される色を、当該画素位置の前記第3画像における画素値により表される強さで暗くした色を表す画素値を、前記第4画像における当該画素位置の画素値とする
ことを特徴とするゲーム装置。 The game device according to any one of claims 4 to 6,
For each pixel position of the fourth image, the drawing unit displays the color represented by the pixel value in the first image at the pixel position, and the intensity represented by the pixel value in the third image at the pixel position. A game apparatus characterized in that a pixel value representing a darkened color is used as a pixel value at the pixel position in the fourth image.
前記生成部が、ゲーム世界を表す仮想空間内に配置される複数のオブジェクトを当該仮想空間内に設定される視点から当該仮想空間内に設定される視線方向に見た様子を表す第1画像と、前記複数のオブジェクトのうち当該第1画像における各画素位置に描画されている箇所の前記視点に対する奥行を表す奥行値を各画素位置における画素値とする第2画像と、を生成する生成工程、
前記抽出部が、前記第2画像に輪郭抽出フィルタを適用することにより、第3画像を得る抽出工程、
前記描画部が、前記第1画像を背景として、前記第3画像により表される輪郭を描画することにより、第4画像を得る描画工程
を備えることを特徴とする制御方法。 A control method executed by a game device having a generation unit, an extraction unit, and a drawing unit,
A first image representing a state in which the generation unit viewed a plurality of objects arranged in a virtual space representing a game world from a viewpoint set in the virtual space in a line-of-sight direction set in the virtual space; A generation step of generating a second image having a depth value representing a depth with respect to the viewpoint at a position drawn at each pixel position in the first image among the plurality of objects as a pixel value at each pixel position;
An extraction step in which the extraction unit obtains a third image by applying a contour extraction filter to the second image;
A control method comprising: a drawing step in which the drawing unit obtains a fourth image by drawing a contour represented by the third image with the first image as a background.
ゲーム世界を表す仮想空間内に配置される複数のオブジェクトを当該仮想空間内に設定される視点から当該仮想空間内に設定される視線方向に見た様子を表す第1画像と、前記複数のオブジェクトのうち当該第1画像における各画素位置に描画されている箇所の前記視点に対する奥行を表す奥行値を各画素位置における画素値とする第2画像と、を生成する生成部、
前記第2画像に輪郭抽出フィルタを適用することにより、第3画像を得る抽出部、
前記第1画像を背景として、前記第3画像により表される輪郭を描画することにより、第4画像を得る描画部
として機能させることを特徴とするプログラム。 Computer
A first image representing a state in which a plurality of objects arranged in a virtual space representing the game world are viewed from a viewpoint set in the virtual space in a line-of-sight direction set in the virtual space; and the plurality of objects A generation unit that generates a second image having a depth value representing a depth with respect to the viewpoint at a position drawn at each pixel position in the first image as a pixel value at each pixel position,
An extraction unit that obtains a third image by applying a contour extraction filter to the second image;
A program that functions as a drawing unit that obtains a fourth image by drawing a contour represented by the third image with the first image as a background.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011189348A JP2013050895A (en) | 2011-08-31 | 2011-08-31 | Game device, game device control method, and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011189348A JP2013050895A (en) | 2011-08-31 | 2011-08-31 | Game device, game device control method, and program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2013050895A true JP2013050895A (en) | 2013-03-14 |
Family
ID=48012876
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2011189348A Pending JP2013050895A (en) | 2011-08-31 | 2011-08-31 | Game device, game device control method, and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2013050895A (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008302130A (en) * | 2007-06-11 | 2008-12-18 | Nintendo Co Ltd | Image processing program and image processor |
-
2011
- 2011-08-31 JP JP2011189348A patent/JP2013050895A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008302130A (en) * | 2007-06-11 | 2008-12-18 | Nintendo Co Ltd | Image processing program and image processor |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106575445B (en) | Fur avatar animation | |
US6580430B1 (en) | Method and apparatus for providing improved fog effects in a graphics system | |
EP1956471B1 (en) | Object selecting device, object selecting method, information recording medium, and program | |
CN109151540B (en) | Interactive processing method and device for video image | |
JP2018537755A (en) | Foveal geometry tessellation | |
TW201539374A (en) | Method for efficient construction of high resolution display buffers | |
CN112967367B (en) | Water wave special effect generation method and device, storage medium and computer equipment | |
JP2002042165A (en) | Image forming device, its method, and recording medium | |
JP3949674B2 (en) | Display device, display method, and program | |
KR100898671B1 (en) | Image processor, image processing method, and computer-readable information recording medium having a program recorded thereon | |
JP2005293122A (en) | Game software with function to display large-surface object, and game device | |
CN112053370A (en) | Augmented reality-based display method, device and storage medium | |
JP3777149B2 (en) | Program, information storage medium, and image generation apparatus | |
KR100950835B1 (en) | Image creating device, image creating method, and computer-readable information recording medium having a program recorded thereon | |
JP2017111719A (en) | Video processing device, video processing method and video processing program | |
JP4267646B2 (en) | Image generating apparatus, image generating method, and program | |
JP4193979B2 (en) | Shadow volume generation program and game device | |
JP2017068438A (en) | Computer program for generating silhouette, and computer implementing method | |
JP2001084404A (en) | Method and device for rendering, game machine, and computer readable recording medium for storing program for rendering three-dimensional model | |
JP2001126086A (en) | Method and device for displaying three-dimensional model in video game, game machine, and computer- readable recording medium storing three-dimensional model displaying program for video game | |
JP2006323512A (en) | Image generation system, program, and information storage medium | |
CN116958344A (en) | Animation generation method and device for virtual image, computer equipment and storage medium | |
JP4754384B2 (en) | Program, information recording medium, and image generation system | |
CN115970275A (en) | Projection processing method and device for virtual object, storage medium and electronic equipment | |
JP3491832B2 (en) | GAME DEVICE AND INFORMATION STORAGE MEDIUM |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20130708 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20130716 |
|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20131112 |