JP3586253B2 - Texture mapping program - Google Patents

Texture mapping program Download PDF

Info

Publication number
JP3586253B2
JP3586253B2 JP2002060557A JP2002060557A JP3586253B2 JP 3586253 B2 JP3586253 B2 JP 3586253B2 JP 2002060557 A JP2002060557 A JP 2002060557A JP 2002060557 A JP2002060557 A JP 2002060557A JP 3586253 B2 JP3586253 B2 JP 3586253B2
Authority
JP
Japan
Prior art keywords
dimensional model
program
texture mapping
pixel
texture
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.)
Expired - Fee Related
Application number
JP2002060557A
Other languages
Japanese (ja)
Other versions
JP2003256864A (en
Inventor
崇 北尾
Original Assignee
株式会社コナミコンピュータエンタテインメントジャパン
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 株式会社コナミコンピュータエンタテインメントジャパン filed Critical 株式会社コナミコンピュータエンタテインメントジャパン
Priority to JP2002060557A priority Critical patent/JP3586253B2/en
Publication of JP2003256864A publication Critical patent/JP2003256864A/en
Application granted granted Critical
Publication of JP3586253B2 publication Critical patent/JP3586253B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Image Generation (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、テクスチャマッピングプログラムに関するものである。
【0002】
【従来の技術】
画像処理技術においてテクスチャマッピングという処理がある。これは一般的には3次元モデルの表面に2次元の画像(テクスチャ画像)を貼り付ける(マッピングする)処理である。このテクスチャマッピング処理において、光源からの光の方向ベクトルと3次元モデルの表面の各点における法線ベクトルとが成す角度の差に応じて粗い階調で3次元モデルに対して陰影を付け、あたかも2次元のアニメ調の画像となるように、3次元モデルに対して行う処理(以下、トゥーンシェーディング処理と呼ぶ)がある。
【0003】
【発明が解決しようとする課題】
3次元モデルがカメラの位置から遠い場所に位置する場合、3次元モデルの詳細は表示された画面上ではわかりにくい。よってこの場合、3次元モデルの画像情報を減らしていくことが好ましい。また、光源の位置と3次元モデルの位置関係によっては、3次元モデルの表面の色情報が変化する。例えば3次元モデルがカメラに対して逆光の場所に位置する場合、カメラの位置から見た3次元モデルは概ね黒い物体として見える。
【0004】
本発明はこのような点を考慮して成されたものであり、3次元モデル、光源、カメラのうち一部、もしくは全部の位置関係に応じたテクスチャマッピングを3次元モデルに対して行うことを目的とする。
【0005】
【課題を解決するための手段】
本発明の目的を達成するために、例えば本発明のテクスチャマッピングプログラムは以下の構成を備える。
【0006】
すなわち、3次元モデルに対してテクスチャマッピングを行うテクスチャマッピングプログラムであって、
3次元モデルにおいて注目部分の法線ベクトルと、光源から当該3次元モデルに対して照射される光の方向ベクトルとの内積値を求める第1の計算工程のプログラムと、
前記3次元モデルとカメラとの距離を求める第2の計算工程のプログラムと、
前記方向ベクトルと、前記3次元モデルにおいてテクスチャマッピングを行う部分の夫々の法線ベクトルとの内積値に応じた画素値を有する画素列を第1の方向に、前記3次元モデルと前記カメラとの距離に応じた画素値を有する画素列を前記第1の方向とは直交する第2の方向に配置するテクスチャ画像から、前記第1,2の計算工程での計算結果に基づいて前記注目部分にテクスチャマッピングを行う画素を特定する特定工程のプログラムとを含み、
前記特定工程で特定された画素を前記注目部分にテクスチャマッピングすることを特徴とする。
【0007】
本発明の目的を達成するために、例えば本発明のテクスチャマッピングプログラムは以下の構成を備える。
【0008】
すなわち、3次元モデルに対してテクスチャマッピングを行うテクスチャマッピングプログラムであって、
3次元モデルにおいて注目部分の法線ベクトルと、光源から当該3次元モデルに対して照射される光の方向ベクトルとの角度差を求める第1の計算工程のプログラムと、
前記3次元モデルとカメラとの距離を求める第2の計算工程のプログラムと、
前記方向ベクトルと、前記3次元モデルにおいてテクスチャマッピングを行う部分の夫々の法線ベクトルとの角度差に応じた画素値を有する画素列を第1の方向に、前記3次元モデルと前記カメラとの距離に応じた画素値を有する画素列を前記第1の方向とは直交する第2の方向に配置するテクスチャ画像から、前記第1,2の計算工程での計算結果に基づいて前記注目部分にテクスチャマッピングを行う画素を特定する特定工程のプログラムとを含み、
前記特定工程で特定された画素を前記注目部分にテクスチャマッピングすることを特徴とする。
【0009】
更に上記テクスチャマッピングプログラムは、前記特定工程で特定された画素を前記3次元モデルにテクスチャマッピングした処理済み3次元モデルに対して更に文字線画が描画されたテクスチャ画像をテクスチャマッピングすると共に、
前記処理済み3次元モデルと前記カメラとの距離に応じて前記文字線画の透明度を制御する透明度制御工程のプログラムを含むことを特徴とする。
【0010】
本発明の目的を達成するために、例えば本発明のテクスチャマッピングプログラムは以下の構成を備える。
【0011】
すなわち、3次元モデルに対してテクスチャマッピングを行うテクスチャマッピングプログラムであって、
3次元モデルにおいて注目部分の法線ベクトルと、光源から当該3次元モデルに対して照射される光の第1の方向ベクトルとの内積値を求める第1の計算工程のプログラムと、
前記第1の方向ベクトルと、カメラから前記3次元モデルに対する第2の方向ベクトルとの内積値を求める第2の計算工程のプログラムと、
前記第1の方向ベクトルと、前記3次元モデルにおいてテクスチャマッピングを行う部分の夫々の法線ベクトルとの内積値に応じた画素値を有する画素列を第1の方向に、前記第1の方向ベクトルと前記第2の方向ベクトルとの内積値に応じた画素値を有する画素列を前記第1の方向とは直交する第2の方向に配置するテクスチャ画像から、前記第1,2の計算工程での計算結果に基づいて前記注目部分にテクスチャマッピングを行う画素を特定する特定工程のプログラムとを含み、
前記特定工程で特定された画素を前記注目部分にテクスチャマッピングすることを特徴とする。
【0012】
本発明の目的を達成するために、例えば本発明のテクスチャマッピングプログラムは以下の構成を備える。
【0013】
すなわち、3次元モデルに対してテクスチャマッピングを行うテクスチャマッピングプログラムであって、
3次元モデルにおいて注目部分の法線ベクトルと、光源から当該3次元モデルに対して照射される光の第1の方向ベクトルとの角度差を求める第1の計算工程のプログラムと、
前記第1の方向ベクトルと、カメラから前記3次元モデルに対する第2の方向ベクトルとの角度差を求める第2の計算工程のプログラムと、
前記第1の方向ベクトルと、前記3次元モデルにおいてテクスチャマッピングを行う部分の夫々の法線ベクトルとの角度差に応じた画素値を有する画素列を第1の方向に、前記第1の方向ベクトルと前記第2の方向ベクトルとの角度差に応じた画素値を有する画素列を前記第1の方向とは直交する第2の方向に配置するテクスチャ画像から、前記第1,2の計算工程での計算結果に基づいて前記注目部分にテクスチャマッピングを行う画素を特定する特定工程のプログラムとを含み、
前記特定工程で特定された画素を前記注目部分にテクスチャマッピングすることを特徴とする。
【0014】
【発明の実施の形態】
以下添付図面を参照して、本発明の好適な実施形態について詳細に説明する。
【0015】
まず、従来のトゥーンシェーディング処理の概要について説明する。一般にコンピュータによって3次元モデルを生成し、表示装置に表示する場合、3次元モデルにはシェーディング処理が施される。光源から照射される光の方向ベクトル(以下、光源ベクトル)と3次元モデルの表面の各点における法線ベクトルとの内積値を計算し、内積値が大きいほど暗く、内積値が小さいほど明るい色で各点を表現することで、3次元モデルの表面になだらかな(細かい階調で)陰影を付けることができる。
【0016】
上記シェーディング処理(以下、トゥーンシェーディング処理と区別するために一般シェーディング処理と呼ぶことがある)を施された3次元モデルの画像をアニメーション画像に合成して用いる場合、アニメーションの画像は登場する各物体(生物を含む)の陰影が粗い階調で表現されているため、合成後の画像を見た観察者に、細かい階調で陰影が付けられた上記シェーディング処理を施された3次元モデルの画像に対する違和感を与えることになる。そこで、3次元モデルに上記シェーディング処理による画像の階調を粗くした、あたかも2次元のアニメ調の画像となるようなテクスチャ画像を、3次元モデルに貼り付ける処理(トゥーンシェーディング処理)を行う。
【0017】
図1に3次元モデルと光源とを示す。シェーディング処理では、3次元モデルの任意の点P(3次元モデルがポリゴンで形成されている場合はポリゴン)における法線ベクトルVと光源ベクトルVとの内積値に応じて点Pにおける陰影を決定する。一方、トゥーンシェーディング処理ではこの内積値に応じて、テクスチャ画像のうち点Pに貼り付ける画素の位置を決定し、決定した位置の画素を3次元モデルの点Pに貼り付ける処理を行う。
【0018】
図2にこのトゥーンシェーディング処理で用いるテクスチャ画像を示す。同図に示した画像は縦M画素、横N画素であって、同図左から白、グレー、そして黒の領域を有する。夫々の領域の横方向の長さは任意である。ここで3次元モデル上の任意の点における上記内積値がaである場合、この点には、図2に示したテクスチャ画像において左から(a+1)(N−1)/2番目の位置の画素を貼り付けることになる(左端の画素を0番目とした場合)。つまり、内積値が大きい点ほどテクスチャ画像の右側の画素を用いる傾向にあり、内積値が小さい点ほど左側の画素を用いる傾向にある。これにより、内積値が大きい点ほど暗い色(同図では黒)、内積値が小さいほど明るい色(同図では白)を割り当てることができると共に、テクスチャ画像で用いられている各色は大まかに分かれているので、トゥーンシェーディング処理の結果、3次元モデルに上記シェーディング処理による画像の階調を粗くした、あたかも2次元のアニメ調の画像となるようなテクスチャ画像を、3次元モデルに貼り付けることができる。
【0019】
しかし上記従来のトゥーンシェーディング処理において、テクスチャ画像(図2)を参照する方向は内積値に応じて横方向のみであった。つまり、同図のテクスチャ画像において縦方向を参照することはなかった。そこで下記の実施形態では、状況(3次元モデル、光源、カメラのうち一部、もしくは全部の位置関係)に応じて用いるべき情報を縦方向に有するテクスチャ画像と、このテクスチャ画像を用いてトゥーンシェーディング処理を行うプログラムについて説明する。
【0020】
[第1の実施形態]
本実施形態におけるトゥーンシェーディング処理を行うプログラムは、用いるテクスチャ画像の縦方向を、このテクスチャ画像を貼り付ける3次元モデルとカメラとの距離に応じて参照する。
【0021】
図3に本実施形態におけるトゥーンシェーディングを行うプログラムを実行する情報処理装置の基本構成を示す。なお、同図に示した情報処理装置は一般のパーソナルコンピュータやワークステーション、ゲーム装置等を含む。
【0022】
301はCPUで、RAM302やROM303に格納されたプログラムやデータを用いて本装置全体の制御を行うと共に、後述のトゥーンシェーディング処理を含む各種の画像処理を行う。302はRAMで、ハードディスドライブ304(以下、HDD)やCD−ROMドライブ305から読み出されたプログラムやデータなどを一時的に記憶するエリアを備えると共に、CPU301が各種の処理を実行する際に用いるワークエリアも備える。303はROMで、本装置全体の制御を行うためのプログラムやデータなどを格納する。304は上記HDDで、CD−ROMドライブ305から読み出されたプログラムやデータなどをファイルとして保存することができる。305はCD−ROMドライブで、プログラムやデータを格納した記憶媒体としてのCD−ROMからプログラムやデータを読み出す。306は表示装置で、CRTや液晶画面などにより構成されており、画像や文字等を表示する。307は操作部で、キーボードやマウス、ゲームを行うためのパッド、ジョイスティックなどにより構成されており、操作者からの本装置に対する入力指示を行うためのインターフェースとして機能する。308は上述の各部を繋ぐバスである。
【0023】
尚、上記構成に加えて、CD−ROM以外にもDVD−ROMやフロッピーディスクなど、他の記憶媒体からプログラムやデータを読み出すためのドライブを備えても良い。
【0024】
次に、本実施形態におけるテクスチャ画像について説明する。図4に本実施形態におけるテクスチャ画像を示す。本実施形態におけるテクスチャ画像は縦M画素、横N画素である。また同図において原点(0,0)を同図画像の左上隅に取り、横方向をx軸方向、縦方向をy軸方向とする。本実施形態では説明を簡単にするために、3次元モデルにおいて最も明るい部分の色を白とするがこれに限定されるものではない。
【0025】
同図に示したテクスチャ画像をトゥーンシェーディング処理に適用する場合、まず、3次元モデルとカメラとの距離を計算する。計算した距離をyとする。次に、3次元モデルにおいてテクスチャを貼る点Pにおける法線ベクトルと光源ベクトルとの内積値を求め、これをxとする。そして、図4に示したテクスチャ画像において((x+1)×(N−1)/2、y×M/L2)に対応する位置の画素を3次元モデルにおける点Pに貼り付ける。
【0026】
図4に示したテクスチャ画像は、3次元モデルとカメラとの距離が遠くなるに従って使用可能な色の種類が減るように構成されていると共に、3次元モデルとカメラとの距離が遠くなるに従ってほとんどの内積値に対する色がグレーとなるように構成されている。具体的には、同図では距離が近い(距離0から距離L1)場合には白、グレー、黒の3色が内積値に応じて使用可能である。しかし距離がL1以上である場合、内積値が如何なる値をとっても使用可能な色はグレー、黒の2色となる。尚、距離がL2以上の場合、L2として扱う。
【0027】
よって、図4に示したテクスチャ画像を用いて上述の通りトゥーンシェーディング処理を行うことで、3次元モデルとカメラとの距離に応じて使用可能な色やその色数、各内積値に対する各色の割合を変化させることができる。つまり、同図に示したテクスチャ画像を用いてトゥーンシェーディング処理を行うことで従来のトゥーンシェーディング処理による結果が得られると共に、3次元モデルとカメラとの距離に応じて表現色を変化させることができる。
【0028】
図5に本実施形態における上記テクスチャ画像を用いたトゥーンシェーディング処理のフローチャートを示す。なお、同図に示したフローチャートに従ったプログラムはRAM302に読み出され、CPU301により実行されるので、本実施形態における情報処理装置は上記トゥーンシェーディング処理を行うことができる。また、同図に示したフローチャートはトゥーンシェーディング処理を施された3次元モデルを表示装置306の画面上に表示する際のレンダリング処理(サブルーチン)として実行される。
【0029】
まず、カメラと3次元モデルとの距離(y)を計算し、RAM302に記憶する(ステップS501)。これは互いの3次元座標値を用いて求めることができる。なお、この距離を求める処理は同図に示したフローチャートに従った処理の外部で行い、ステップS501では、外部で求めた距離をRAM302に読み込んでも良い。次に、3次元モデル上の1点(3次元モデルがポリゴンにより形成されている場合には1つのポリゴン)における法線ベクトルと光源ベクトルとの内積値(x)を求め、RAM302に記憶する(ステップS502)。
【0030】
次に、ステップS501,ステップS502において求め、RAM302に記憶されているx、yを用いて図4に示したテクスチャ画像において(((x+1)×(N−1)/2、y×M/L2))に位置する画素を上記1点に貼り付ける(ステップS503)。そして未だテクスチャ画像を貼り付けていない点が3次元モデルにある場合には処理をステップS502に戻し、この点に対して以下、同様に処理を行う。
【0031】
以上説明した、ステップS501〜ステップS503の処理を3次元モデル上の全ての点に対して行うことで、3次元モデル上に本実施形態におけるトゥーンシェーディングを行うことができる。
【0032】
なお、上記説明ではテクスチャ画像に用いる色の数を最大3つとしたがこれに限定されるものではない。また、上記説明は図4に示したテクスチャ画像に限定されるものではない。つまり、図4に示した各色の割合や分布はこれに限定されるものではない。またテクスチャ画像においてx軸方向は法線ベクトルと光源ベクトルとの内積値に限定されるものではなく、他にも例えば法線ベクトルと光源ベクトルとの角度差であってもよい。
【0033】
次に、上記トゥーンシェーディング処理を施された3次元モデルに対して文字線画が描画されたテクスチャ画像を更に貼り付ける場合について説明する。図6は、上記トゥーンシェーディング処理を施された3次元モデル601に対して点線が描画されたテクスチャ画像602を貼り付け、野球のボールの3次元モデル603を生成する流れを示す図である。テクスチャ画像602は点線の部分(ボールの縫い目の部分)のみが任意の色で描画されており、それ以外の領域は貼り付けた3次元モデルの下地の色(即ち、本実施形態におけるトゥーンシェーディング処理がなされた3次元モデルの表面の色)が見えるように透明となっている。
【0034】
同図に示した方法により生成されたボールの3次元モデル603がカメラから遠ざかるに従って下地の色は上記トゥーンシェーディング処理により変化していくが、上記の通り、縫い目の部分は確認し難くなると共に、ちらつく。そこで、カメラとの距離が大きくなるに従ってこの縫い目の部分のα値を下げていき、カメラとの距離が大きくなるに従ってこの縫い目の部分の透明度を上げていくことが好適である。
【0035】
[第2の実施形態]
本実施形態におけるトゥーンシェーディング処理を行うプログラムは、用いるテクスチャ画像の縦方向を光源とカメラとの位置関係に応じて参照する。図7にカメラ、3次元モデル、光源を示す。V、Vは図1に示したものと同じで、Vはカメラから3次元モデルに対する方向ベクトル(視線ベクトル)である。
【0036】
視線ベクトルVと光源ベクトルVとが成す角度が180度の場合、すなわち、逆光の場合、カメラから見て3次元モデルは概ね図8(a)に示すように見える。つまり、見える範囲で3次元モデルのほとんどは黒く見え、周辺部分のみが若干明るく見える。一方、視線ベクトルVと光源ベクトルVとが成す角度が0度の場合、即ち順光の場合、カメラから見て3次元モデルは概ね図8(b)に示すように見える。つまり、見える範囲で3次元モデルのほとんどは白く見える。このようにカメラと光源の位置関係により3次元モデルの見え方は変化する。
【0037】
図9に本実施形態におけるテクスチャ画像を示す。本実施形態でも第1の実施形態と同様にテクスチャ画像は縦M画素、横N画素であって、原点(0,0)を同図画像の左上隅に取り、横方向をx軸方向、縦方向をy軸方向とする。また本実施形態でも第1の実施形態と同様に、3次元モデルにおいて最も明るい部分の色を白とするがこれに限定されるものではない。
【0038】
同図に示したテクスチャ画像をトゥーンシェーディング処理に適用する場合、まず、視線ベクトルと光源ベクトルとが成す角度の差を計算する。計算した角度の差をyとする。次に、3次元モデルにおいてテクスチャを貼る点Pにおける法線ベクトルと光源ベクトルとの内積値を求め、これをxとする。そして、図9に示したテクスチャ画像において座標((x+1)×(N−1)/2、y×M/360)に位置する画素を3次元モデルにおける点Pに貼り付ける。
【0039】
図9に示したテクスチャ画像は、視線ベクトルと光源ベクトルとの角度差が180度、すなわち、逆光に近いほど使用する暗い色の種類と割合が増えるように構成されている。また、テクスチャ画像において各色の種類、分布は180度を境に上部、下部は対象である。
【0040】
よって、図9に示したテクスチャ画像を用いて上述の通りトゥーンシェーディング処理を行うことで、カメラと光源の位置関係に応じて使用可能な色やその色数、各内積値に対する各色の割合を変化させることができる。つまり、同図に示したテクスチャ画像を用いてトゥーンシェーディング処理を行うことで従来のトゥーンシェーディング処理による結果が得られると共に、カメラと光源との位置関係に応じて表現色を変化させることができる。
【0041】
図10に本実施形態における上記テクスチャ画像を用いたトゥーンシェーディング処理のフローチャートを示す。なお、同図に示したフローチャートに従ったプログラムはRAM302に読み出され、CPU301により実行されるので、本実施形態における情報処理装置は上記トゥーンシェーディング処理を行うことができる。また、同図に示したフローチャートはトゥーンシェーディング処理を施された3次元モデルを表示装置306の画面上に表示する際のレンダリング処理(サブルーチン)として実行される。
【0042】
まず、視線ベクトルと光源ベクトルとの角度差(y)を計算し、RAM302に記憶する(ステップS1001)。視線ベクトルは、カメラの座標と3次元モデルの座標を用いて求めることができる。光源ベクトルは光源の座標と3次元モデルの座標を用いて求めることができる。なお、この角度差を求める処理は同図に示したフローチャートに従った処理の外部で行い、ステップS1001では、外部で求めた角度差をRAM302に読み込んでも良い。次に、3次元モデル上の1点(3次元モデルがポリゴンにより形成されている場合には1つのポリゴン)における法線ベクトルと光源ベクトルとの内積値を(x)求め、RAM302に記憶する(ステップS1002)。
【0043】
次に、ステップS1001,ステップS1002において求め、RAM302に記憶しているx、yを用いて図9に示したテクスチャ画像において(((x+1)×(N−1)/2、y×M/360))に位置する画素を上記1点に貼り付ける(ステップS1003)。そして未だテクスチャ画像を貼り付けていない点が3次元モデルにある場合には処理をステップS1002に戻し、この点に対して以下、同様に処理を行う。
【0044】
以上説明した、ステップS1001〜ステップS1003の処理を3次元モデル上の全ての点に対して行うことで、3次元モデル上に本実施形態におけるトゥーンシェーディングを行うことができる。
【0045】
なお、上記説明ではテクスチャ画像に用いる色の数を最大3つとしたがこれに限定されるものではない。また、上記説明は図9に示したテクスチャ画像に限定されるものではない。つまり、図9に示した各色の成分の割合や分布はこれに限定されるものではない。またテクスチャ画像においてx軸方向は法線ベクトルと光源ベクトルとの内積値に限定されるものではなく、他にも例えば法線ベクトルと光源ベクトルとが成す角度であってもよい。同様に、y軸方向は視線ベクトルと光源ベクトルとの角度差に限定されるものではなく、他にも例えば視線ベクトルと光源ベクトルとの内積値であってもよい。
【0046】
[第3の実施形態]
以上の処理(例えば図5,10に示したフローチャートの一部、もしくは全部に従った処理)をプログラムとしてCD−R、ROMやDVD−ROM、MO等の記憶媒体に記憶させ、この記憶媒体に記憶されているプログラムをコンピュータに読み込ませる(インストール、もしくはコピーさせる)ことで、このコンピュータは以上の処理を行うことができる。よって、この記憶媒体も本発明の範疇にあることは明白である。
【0047】
また、上記実施形態で説明したトゥーンシェーディング処理は以下の構成を備えるテクスチャマッピング装置でも実現可能である。すなわち、3次元モデルに対してテクスチャマッピングを行うテクスチャマッピング装置であって、3次元モデルにおいて注目部分の法線ベクトルと、光源から当該3次元モデルに対して照射される光の方向ベクトルとの内積値を求める第1の計算手段と、前記3次元モデルとカメラとの距離を求める第2の計算手段と、前記方向ベクトルと、前記3次元モデルにおいてテクスチャマッピングを行う部分の夫々の法線ベクトルとの内積値に応じた画素値を有する画素列を第1の方向に、前記3次元モデルと前記カメラとの距離に応じた画素値を有する画素列を前記第1の方向とは直交する第2の方向に配置するテクスチャ画像から、前記第1,2の計算手段による計算結果に基づいて前記注目部分にテクスチャマッピングを行う画素を特定する特定手段とを備え、前記特定手段により特定された画素を前記注目部分にテクスチャマッピングすることを特徴とするテクスチャマッピング装置により上記実施形態で説明した一連の処理を行うことができるので、上記構成を備える装置は本発明の範疇にあることは明確である。
【0048】
また、上記実施形態で説明したトゥーンシェーディング処理は以下の構成を備えるテクスチャマッピング装置でも実現可能である。すなわち、3次元モデルに対してテクスチャマッピングを行うテクスチャマッピング装置であって、3次元モデルにおいて注目部分の法線ベクトルと、光源から当該3次元モデルに対して照射される光の方向ベクトルとの角度差を求める第1の計算手段と、前記3次元モデルとカメラとの距離を求める第2の計算手段と、前記方向ベクトルと、前記3次元モデルにおいてテクスチャマッピングを行う部分の夫々の法線ベクトルとの角度差に応じた画素値を有する画素列を第1の方向に、前記3次元モデルと前記カメラとの距離に応じた画素値を有する画素列を前記第1の方向とは直交する第2の方向に配置するテクスチャ画像から、前記第1,2の計算手段による計算結果に基づいて前記注目部分にテクスチャマッピングを行う画素を特定する特定手段とを備え、前記特定手段により特定された画素を前記注目部分にテクスチャマッピングすることを特徴とするテクスチャマッピング装置により上記実施形態で説明した一連の処理を行うことができるので、上記構成を備える装置は本発明の範疇にあることは明確である。
【0049】
また上記構成を備えるテクスチャマッピング装置は更に、特定手段が特定した画素を3次元モデルにテクスチャマッピングした処理済み3次元モデルに対して更に文字線画が描画されたテクスチャ画像をテクスチャマッピングすると共に、処理済み3次元モデルとカメラとの距離に応じて文字線画の透明度を制御する透明度制御手段を備えてもよい。
【0050】
また、上記実施形態で説明したトゥーンシェーディング処理は以下の構成を備えるテクスチャマッピング装置でも実現可能である。すなわち、3次元モデルに対してテクスチャマッピングを行うテクスチャマッピング装置であって、3次元モデルにおいて注目部分の法線ベクトルと、光源から当該3次元モデルに対して照射される光の第1の方向ベクトルとの内積値を求める第1の計算手段と、前記第1の方向ベクトルと、カメラから前記3次元モデルに対する第2の方向ベクトルとの内積値を求める第2の計算手段と、前記第1の方向ベクトルと、前記3次元モデルにおいてテクスチャマッピングを行う部分の夫々の法線ベクトルとの内積値に応じた画素値を有する画素列を第1の方向に、前記第1の方向ベクトルと前記第2の方向ベクトルとの内積値に応じた画素値を有する画素列を前記第1の方向とは直交する第2の方向に配置するテクスチャ画像から、前記第1,2の計算手段による計算結果に基づいて前記注目部分にテクスチャマッピングを行う画素を特定する特定手段とを備え、前記特定手段により特定された画素を前記注目部分にテクスチャマッピングすることを特徴とするテクスチャマッピング装置により上記実施形態で説明した一連の処理を行うことができるので、上記構成を備える装置は本発明の範疇にあることは明確である。
【0051】
また、上記実施形態で説明したトゥーンシェーディング処理は以下の構成を備えるテクスチャマッピング装置でも実現可能である。すなわち、3次元モデルに対してテクスチャマッピングを行うテクスチャマッピング装置であって、3次元モデルにおいて注目部分の法線ベクトルと、光源から当該3次元モデルに対して照射される光の第1の方向ベクトルとの角度差を求める第1の計算手段と、前記第1の方向ベクトルと、カメラから前記3次元モデルに対する第2の方向ベクトルとの角度差を求める第2の計算手段と、
前記第1の方向ベクトルと、前記3次元モデルにおいてテクスチャマッピングを行う部分の夫々の法線ベクトルとの角度差に応じた画素値を有する画素列を第1の方向に、前記第1の方向ベクトルと前記第2の方向ベクトルとの角度差に応じた画素値を有する画素列を前記第1の方向とは直交する第2の方向に配置するテクスチャ画像から、前記第1,2の計算手段による計算結果に基づいて前記注目部分にテクスチャマッピングを行う画素を特定する特定手段とを備え、前記特定手段により特定された画素を前記注目部分にテクスチャマッピングすることを特徴とするテクスチャマッピング装置により上記実施形態で説明した一連の処理を行うことができるので、上記構成を備える装置は本発明の範疇にあることは明確である。
【0052】
【発明の効果】
以上の説明により、本発明によって、3次元モデル、光源、カメラのうち一部、もしくは全部の位置関係に応じたテクスチャマッピングを3次元モデルに対して行うことができる。
【図面の簡単な説明】
【図1】3次元モデルと光源を示す図である。
【図2】従来のトゥーンシェーディング処理で用いるテクスチャ画像を示す図である。
【図3】本発明の実施形態における情報処理装置の基本構成を示すブロック図である。
【図4】本発明の第1の実施形態におけるテクスチャ画像を示す図である。
【図5】本発明の第1の実施形態におけるトゥーンシェーディング処理のフローチャートである。
【図6】本発明の第1の実施形態におけるトゥーンシェーディング処理を施された3次元モデル601に対して点線画鋲がされたテクスチャ画像602を貼り付け、ボールの3次元モデル603を生成する流れを示す図である。
【図7】カメラ、3次元モデル、光源を示す図である。
【図8】(a)は逆光の時に見える3次元モデルを示す図で、(b)は順光の時に見える3次元モデルを示す図である。
【図9】本発明の第2の実施形態におけるテクスチャ画像を示す図である。
【図10】本発明の第2の実施形態におけるトゥーンシェーディング処理のフローチャートである。
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a texture mapping program.
[0002]
[Prior art]
In image processing technology, there is a process called texture mapping. This is generally a process of pasting (mapping) a two-dimensional image (texture image) on the surface of the three-dimensional model. In this texture mapping process, the three-dimensional model is shaded with a coarse gradation according to the difference between the angle between the direction vector of the light from the light source and the normal vector at each point on the surface of the three-dimensional model. There is a process (hereinafter referred to as toon shading process) performed on a three-dimensional model so as to obtain a two-dimensional animation-like image.
[0003]
[Problems to be solved by the invention]
When the three-dimensional model is located far from the camera, the details of the three-dimensional model are difficult to understand on the displayed screen. Therefore, in this case, it is preferable to reduce the image information of the three-dimensional model. Further, color information on the surface of the three-dimensional model changes depending on the positional relationship between the light source and the three-dimensional model. For example, when the three-dimensional model is located in a place where the camera is in backlight, the three-dimensional model viewed from the position of the camera looks almost as a black object.
[0004]
The present invention has been made in view of such a point, and performs texture mapping on a three-dimensional model according to a part or all of a three-dimensional model, a light source, and a camera. Aim.
[0005]
[Means for Solving the Problems]
In order to achieve the object of the present invention, for example, a texture mapping program of the present invention has the following configuration.
[0006]
That is, a texture mapping program for performing texture mapping on a three-dimensional model,
A program for a first calculation step for calculating an inner product value of a normal vector of a portion of interest in the three-dimensional model and a direction vector of light emitted from the light source to the three-dimensional model;
A program for a second calculation step for obtaining a distance between the three-dimensional model and a camera;
A pixel row having a pixel value corresponding to an inner product value of the direction vector and each normal vector of a portion to be texture-mapped in the three-dimensional model is moved in a first direction between the three-dimensional model and the camera. From a texture image in which a pixel row having a pixel value corresponding to a distance is arranged in a second direction orthogonal to the first direction, the target portion is determined based on the calculation results in the first and second calculation steps. A program for a specific step of specifying a pixel for performing texture mapping,
The pixel specified in the specifying step is texture-mapped to the target portion.
[0007]
In order to achieve the object of the present invention, for example, a texture mapping program of the present invention has the following configuration.
[0008]
That is, a texture mapping program for performing texture mapping on a three-dimensional model,
A program for a first calculation step for obtaining an angle difference between a normal vector of a target portion in the three-dimensional model and a direction vector of light emitted from the light source to the three-dimensional model;
A program for a second calculation step for obtaining a distance between the three-dimensional model and a camera;
A pixel row having a pixel value corresponding to an angle difference between the direction vector and each normal vector of a portion on which texture mapping is performed in the three-dimensional model is moved in a first direction between the three-dimensional model and the camera. From a texture image in which a pixel row having a pixel value corresponding to a distance is arranged in a second direction orthogonal to the first direction, the target portion is determined based on the calculation results in the first and second calculation steps. A program for a specific step of specifying a pixel for performing texture mapping,
The pixel specified in the specifying step is texture-mapped to the target portion.
[0009]
Further, the texture mapping program texture-maps a texture image in which a character or line drawing is further drawn on a processed three-dimensional model obtained by texture-mapping the pixels specified in the specifying step to the three-dimensional model,
The program further includes a program for a transparency control step of controlling the transparency of the character and line drawing according to the distance between the processed three-dimensional model and the camera.
[0010]
In order to achieve the object of the present invention, for example, a texture mapping program of the present invention has the following configuration.
[0011]
That is, a texture mapping program for performing texture mapping on a three-dimensional model,
A program for a first calculation step for calculating an inner product value of a normal vector of a target portion in the three-dimensional model and a first direction vector of light emitted from the light source to the three-dimensional model;
A program for a second calculation step of obtaining an inner product value of the first direction vector and a second direction vector for the three-dimensional model from a camera;
A pixel row having a pixel value corresponding to an inner product value of the first direction vector and respective normal vectors of a portion to be texture-mapped in the three-dimensional model is set in a first direction by the first direction vector. In the first and second calculation steps, a texture image in which a pixel row having a pixel value corresponding to the inner product value of the second direction vector and the second direction vector is arranged in a second direction orthogonal to the first direction is used. A program of a specifying step of specifying a pixel for performing texture mapping on the target portion based on the calculation result of
The pixel specified in the specifying step is texture-mapped to the target portion.
[0012]
In order to achieve the object of the present invention, for example, a texture mapping program of the present invention has the following configuration.
[0013]
That is, a texture mapping program for performing texture mapping on a three-dimensional model,
A program for a first calculation step for calculating an angle difference between a normal vector of a target portion in the three-dimensional model and a first direction vector of light emitted from the light source to the three-dimensional model;
A program for a second calculation step of calculating an angle difference between the first direction vector and a second direction vector with respect to the three-dimensional model from a camera;
A pixel row having a pixel value corresponding to an angle difference between the first direction vector and each normal vector of a portion on which texture mapping is performed in the three-dimensional model is provided in a first direction by the first direction vector. In the first and second calculation steps, a texture image in which a pixel row having a pixel value corresponding to the angle difference between the first direction and the second direction vector is arranged in a second direction orthogonal to the first direction. A program of a specifying step of specifying a pixel for performing texture mapping on the target portion based on the calculation result of
The pixel specified in the specifying step is texture-mapped to the target portion.
[0014]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the accompanying drawings.
[0015]
First, an outline of a conventional toon shading process will be described. Generally, when a three-dimensional model is generated by a computer and displayed on a display device, shading processing is performed on the three-dimensional model. The inner product of the direction vector of the light emitted from the light source (hereinafter, light source vector) and the normal vector at each point on the surface of the three-dimensional model is calculated. The larger the inner product, the darker the color, and the smaller the inner product, the brighter the color. By expressing each point with, a gentle (fine gradation) shadow can be added to the surface of the three-dimensional model.
[0016]
When the image of the three-dimensional model subjected to the shading process (hereinafter, sometimes referred to as a general shading process to be distinguished from the toon shading process) is used in combination with an animation image, the animation image includes each object that appears. Since the shadows (including creatures) are represented with coarse gradations, the observer who sees the image after the synthesis gives an image of the three-dimensional model subjected to the shading processing, which is shaded with fine gradations. Will give you a sense of discomfort. Therefore, a process (toon shading process) of pasting a texture image, which is an image of a two-dimensional animation tone, in which the gradation of the image is roughened by the shading process to the three-dimensional model, to the three-dimensional model is performed.
[0017]
FIG. 1 shows a three-dimensional model and a light source. In the shading process, a normal vector V at an arbitrary point P (a polygon when the three-dimensional model is formed by a polygon) of the three-dimensional model is used. N And light source vector V L The shade at the point P is determined according to the inner product value of. On the other hand, in the toon shading process, the position of the pixel to be pasted to the point P in the texture image is determined according to the inner product value, and the pixel at the decided position is pasted to the point P of the three-dimensional model.
[0018]
FIG. 2 shows a texture image used in the toon shading process. The image shown in the figure is M pixels vertically and N pixels horizontally, and has white, gray, and black regions from the left in the figure. The length of each region in the horizontal direction is arbitrary. Here, when the inner product value at an arbitrary point on the three-dimensional model is a, the point is a pixel at the (a + 1) (N−1) / 2-th position from the left in the texture image shown in FIG. (When the leftmost pixel is the 0th pixel). In other words, a point having a larger inner product value tends to use a pixel on the right side of the texture image, and a point having a smaller inner product value tends to use a pixel on the left side. As a result, a darker color (black in the figure) can be assigned to a point having a larger inner product value, and a brighter color (white in the same figure) can be assigned to a dot having a smaller inner product value, and each color used in the texture image is roughly divided. Therefore, as a result of the toon shading processing, a texture image in which the gradation of the image obtained by the shading processing is coarsened on the three-dimensional model, as if it were a two-dimensional animation-like image, can be pasted on the three-dimensional model. it can.
[0019]
However, in the above-mentioned conventional toon shading processing, the direction of referring to the texture image (FIG. 2) is only the horizontal direction according to the inner product value. That is, the vertical direction was not referred to in the texture image of FIG. Therefore, in the following embodiment, a texture image having information to be used in the vertical direction according to a situation (a part or all of a three-dimensional model, a light source, and a camera), and toon shading using the texture image A program for performing the processing will be described.
[0020]
[First Embodiment]
The program for performing the toon shading process in the present embodiment refers to the vertical direction of the texture image to be used according to the distance between the camera and the three-dimensional model to which the texture image is pasted.
[0021]
FIG. 3 shows a basic configuration of an information processing apparatus that executes a program for performing toon shading according to the present embodiment. Note that the information processing apparatus shown in FIG. 1 includes a general personal computer, a workstation, a game device, and the like.
[0022]
Reference numeral 301 denotes a CPU that controls the entire apparatus using programs and data stored in a RAM 302 and a ROM 303 and performs various image processing including a toon shading process described later. A RAM 302 has an area for temporarily storing programs, data, and the like read from a hard disk drive 304 (hereinafter, HDD) or a CD-ROM drive 305, and is used when the CPU 301 executes various processes. It also has a work area to use. A ROM 303 stores programs, data, and the like for controlling the entire apparatus. Reference numeral 304 denotes the HDD, which can store programs, data, and the like read from the CD-ROM drive 305 as files. A CD-ROM drive 305 reads out programs and data from a CD-ROM as a storage medium storing programs and data. A display device 306 is configured by a CRT, a liquid crystal screen, or the like, and displays images, characters, and the like. An operation unit 307 includes a keyboard, a mouse, a pad for playing a game, a joystick, and the like, and functions as an interface for inputting instructions from the operator to the apparatus. A bus 308 connects the above-described units.
[0023]
In addition to the above configuration, a drive for reading programs and data from other storage media such as a DVD-ROM and a floppy disk may be provided in addition to the CD-ROM.
[0024]
Next, a texture image according to the present embodiment will be described. FIG. 4 shows a texture image according to the present embodiment. The texture image in this embodiment is M pixels vertically and N pixels horizontally. Also, in the figure, the origin (0, 0) is taken at the upper left corner of the image in the figure, the horizontal direction is the x-axis direction, and the vertical direction is the y-axis direction. In the present embodiment, the color of the brightest part in the three-dimensional model is white for the sake of simplicity, but the present invention is not limited to this.
[0025]
When applying the texture image shown in the figure to the toon shading processing, first, the distance between the three-dimensional model and the camera is calculated. Let the calculated distance be y. Next, an inner product value of the normal vector and the light source vector at the point P where the texture is to be attached in the three-dimensional model is obtained, and this is set as x. Then, a pixel at a position corresponding to ((x + 1) × (N−1) / 2, y × M / L2) in the texture image shown in FIG. 4 is pasted to a point P in the three-dimensional model.
[0026]
The texture image shown in FIG. 4 is configured so that the types of colors that can be used decrease as the distance between the three-dimensional model and the camera increases, and almost decreases as the distance between the three-dimensional model and the camera increases. Are configured to be gray with respect to the inner product value of. Specifically, in the figure, when the distance is short (from distance 0 to distance L1), three colors of white, gray, and black can be used according to the inner product value. However, when the distance is equal to or longer than L1, two colors of gray and black can be used regardless of the inner product value. If the distance is longer than L2, it is treated as L2.
[0027]
Therefore, by performing the toon shading process as described above using the texture image shown in FIG. 4, the colors that can be used according to the distance between the three-dimensional model and the camera, the number of colors, and the ratio of each color to each inner product value Can be changed. That is, by performing the toon shading process using the texture image shown in FIG. 12, the result of the conventional toon shading process can be obtained, and the expression color can be changed according to the distance between the three-dimensional model and the camera. .
[0028]
FIG. 5 shows a flowchart of the toon shading process using the texture image in the present embodiment. Note that the program according to the flowchart shown in the drawing is read into the RAM 302 and executed by the CPU 301, so that the information processing apparatus according to the present embodiment can perform the toon shading processing. The flowchart shown in the figure is executed as a rendering process (subroutine) when displaying the three-dimensional model subjected to the toon shading process on the screen of the display device 306.
[0029]
First, the distance (y) between the camera and the three-dimensional model is calculated and stored in the RAM 302 (step S501). This can be obtained using the three-dimensional coordinate values of each other. Note that the processing for obtaining this distance may be performed outside the processing according to the flowchart shown in the figure, and the distance obtained externally may be read into the RAM 302 in step S501. Next, an inner product value (x) of a normal vector and a light source vector at one point on the three-dimensional model (one polygon when the three-dimensional model is formed by polygons) is obtained and stored in the RAM 302 ( Step S502).
[0030]
Next, in the texture image shown in FIG. 4 by using x and y obtained in steps S501 and S502 and stored in the RAM 302, (((x + 1) × (N−1) / 2, y × M / L2 )) Is pasted on the one point (step S503). If there is a point on the three-dimensional model where the texture image has not been pasted yet, the process returns to step S502, and the same process is performed on this point.
[0031]
By performing the processing of steps S501 to S503 described above for all points on the three-dimensional model, the toon shading according to the present embodiment can be performed on the three-dimensional model.
[0032]
In the above description, the maximum number of colors used for the texture image is three, but the present invention is not limited to this. Further, the above description is not limited to the texture image shown in FIG. That is, the ratio and distribution of each color shown in FIG. 4 are not limited thereto. In the texture image, the x-axis direction is not limited to the inner product value of the normal vector and the light source vector, but may be, for example, an angle difference between the normal vector and the light source vector.
[0033]
Next, a case will be described in which a texture image in which a character line drawing is drawn is further pasted on the three-dimensional model subjected to the toon shading processing. FIG. 6 is a diagram showing a flow of generating a three-dimensional model 603 of a baseball ball by pasting a texture image 602 in which a dotted line is drawn on the three-dimensional model 601 subjected to the toon shading process. In the texture image 602, only the dotted line portion (the seam portion of the ball) is drawn in an arbitrary color, and the other region is the background color of the pasted three-dimensional model (that is, the toon shading process in the present embodiment). (The color of the surface of the three-dimensional model) is transparent.
[0034]
As the three-dimensional model 603 of the ball generated by the method shown in the figure moves away from the camera, the color of the background changes due to the toon shading process, but as described above, it becomes difficult to confirm the seam portion, Flicker. Therefore, it is preferable to lower the α value of the seam portion as the distance from the camera increases, and to increase the transparency of the seam portion as the distance from the camera increases.
[0035]
[Second embodiment]
The program for performing the toon shading process in the present embodiment refers to the vertical direction of the texture image to be used according to the positional relationship between the light source and the camera. FIG. 7 shows a camera, a three-dimensional model, and a light source. V L , V N Is the same as that shown in FIG. C Is a direction vector (line-of-sight vector) from the camera to the three-dimensional model.
[0036]
Gaze vector V C And light source vector V L In the case where the angle formed between the three-dimensional model is 180 degrees, that is, in the case of backlight, the three-dimensional model looks almost as shown in FIG. That is, most of the three-dimensional model looks black in the visible range, and only the peripheral portion looks slightly bright. On the other hand, the line-of-sight vector V C And light source vector V L In the case where the angle formed by the three-dimensional model is 0 degree, that is, in the case of normal light, the three-dimensional model looks almost as shown in FIG. That is, most of the three-dimensional model looks white in the visible range. Thus, the appearance of the three-dimensional model changes depending on the positional relationship between the camera and the light source.
[0037]
FIG. 9 shows a texture image according to the present embodiment. In this embodiment, the texture image is M pixels vertically and N pixels horizontally as in the first embodiment. The origin (0, 0) is set at the upper left corner of the image in FIG. Let the direction be the y-axis direction. In the present embodiment, as in the first embodiment, the color of the brightest part in the three-dimensional model is white, but is not limited thereto.
[0038]
When the texture image shown in the figure is applied to the toon shading process, first, the difference between the angles formed by the line-of-sight vector and the light source vector is calculated. The difference between the calculated angles is defined as y. Next, an inner product value of the normal vector and the light source vector at the point P where the texture is to be pasted in the three-dimensional model is obtained, and this is defined as x. Then, the pixel located at the coordinates ((x + 1) × (N−1) / 2, y × M / 360) in the texture image shown in FIG. 9 is pasted to the point P in the three-dimensional model.
[0039]
The texture image shown in FIG. 9 is configured so that the angle difference between the line-of-sight vector and the light source vector is 180 degrees, that is, the closer to backlight, the type and proportion of dark colors to be used increase. In the texture image, the type and distribution of each color are upper and lower than 180 degrees and the target is the target.
[0040]
Therefore, by performing the toon shading process as described above using the texture image shown in FIG. 9, the available colors, the number of colors, and the ratio of each color to each inner product value are changed according to the positional relationship between the camera and the light source. Can be done. That is, by performing the toon shading process using the texture image shown in FIG. 11, the result of the conventional toon shading process can be obtained, and the expression color can be changed according to the positional relationship between the camera and the light source.
[0041]
FIG. 10 shows a flowchart of the toon shading process using the texture image in the present embodiment. Note that the program according to the flowchart shown in the drawing is read into the RAM 302 and executed by the CPU 301, so that the information processing apparatus according to the present embodiment can perform the toon shading processing. The flowchart shown in the figure is executed as a rendering process (subroutine) when displaying the three-dimensional model subjected to the toon shading process on the screen of the display device 306.
[0042]
First, the angle difference (y) between the line-of-sight vector and the light source vector is calculated and stored in the RAM 302 (step S1001). The line-of-sight vector can be obtained using the coordinates of the camera and the coordinates of the three-dimensional model. The light source vector can be obtained using the coordinates of the light source and the coordinates of the three-dimensional model. Note that the process for obtaining the angle difference may be performed outside the process according to the flowchart shown in the figure, and the externally obtained angle difference may be read into the RAM 302 in step S1001. Next, the inner product value of the normal vector and the light source vector at one point on the three-dimensional model (one polygon when the three-dimensional model is formed by polygons) is obtained (x) and stored in the RAM 302 ( Step S1002).
[0043]
Next, in the texture image shown in FIG. 9 by using x and y obtained in steps S1001 and S1002 and stored in the RAM 302, (((x + 1) × (N−1) / 2, y × M / 360) )) Is pasted on the one point (step S1003). If there is a point on the three-dimensional model to which the texture image has not been pasted, the process returns to step S1002, and the same process is performed on this point.
[0044]
By performing the processing of steps S1001 to S1003 described above for all points on the three-dimensional model, the toon shading according to the present embodiment can be performed on the three-dimensional model.
[0045]
In the above description, the maximum number of colors used for the texture image is three, but the present invention is not limited to this. Further, the above description is not limited to the texture image shown in FIG. That is, the ratio and distribution of the components of each color shown in FIG. 9 are not limited to this. In the texture image, the x-axis direction is not limited to the inner product value of the normal vector and the light source vector, but may be an angle formed by the normal vector and the light source vector, for example. Similarly, the y-axis direction is not limited to the angle difference between the line-of-sight vector and the light source vector, but may be, for example, an inner product of the line-of-sight vector and the light source vector.
[0046]
[Third Embodiment]
The above processing (for example, processing in accordance with part or all of the flowcharts shown in FIGS. 5 and 10) is stored as a program in a storage medium such as a CD-R, a ROM, a DVD-ROM, and an MO. By causing the computer to read (install or copy) the stored program, the computer can perform the above processing. Therefore, it is clear that this storage medium also falls within the scope of the present invention.
[0047]
Further, the toon shading processing described in the above embodiment can also be realized by a texture mapping device having the following configuration. That is, the texture mapping apparatus performs texture mapping on a three-dimensional model, and includes an inner product of a normal vector of a target portion in the three-dimensional model and a direction vector of light emitted from the light source to the three-dimensional model. First calculating means for obtaining a value, second calculating means for obtaining a distance between the three-dimensional model and the camera, the direction vector, and respective normal vectors of a portion for performing texture mapping in the three-dimensional model. A pixel row having a pixel value corresponding to the inner product value of the three-dimensional model in a first direction, and a pixel row having a pixel value corresponding to a distance between the three-dimensional model and the camera is a second row orthogonal to the first direction. From the texture images arranged in the direction of (1), a pixel for performing texture mapping on the target portion is specified based on the calculation result by the first and second calculation means. A texture mapping device, characterized in that the texture mapping device is characterized in that the pixel specified by the specifying device is texture-mapped to the portion of interest, so that the series of processes described in the above embodiment can be performed. It is clear that the equipment provided is within the scope of the present invention.
[0048]
Further, the toon shading processing described in the above embodiment can also be realized by a texture mapping device having the following configuration. That is, the texture mapping apparatus performs texture mapping on a three-dimensional model, and includes an angle between a normal vector of a target portion in the three-dimensional model and a direction vector of light emitted from the light source to the three-dimensional model. First calculating means for obtaining a difference, second calculating means for obtaining a distance between the three-dimensional model and the camera, the direction vector, and respective normal vectors of a portion of the three-dimensional model which performs texture mapping. A pixel row having a pixel value corresponding to the angle difference between the three-dimensional model and the camera in a first direction, and a pixel row having a pixel value corresponding to a distance between the three-dimensional model and the camera in a second direction orthogonal to the first direction. From the texture images arranged in the direction of (1), a pixel for performing texture mapping on the target portion is specified based on the calculation result by the first and second calculation means. A texture mapping device, characterized in that the texture mapping device is characterized in that the pixel specified by the specifying device is texture-mapped to the portion of interest, so that the series of processes described in the above embodiment can be performed. It is clear that the equipment provided is within the scope of the present invention.
[0049]
Further, the texture mapping apparatus having the above configuration further texture-maps a texture image in which a character or line drawing is drawn on the processed three-dimensional model obtained by texture-mapping the pixels specified by the specifying unit to the three-dimensional model, and A transparency control unit for controlling the transparency of the character / line drawing according to the distance between the three-dimensional model and the camera may be provided.
[0050]
Further, the toon shading processing described in the above embodiment can also be realized by a texture mapping device having the following configuration. That is, the texture mapping apparatus performs texture mapping on a three-dimensional model, and includes a normal vector of a target portion in the three-dimensional model and a first direction vector of light emitted from the light source to the three-dimensional model. A first calculating means for obtaining an inner product value of the first direction vector, a second calculating means for obtaining an inner product value of the first direction vector and a second direction vector for the three-dimensional model from a camera, A pixel row having a pixel value corresponding to an inner product value of a direction vector and respective normal vectors of a portion to be texture-mapped in the three-dimensional model is set in a first direction, and the first direction vector and the second From the texture image in which a pixel row having a pixel value corresponding to the inner product value with the direction vector of the first direction is arranged in a second direction orthogonal to the first direction, Specifying a pixel to be texture-mapped to the noted portion based on a calculation result by the calculating device. And texture-mapping the pixel specified by the specifying device to the noted portion. Since the series of processes described in the above embodiment can be performed by the device, it is clear that the device having the above configuration is within the scope of the present invention.
[0051]
Further, the toon shading processing described in the above embodiment can also be realized by a texture mapping device having the following configuration. That is, the texture mapping apparatus performs texture mapping on a three-dimensional model, and includes a normal vector of a target portion in the three-dimensional model and a first direction vector of light emitted from the light source to the three-dimensional model. First calculating means for obtaining an angle difference between the first direction vector and a second direction vector from the camera with respect to the three-dimensional model;
A pixel row having a pixel value corresponding to an angle difference between the first direction vector and each normal vector of a portion on which texture mapping is performed in the three-dimensional model is provided in a first direction by the first direction vector. The first and second calculation means determine a pixel row having a pixel value corresponding to an angle difference between the first and second direction vectors from a texture image in which the pixel row is arranged in a second direction orthogonal to the first direction. Specifying means for specifying a pixel on which texture mapping is to be performed on the target portion based on a calculation result, wherein the pixel specified by the specifying device is texture-mapped to the target portion. Since the series of processes described in the embodiments can be performed, it is clear that an apparatus having the above configuration is within the scope of the present invention.
[0052]
【The invention's effect】
As described above, according to the present invention, it is possible to perform texture mapping on a three-dimensional model according to a part or all of a three-dimensional model, a light source, and a camera.
[Brief description of the drawings]
FIG. 1 is a diagram showing a three-dimensional model and a light source.
FIG. 2 is a diagram illustrating a texture image used in a conventional toon shading process.
FIG. 3 is a block diagram illustrating a basic configuration of an information processing apparatus according to an embodiment of the present invention.
FIG. 4 is a diagram illustrating a texture image according to the first embodiment of the present invention.
FIG. 5 is a flowchart of a toon shading process according to the first embodiment of the present invention.
FIG. 6 shows a flow of generating a three-dimensional model 603 of a ball by pasting a texture image 602 having a dotted pin on a three-dimensional model 601 subjected to toon shading processing according to the first embodiment of the present invention. FIG.
FIG. 7 is a diagram showing a camera, a three-dimensional model, and a light source.
8A is a diagram illustrating a three-dimensional model that can be seen when the subject is backlit, and FIG. 8B is a diagram that illustrates a three-dimensional model that can be seen when the subject is frontlit.
FIG. 9 is a diagram illustrating a texture image according to the second embodiment of the present invention.
FIG. 10 is a flowchart of a toon shading process according to the second embodiment of the present invention.

Claims (7)

3次元モデルに対してテクスチャマッピングを行うテクスチャマッピングプログラムであって、
3次元モデルにおいて注目部分の法線ベクトルと、光源から当該3次元モデルに対して照射される光の方向ベクトルとの内積値を求める第1の計算工程のプログラムと、
前記3次元モデルとカメラとの距離を求める第2の計算工程のプログラムと、
前記方向ベクトルと、前記3次元モデルにおいてテクスチャマッピングを行う部分の夫々の法線ベクトルとの内積値に応じた画素値を有する画素列を第1の方向に、前記3次元モデルと前記カメラとの距離に応じた画素値を有する画素列を前記第1の方向とは直交する第2の方向に配置するテクスチャ画像から、前記第1,2の計算工程での計算結果に基づいて前記注目部分にテクスチャマッピングを行う画素を特定する特定工程のプログラムとを含み、
前記特定工程で特定された画素を前記注目部分にテクスチャマッピングすることを特徴とするテクスチャマッピングプログラム。
A texture mapping program for performing texture mapping on a three-dimensional model,
A program for a first calculation step for calculating an inner product value of a normal vector of a portion of interest in the three-dimensional model and a direction vector of light emitted from the light source to the three-dimensional model;
A program for a second calculation step for obtaining a distance between the three-dimensional model and a camera;
A pixel row having a pixel value corresponding to an inner product value of the direction vector and each normal vector of a portion to be texture-mapped in the three-dimensional model is moved in a first direction between the three-dimensional model and the camera. From a texture image in which a pixel row having a pixel value corresponding to a distance is arranged in a second direction orthogonal to the first direction, the target portion is determined based on the calculation results in the first and second calculation steps. A program for a specific step of specifying a pixel for performing texture mapping,
A texture mapping program for performing texture mapping of the pixel specified in the specifying step on the target portion.
3次元モデルに対してテクスチャマッピングを行うテクスチャマッピングプログラムであって、
3次元モデルにおいて注目部分の法線ベクトルと、光源から当該3次元モデルに対して照射される光の方向ベクトルとの角度差を求める第1の計算工程のプログラムと、
前記3次元モデルとカメラとの距離を求める第2の計算工程のプログラムと、
前記方向ベクトルと、前記3次元モデルにおいてテクスチャマッピングを行う部分の夫々の法線ベクトルとの角度差に応じた画素値を有する画素列を第1の方向に、前記3次元モデルと前記カメラとの距離に応じた画素値を有する画素列を前記第1の方向とは直交する第2の方向に配置するテクスチャ画像から、前記第1,2の計算工程での計算結果に基づいて前記注目部分にテクスチャマッピングを行う画素を特定する特定工程のプログラムとを含み、
前記特定工程で特定された画素を前記注目部分にテクスチャマッピングすることを特徴とするテクスチャマッピングプログラム。
A texture mapping program for performing texture mapping on a three-dimensional model,
A program for a first calculation step for obtaining an angle difference between a normal vector of a target portion in the three-dimensional model and a direction vector of light emitted from the light source to the three-dimensional model;
A program for a second calculation step for obtaining a distance between the three-dimensional model and a camera;
A pixel row having a pixel value corresponding to an angle difference between the direction vector and each normal vector of a portion on which texture mapping is performed in the three-dimensional model is moved in a first direction between the three-dimensional model and the camera. From a texture image in which a pixel row having a pixel value corresponding to a distance is arranged in a second direction orthogonal to the first direction, the target portion is determined based on the calculation results in the first and second calculation steps. A program for a specific step of specifying a pixel for performing texture mapping,
A texture mapping program for performing texture mapping of the pixel specified in the specifying step on the target portion.
更に、前記特定工程で特定された画素を前記3次元モデルにテクスチャマッピングした処理済み3次元モデルに対して更に文字線画が描画されたテクスチャ画像をテクスチャマッピングすると共に、
前記処理済み3次元モデルと前記カメラとの距離に応じて前記文字線画の透明度を制御する透明度制御工程のプログラムを含むことを特徴とする請求項1または2に記載のテクスチャマッピングプログラム。
Further, a texture image in which a character and line drawing is further drawn is texture-mapped to the processed three-dimensional model obtained by texture-mapping the pixels specified in the specifying step to the three-dimensional model,
The program according to claim 1, further comprising a program for a transparency control step of controlling the transparency of the character / line drawing in accordance with a distance between the processed three-dimensional model and the camera.
前記透明度制御工程のプログラムは、前記処理済み3次元モデルと前記カメラとの距離が近いほど透明度を下げ、遠いほど透明度を上げることを特徴とする請求項3に記載のテクスチャマッピングプログラム。4. The texture mapping program according to claim 3, wherein the program of the transparency control step reduces the transparency as the distance between the processed three-dimensional model and the camera decreases, and increases the transparency as the distance increases. 3次元モデルに対してテクスチャマッピングを行うテクスチャマッピングプログラムであって、
3次元モデルにおいて注目部分の法線ベクトルと、光源から当該3次元モデルに対して照射される光の第1の方向ベクトルとの内積値を求める第1の計算工程のプログラムと、
前記第1の方向ベクトルと、カメラから前記3次元モデルに対する第2の方向ベクトルとの内積値を求める第2の計算工程のプログラムと、
前記第1の方向ベクトルと、前記3次元モデルにおいてテクスチャマッピングを行う部分の夫々の法線ベクトルとの内積値に応じた画素値を有する画素列を第1の方向に、前記第1の方向ベクトルと前記第2の方向ベクトルとの内積値に応じた画素値を有する画素列を前記第1の方向とは直交する第2の方向に配置するテクスチャ画像から、前記第1,2の計算工程での計算結果に基づいて前記注目部分にテクスチャマッピングを行う画素を特定する特定工程のプログラムとを含み、
前記特定工程で特定された画素を前記注目部分にテクスチャマッピングすることを特徴とするテクスチャマッピングプログラム。
A texture mapping program for performing texture mapping on a three-dimensional model,
A program for a first calculation step for calculating an inner product value of a normal vector of a target portion in the three-dimensional model and a first direction vector of light emitted from the light source to the three-dimensional model;
A program for a second calculation step of obtaining an inner product value of the first direction vector and a second direction vector for the three-dimensional model from a camera;
A pixel row having a pixel value corresponding to an inner product value of the first direction vector and respective normal vectors of a portion to be texture-mapped in the three-dimensional model is set in a first direction by the first direction vector. In the first and second calculation steps, a texture image in which a pixel row having a pixel value corresponding to the inner product value of the second direction vector and the second direction vector is arranged in a second direction orthogonal to the first direction is used. A program of a specifying step of specifying a pixel for performing texture mapping on the target portion based on the calculation result of
A texture mapping program for performing texture mapping of the pixel specified in the specifying step on the target portion.
3次元モデルに対してテクスチャマッピングを行うテクスチャマッピングプログラムであって、
3次元モデルにおいて注目部分の法線ベクトルと、光源から当該3次元モデルに対して照射される光の第1の方向ベクトルとの角度差を求める第1の計算工程のプログラムと、
前記第1の方向ベクトルと、カメラから前記3次元モデルに対する第2の方向ベクトルとの角度差を求める第2の計算工程のプログラムと、
前記第1の方向ベクトルと、前記3次元モデルにおいてテクスチャマッピングを行う部分の夫々の法線ベクトルとの角度差に応じた画素値を有する画素列を第1の方向に、前記第1の方向ベクトルと前記第2の方向ベクトルとの角度差に応じた画素値を有する画素列を前記第1の方向とは直交する第2の方向に配置するテクスチャ画像から、前記第1,2の計算工程での計算結果に基づいて前記注目部分にテクスチャマッピングを行う画素を特定する特定工程のプログラムとを含み、
前記特定工程で特定された画素を前記注目部分にテクスチャマッピングすることを特徴とするテクスチャマッピングプログラム。
A texture mapping program for performing texture mapping on a three-dimensional model,
A program for a first calculation step for calculating an angle difference between a normal vector of a target portion in the three-dimensional model and a first direction vector of light emitted from the light source to the three-dimensional model;
A program for a second calculation step of calculating an angle difference between the first direction vector and a second direction vector with respect to the three-dimensional model from a camera;
A pixel row having a pixel value corresponding to an angle difference between the first direction vector and each normal vector of a portion on which texture mapping is performed in the three-dimensional model is provided in a first direction by the first direction vector. In the first and second calculation steps, a texture image in which a pixel row having a pixel value corresponding to the angle difference between the first direction and the second direction vector is arranged in a second direction orthogonal to the first direction. A program of a specifying step of specifying a pixel for performing texture mapping on the target portion based on the calculation result of
A texture mapping program for performing texture mapping of the pixel specified in the specifying step on the target portion.
前記テクスチャマッピングはトゥーンシェーディング処理であることを特徴とする請求項1乃至6のいずれか1項に記載のテクスチャマッピングプログラム。The texture mapping program according to any one of claims 1 to 6, wherein the texture mapping is a toon shading process.
JP2002060557A 2002-03-06 2002-03-06 Texture mapping program Expired - Fee Related JP3586253B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002060557A JP3586253B2 (en) 2002-03-06 2002-03-06 Texture mapping program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002060557A JP3586253B2 (en) 2002-03-06 2002-03-06 Texture mapping program

Publications (2)

Publication Number Publication Date
JP2003256864A JP2003256864A (en) 2003-09-12
JP3586253B2 true JP3586253B2 (en) 2004-11-10

Family

ID=28669874

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002060557A Expired - Fee Related JP3586253B2 (en) 2002-03-06 2002-03-06 Texture mapping program

Country Status (1)

Country Link
JP (1) JP3586253B2 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4734138B2 (en) * 2006-02-23 2011-07-27 株式会社バンダイナムコゲームス Program, information storage medium, and image generation system
JP2010033297A (en) * 2008-07-28 2010-02-12 Namco Bandai Games Inc Program, information storage medium, and image generation system
JP6010004B2 (en) * 2013-09-02 2016-10-19 日本電信電話株式会社 Image processing apparatus, image processing method, and image processing program
CN104966312B (en) * 2014-06-10 2017-07-21 腾讯科技(深圳)有限公司 A kind of rendering intent, device and the terminal device of 3D models
JP6293081B2 (en) * 2015-03-18 2018-03-14 三菱電機株式会社 Color table generating apparatus and drawing apparatus

Also Published As

Publication number Publication date
JP2003256864A (en) 2003-09-12

Similar Documents

Publication Publication Date Title
JP4291892B2 (en) Image processing apparatus and method
US8115774B2 (en) Application of selective regions of a normal map based on joint position in a three-dimensional model
JP3179392B2 (en) Image processing apparatus and image processing method
WO1998038591A2 (en) Method for rendering shadows on a graphical display
JP3626144B2 (en) Method and program for generating 2D image of cartoon expression from 3D object data
JP2000251094A (en) Device and method for processing image
JP3777149B2 (en) Program, information storage medium, and image generation apparatus
JP3527489B2 (en) Drawing processing method and apparatus, recording medium storing drawing processing program, drawing processing program
JP2004110598A (en) Image generation information, information storage medium, and image generating device
JP3352982B2 (en) Rendering method and device, game device, and computer-readable recording medium for storing program for rendering three-dimensional model
JP2004005452A (en) Image processor, image processing method, semiconductor device, computer program and record medium
JP3502796B2 (en) 3D model display method and apparatus in video game, game apparatus, and computer-readable recording medium storing 3D model display program for video game
JP3586253B2 (en) Texture mapping program
JP3231029B2 (en) Rendering method and device, game device, and computer-readable recording medium storing program for rendering three-dimensional model
JP3253020B2 (en) Rendering method and device, game device, and computer-readable recording medium for storing program for rendering three-dimensional model
JP3035571B2 (en) Image processing device
JP4161613B2 (en) Image processing method
JP2001070634A (en) Game machine and its playing method
JP4009289B2 (en) Method for determining a weighting factor for color-calculating a texel color value associated with a footprint
WO2020166206A1 (en) Image processing device and program
JP3372034B2 (en) Rendering method and apparatus, game apparatus, and computer-readable recording medium storing program for rendering stereo model
JP4714919B2 (en) Rendering device, recording medium, and program
JP7190780B1 (en) Image processing program, image processing apparatus, and image processing method
JP2010033302A (en) Image generation system, program and information storage medium
JP4433525B2 (en) Image processing device

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20040709

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20040720

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040805

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

R371 Transfer withdrawn

Free format text: JAPANESE INTERMEDIATE CODE: R371

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080813

Year of fee payment: 4

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313115

Free format text: JAPANESE INTERMEDIATE CODE: R313111

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080813

Year of fee payment: 4

R360 Written notification for declining of transfer of rights

Free format text: JAPANESE INTERMEDIATE CODE: R360

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080813

Year of fee payment: 4

R370 Written measure of declining of transfer procedure

Free format text: JAPANESE INTERMEDIATE CODE: R370

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090813

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090813

Year of fee payment: 5

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090813

Year of fee payment: 5

R371 Transfer withdrawn

Free format text: JAPANESE INTERMEDIATE CODE: R371

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090813

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100813

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110813

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110813

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120813

Year of fee payment: 8

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130813

Year of fee payment: 9

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130813

Year of fee payment: 9

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140813

Year of fee payment: 10

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

S802 Written request for registration of partial abandonment of right

Free format text: JAPANESE INTERMEDIATE CODE: R311802

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees