JP3931691B2 - Image generating apparatus and program - Google Patents

Image generating apparatus and program Download PDF

Info

Publication number
JP3931691B2
JP3931691B2 JP2002062325A JP2002062325A JP3931691B2 JP 3931691 B2 JP3931691 B2 JP 3931691B2 JP 2002062325 A JP2002062325 A JP 2002062325A JP 2002062325 A JP2002062325 A JP 2002062325A JP 3931691 B2 JP3931691 B2 JP 3931691B2
Authority
JP
Japan
Prior art keywords
determination
intersection
bounding box
viewpoint
plane
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 - Lifetime
Application number
JP2002062325A
Other languages
Japanese (ja)
Other versions
JP2003263649A (en
Inventor
岳史 長田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Denso Corp
Original Assignee
Denso Corp
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 Denso Corp filed Critical Denso Corp
Priority to JP2002062325A priority Critical patent/JP3931691B2/en
Publication of JP2003263649A publication Critical patent/JP2003263649A/en
Application granted granted Critical
Publication of JP3931691B2 publication Critical patent/JP3931691B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

  • Image Generation (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、光線追跡法を用いた画像生成装置等に関する。
【0002】
【従来の技術】
光線追跡法は、視点から物体の方向に向かって画像を追跡し、光線が物体と交差すればその交点における物体の光の状態を求めて画像面(スクリーン)に投影して、2次元の画像を生成する手法である。光線と物体との交点を求める必要があるがその交点計算に非常に時間がかかるため、様々な高速化手法が考え出されているが、その一つとしてバウンディングボリュームを用いる方法がある。
【0003】
バウンディングボリュームは1又は複数の物体を内包し、球体や直方体(この場合を特に「バウンディングボックス」と言う)の形状を有している。光線と物体との交点を求める前にその物体を内包するバウンディングボリュームと光線とが交差するか否かを判定し、バウンディングボリュームと光線とが交差する場合のみ光線と物体との交点を求めることによって、不要な交点計算を減らしている。
【0004】
【発明が解決しようとする課題】
しかし、このような手法を用いてもなお計算量が非常に多く、画像を得るまでに長い時間を要する。このため、特にバウンディングボリュームの一つであるバウンディングボックスを用いた場合、更に計算量を減らして2次元の画像を得るまでの時間を短縮できる画像生成装置及びプログラムを提供することを目的とする。
【0005】
【課題を解決するための手段及び発明の効果】
上記目的を達成するために為された請求項1に記載の画像生成装置は、制御手段が、面交差判定(3次元物体を含む直方体からなるバウンディングボックスを構成する6面の何れかの面と光線とが交差するか否かの判定)を実行して光線と交差すると判定された面を持つバウンディングボックスを選択し、そのバウンディングボックスに含まれる3次元物体に対してのみ光線との交点を求める交点計算を実行する。また、内包判定手段が内包判定(視点がバウンディングボックスに内包されるか否かの判定)を制御手段の指令により実行する。そして、制御手段は、まず内包判定手段に内包判定を実行させ、その内包判定によって視点がバウンディングボックスに内包されると判定された場合は面交差判定を実行せずにバウンディングボックスと光線とは交差すると判定し、内包判定によって視点が内包されないと判定された場合は面交差判定を実行してバウンディングボックスと視点とが交差するか否かを判定する。
【0006】
このように、内包判定手段を備えることによって、制御手段は面交差判定を実行せずにバウンディングボックスと光線とが交差することを判定できる場合が生まれる。従って、内包判定に比べ計算コストが大きい面交差判定を制御手段が実行する回数を減少させることができ、画像生成装置によって画像が生成されるまでの時間が短縮される。
【0007】
尚、制御手段は常に内包判定手段に内包判定を実行させてもよいが、一般的にバウンディングボックスが小さければ小さいほど、視点がバウンディングボックスに内包される確率が減る。このため、ある程度の大きさのバウンディングボックスでないと内包判定を行う計算量に見合う効果が得られない。したがって、請求項2に記載のように、制御手段は、内包判定手段に内包判定を実行させるに先立ち、対象のバウンディングボックスが所定の大きさより大きいか否かを判定し、大きいと判定した場合は内包判定手段に内包判定を実行させ、小さいと判定した場合は内包判定手段に内包判定を実行させずに面交差判定を実行するようにしてもよい。
【0008】
このようになっていると、内包判定によって計算量が削減される可能性が高い場合のみ内包判定が行われ、内包判定によって計算量が削減される可能性が低い場合は内包判定は行われない。したがって、より計算量の削減につながる。
尚、ここで言うところの所定の大きさは、視点がバウンディングボックスに内包される確率と、面交差判定及び内包判定の計算量とを鑑み、例えば実験によって定めることができる。
【0009】
一方、請求項3に記載の画像生成装置は、請求項1及び請求項2と同様、制御手段が面交差判定を実行して光線と交差すると判定された面を持つバウンディングボックスを選択し、そのバウンディングボックスに含まれる3次元物体に対してのみ光線との交点を求める交点計算を実行する。また、不交差判定手段が制御手段の指令により次のような不交差判定を行う。それは、対象としているバウンディングボックスの頂点のうち正頂点を共有する3つの面をそれぞれ含む3つの無限平面について、各無限平面によって2つに分けられる領域のうちその無限平面自体を含まず且つ前記バウンディングボックス側でない領域の和集合で表される領域を不交差領域(図5(4)参照)とし、視点が不交差領域に含まれるか否かを判定することである。尚、光線を含む直線に関して、視点から見て光線のベクトル方向の無限遠を正無限、反対方向の無限遠を負無限とした場合、バウンディングボックスの各頂点から直線上に垂線を下ろした場合の交点位置が最も正無限方向に位置する頂点を正頂点、最も負無限方向に位置する頂点を負頂点とした。
【0010】
そして、制御手段は、まず不交差判定手段に不交差判定を実行させ、その判定によって視点が不交差領域に含まれないと判定された場合のみ面交差判定を実行してバウンディングボックスと視点とが交差するか否かを判定し、不交差判定によって視点が不交差領域に含まれると判定された場合には面交差判定を実行せずにバウンディングボックスと光線とは交差しないと判定する。
【0011】
このように、不交差判定手段を備えることによって、制御手段は面交差判定を実行せずにバウンディングボックスと光線とが交差しないことを判定できる場合が生まれる。従って、不交差判定に比べ計算コストが大きい面交差判定を制御手段が実行する回数を減少させることができ、画像生成装置によって画像が生成されるまでの時間が短縮される。
【0012】
尚、正頂点及び負頂点の設定手順は、上述した手順に限定されることはなく、上述した手順によって設定された頂点と実質的に同じ頂点を指すのであれば、どのような手順であってもよい。
また、請求項4に記載の画像生成装置のように不交差判定手段に加えて内包判定手段を備えてもよい。その場合、制御手段は、まず内包判定手段に内包判定を実行させ、その判定によって視点がバウンディングボックスに内包されると判定された場合は他の判定を実行せずにバウンディングボックスと光線とが交差すると判定する。一方、内包判定によって視点がバウンディングボックスに内包されないと判定された場合は続けて不交差判定手段に不交差判定を実行させる。そして、その不交差判定によって視点が不交差判定領域に含まれると判定された場合は光線とバウンディングボックスとは交差しないと判定し、不交差判定によって視点が不交差領域に含まれないと判定された場合は面交差判定を実行してバウンディングボックスと視点とが交差するか否かを判定する。
【0013】
このようにすれば、内包判定や不交差判定に比べ計算コストが大きい面交差判定を制御手段が実行する回数を更に減少させることができ、画像生成装置によって画像が生成されるまでの時間が短縮される。
尚、不交差判定と内包判定とを実行させる順序は逆であってもよい。すなわち、請求項5に記載の画像生成装置のように、制御手段は、まず不交差判定手段に不交差判定を実行させ、その判定によって視点が不交差領域に含まれると判定された場合は光線とバウンディングボックスとは交差しないと判定する。一方、不交差判定によって視点が不交差領域に含まれないと判定された場合は続けて内包判定手段に内包判定を実行させる。そして、その内包判定によって視点がバウンディングボックスに内包されると判定された場合は面交差判定を実行せずにバウンディングボックスと光線とは交差すると判定し、内包判定によって視点がバウンディングボックスに内包されないと判定された場合は面交差判定を実行してバウンディングボックスと視点とが交差するか否かを判定するようにしてもよい。
【0014】
このようにしても、請求項4に記載の画像生成装置と同様の作用及び効果が得られる。
尚、請求項5に記載の画像生成装置における内包判定手段が実行する内包判定は、請求項6に記載のようにしてもよい。つまり、負頂点を共有する3面をそれぞれ含む3つの無限平面について、各無限平面によって2つに分けられる領域のうちバウンディングボックス側である領域を対象領域にし、その3つの対象領域の積集合で表される領域(図6(4)参照)に視点が内包されていれば視点はバウンディングボックスに内包されていると判定し、3つの対象領域の積集合で表される領域に視点が内包されていなければ、視点はバウンディングボックスに内包されていないと判定する。
【0015】
なぜこのように判定してよいかと言うと、内包判定手段が内包判定を実行する段階で、不交差領域に視点が存在しないことが保証されているからである。したがって、上記の内包判定においては不交差領域に視点が存在しない前提で判定を行っている。その結果、画像生成装置によって画像が生成されるまでの時間が短縮される。
【0016】
更に、請求項7に記載のように、請求項6に記載の画像生成装置において、制御手段は、内包判定手段が内包判定で用いた3つの対象領域のうち視点を含まなかった対象領域を選択し、その対象領域を分けている無限平面に含まれるバウンディングボックスの面に対してのみ、面交差判定を実行するようにしてもよい(図6(1)〜(3)及び図7参照)。
【0017】
なぜなら、制御手段が面交差判定を実行する段階で、既に実行された不交差判定及び内包判定によって視点が存在し得る領域が推測されるからである。したがって、その領域において光線と交差する可能性のあるバウンディングボックスの面に対してだけ面交差判定が実行されればよい。
【0018】
このため、面交差判定を実行する面の数を減らすことができて計算量が減少し、画像生成装置によって画像が生成されるまでの時間が短縮される。
尚、請求項1又は、請求項4から請求項6の何れかに記載の画像生成装置においては、制御手段が面交差判定で光線と交差するか否かを判定する面は、請求項8に記載のように、負頂点を共有する3面が選択されてもよい。
【0019】
なぜなら、光線がバウンディングボックスと交差する時、光線は必ず2面を通過するため、その通過する2面のうちの片方を確認できれば光線とバウンディングボックスとは交差すると言えるからである。したがって上記のようにすることによって、面交差判定において光線と交差するか否かを判定する面が減少し、制御手段が実行する計算量が減る。その結果、画像生成装置によって画像が生成されるまでの時間が短縮される。尚、上記のように3面を選択しなかった場合は、少なくとも5面と面交差判定を行わないと、光線とバウンディングボックスとが交差しないことを判定できない場合があるため、このようにすることによって画像を生成する時間が大きく短縮することができる。
【0020】
一方、請求項9に記載の画像生成装置のように、制御手段が、面交差判定(3次元物体を含む直方体からなるバウンディングボックスを構成する6面の何れかの面と光線とが交差するか否かの判定)を実行して光線と交差すると判定された面を持つバウンディングボックスを選択し、そのバウンディングボックスに含まれる3次元物体に対してのみ光線との交点を求める交点計算を実行する。そして、
制御手段は、面交差判定において正頂点を共有する3面を選択して判定する。尚、ここで言う正頂点とは、光線を含む直線に関して、視点から見て光線のベクトル方向の無限遠を正無限とした場合、バウンディングボックスの各頂点から直線上に垂線を下ろした場合の交点位置が最も正無限方向に位置する頂点である。
【0021】
前述した理由により、面交差判定で光線と交差するか否かを判定する面を減らすことができるので、制御手段が実行する計算量が減少し、画像生成装置によって画像が生成されるまでの時間が短縮される。
また、請求項10に記載のように、請求項9に記載の画像生成装置に、更に不交差判定手段を備え、制御手段は、まず不交差判定手段に不交差判定を実行させ、その判定によって視点が不交差領域に含まれないと判定された場合のみ面交差判定を実行してバウンディングボックスと視点とが交差するか否かを判定し、不交差判定によって視点が不交差領域に含まれると判定された場合は面交差判定を実行せずにバウンディングボックスと光線とは交差しないと判定するようにしてもよい。
【0022】
このようにすることによって、制御手段は面交差判定を実行せずにバウンディングボックスと光線とが交差しないことを判定できる場合が生まれる。従って、不交差判定に比べ計算コストが大きい面交差判定を制御手段が実行する回数を減少させることができ、画像生成装置によって画像が生成されるまでの時間が短縮される。
【0023】
また、請求項11に記載のように、請求項1から請求項10の何れかに記載の画像生成装置において、制御手段は面交差判定を実行する際に対象の面を含む無限平面との交点を求め、その交点が次に示す非交差部分平面に存在するか否かを判定する。非交差部分平面とは、バウンディングボックスの対象面において正頂点又は負頂点と対角に位置する頂点を含む2辺について、その頂点と反対側一端を延長し、対象面を含む無限平面を二つの部分平面に分け、二つの部分平面のうち対象の面を含まない方の部分平面のことである(図11参照)。
【0024】
そして、制御手段は、非交差部分平面に交点が存在すると判定すると、当該バウンディングボックスに対して以降の面交差判定を実行せずに、当該バウンディングボックスと光線とは交差しないと判定する。
なぜなら、非交差部分平面に交点が存在する場合は、光線とバウンディングボックスとが交差することはないからである。したがって、上記のようにすれば、面交差判定を行う面を減らすことができて計算量を減少させることができる。よって、画像生成装置によって画像が生成されるまでの時間が短縮される。
【0025】
また、制御手段が実行する面交差判定において、対象の面を含む平面と光線との交点座標を求め、その交点座標が対象の面上に存在するか否かを判定するようにしてもよいが、面交差判定では光線と対象の面とが交差するか否かがわかればよく、交点座標を正確に求める必要はない、
このため、請求項12に記載のように、請求項1から請求項10の何れかに記載の画像生成装置において、制御手段は、バウンディングボックスの各辺が座標軸と平行になるようにバウンディングボックスを設定し、面交差判定を以下に示すように判定するとよい。
【0026】
(1)対象面を含む平面がyz平面に平行である場合
対象面の各要素及び交点座標に、前記光線の方向ベクトルのx成分を乗じて判定。
(2)対象面を含む平面がxz平面に平行である場合
対象面の各要素及び交点座標に、前記光線の方向ベクトルのy成分を乗じて判定。
【0027】
(3)対象面を含む平面がxy平面に平行である場合
対象面の各要素及び交点座標に、前記光線の方向ベクトルのz成分を乗じて判定。
このようにすることにより、除算を行うことなく面交差判定を実行することができる。一般的にコンピュータを用いて計算を実行する場合、除算は他の四則演算に比べ、計算に時間がかかる。そのため、上述したようにすることによって除算を実行することを避けることができ、画像が生成されるまでの時間が短縮された画像生成装置を提供できる。尚、各成分を乗じる場合、その成分の定数倍であっても同様の作用及び効果が得られる。
【0028】
また、請求項13に記載の画像生成装置のように、従来の画像生成装置に上記の計算方法を適用させてもよい。
その場合も、同様の作用及び効果を得ることができる。
また、請求項14に記載の画像生成装置は、これまでと同様、制御手段が面交差判定を実行して光線と交差すると判定された面を持つバウンディングボックスを選択し、そのバウンディングボックスに含まれる3次元物体に対してのみ光線との交点を求める交点計算を実行する。また、制御手段の指令により次のような不交差判定を行う不交差判定手段を備える。それは、制御手段から指定される1面を除く5面をそれぞれ含む5つの無限平面について、各無限平面によって2つに分けられる領域のうちその無限平面自体を含まず且つバウンディングボックス側でない領域の和集合を不交差領域とし、その不交差領域に視点が含まれるか否かを判定する判定である。
【0029】
そして、制御手段は、バウンディングボックスの各辺が座標軸と平行になるようにバウンディングボックスを設定し、光線の方向ベクトルの成分のうち何れか2つの成分がゼロである場合に限り、負無限方向に最も位置する1面を指定して不交差判定手段に不交差判定を実行させる。その結果、視点が不交差領域に含まれると判定された場合はバウンディングボックスと光線とは交差しないと判定し、視点が不交差領域に含まれないと判定された場合はバウンディングボックスと光線とは交差すると判定する(図13参照)。尚、光線を含む直線に関して、視点から見て光線のベクトル方向と反対方向の無限遠を負無限とする。
【0030】
このようにすれば、光線の方向ベクトルの成分のうち何れか2つの成分がゼロである場合、制御手段が面交差判定を実行することなく、簡易な方法で光線とバウンディングボックスとが交差するか否かが判定できる。従って、計算量を減少させることができ、画像生成装置によって画像が生成されるまでの時間が短縮される。
【0031】
また、請求項1から請求項14の何れかに記載の画像生成装を構成する各手段は、ハードウェア上で実現されてもよいが、請求項15に示すように、コンピュータで機能させるためのプログラムとして実現させてもよい。
このようにプログラムで実現させれば、磁気ディスク、光磁気ディスク、メモリカード等のコンピュータが読み取り可能な記録媒体に記録し、必要に応じてコンピュータにロードして起動することにより用いることができる。また、ネットワークを介してロードして起動することにより用いることもできる。
【0032】
【発明の実施の形態】
以下、本発明の実施形態を図面と共に説明する。
[第1実施形態]
まず、これから使用する3次元モデルについて図1を用いて説明する。符号2で示される外側の立方体は3次元空間を表し、その中に置かれた符号4で示される直方体はバウンディングボックスを表す。そして、符号6で表される頂点が正頂点を表し、符号8で表される頂点が負頂点を表す。尚、符号4で示されるバウンディングボックス内部には図示しない物体要素が含まれる。
【0033】
また、符号10で表される点が視点を表し、符号12で表される矢印が光線を表す。そして、符号14で表される矢印が光線の方向ベクトルを表す。
尚、バウンディングボックス4、視点10及び方向ベクトル14を各々下記のように設定する。
【0034】
【数1】

Figure 0003931691
次に図2のブロック図を用いて画像生成装置22の構成を説明する。画像生成装置22は主に、CPU24と、ROM26と、RAM28と、VRAM(ビデオRAM)30と、IF(インタフェース)32とを備え、これらはバス34で相互に接続されている。
【0035】
CPU24(制御手段、内包判定手段、不交差判定手段として機能する)は各種演算や制御を司り、ROM26には光線追跡法によって2次元画像を生成するためのプログラムが格納され、RAM28はプログラムを実行するための一時領域として利用され、VRAM30には生成結果の2次元画像が格納される。また、VRAM30に格納された2次元画像は、IF32より接続ケーブル38を介して表示装置36に伝達され、表示装置36で画像として表示される。
【0036】
そして、図示しない操作部を利用者が操作すると、CPU24はROM26からプログラムを読み込み、画像生成処理を開始する。
図3は画像生成処理を表すフローチャートである。本処理が開始されると、まずS100で光線12を設定する。これは、視点10を起点とし、2次元画像が投影されると仮定するスクリーン上の一点(ピクセル)を通って更に延びる半直線を設定することである。尚、本ステップでは毎回異なるスクリーン上のピクセルを選択し、全てのピクセルを選択し終えた場合は、光線の設定は行わない。
【0037】
続いてS110では、S100において光線12の設定が行われたか否かによって分岐する。光線12の設定が行われた場合はS120に進み、光線12の設定が行われなかった場合は画像生成処理を終了する。
S120では、交差判定対象の設定及び選択を行う。これは、バウンディングボックス4を設定したり、その設定したバウンディングボックス4もしくは直接物体要素を選択することである。尚、バウンディングボックス4は各辺がxyz直行座標系における各座標軸に対して平行になるように設定する。
【0038】
続いてS130で交差判定対象が存在するか否かを判定する。交差判定対象が存在する場合はS140に進み、交差判定対象が存在しない場合(例えばこの時点で全てのバウンディングボックス4との交差判定を終了してしまった場合等)は、S100に戻って光線12の設定を行う。
【0039】
S140では、交差判定の対象がバウンディングボックス4か否かを判定する。交差判定の対象がバウンディングボックス4である場合はS150に進み、交差判定の対象がバウンディングボックス4でない場合、すなわち物体要素である場合はS180に進む。
【0040】
S150では、後述するバウンディングボックス交差判定処理を実行する。続くS160では、S150の結果に基づいて光線12とバウンディングボックス4とが交差するか否かによって分岐する。光線12とバウンディングボックス4とが交差しない場合はS170に進み、光線12とバウンディングボックス4とが交差する場合はS120に戻る。
【0041】
S170では、当該バウンディングボックス4を交差判定対象から除外する。そしてS120に戻る。
一方、S180では、光線12と物体要素とが交差するか否かの判定を行う。その結果に応じてS190で分岐し、交差する場合はS200に進み、交差しない場合はS100に戻る。
【0042】
S200では、光線12と物体要素との交点を求め、その交点における光の状態を算出する。そして、射影されるスクリーン上のピクセルを設定しVRAM30に画像データを書き込む。書き込が終了するとS100に戻る。尚、VRAM30に書き込まれた画像データは、IF32及び接続ケーブル38を介して逐一表示装置36に送られる。
【0043】
ここで、S150のバウンディングボックス交差判定処理について詳しく説明する。図4はバウンディングボックス交差判定処理を表すフローチャートである。本処理もCPU24で起動され実行される。
まず、S300で不交差判定を行う。これは、図5(1)、(2)、(3)に各々示すAx領域、Ay領域、Az領域の和集合である不交差領域A(図5(4))に視点10が含まれるか否かを判定する。尚、Ax領域は、x=Xmax平面によって分けられる領域のうち、バウンディングボックス4側ではない領域(x=Xmax平面を含まず)である。また、Ay領域は、y=Ymax平面によって分けられる領域のうち、バウンディングボックス4側ではない領域(y=Ymax平面を含まず)である。また、Az領域は、z=Zmin平面によって分けられる領域のうち、バウンディングボックス4側の領域(z=Zmin平面を含まず)である。
【0044】
続いて、図2のS310ではS300の結果に応じて分岐する。不交差領域Aに視点10が存在する場合は、バウンディングボックス4と光線12とは交差しないと判定して本処理を終了し、図3のS160へ移行する。一方、不交差領域Aに視点10が存在しない場合は、S320に進む。
【0045】
S320では内包判定を行う。これは、図6(1)、(2)、(3)に示すBx領域、By領域、Bz領域の積集合である領域B(図6(4))に視点10が含まれるか否かを判定する。尚、Bx領域は、x=Xmin平面によって分けられる領域のうち、バウンディングボックス4側の領域(x=Xmin平面を含む)である。また、By領域は、y=Ymin平面によって分けられる領域のうち、バウンディングボックス4側の領域(y=Ymin平面を含む)である。また、Bz領域は、z=Zmax平面によって分けられる領域のうち、バウンディングボックス4側の領域(z=Zmax平面を含む)である。
【0046】
前述の不交差判定によって、視点10は不交差領域Aに存在しない(すなわち視点は図6(5)の領域に存在する)ことがわかっているため、図6(4)に示す領域Bに視点10が含まれるか否かを判定することによって、視点10がバウンディングボックス4に内包されるか否かが判定できる(図6(6)参照)。
【0047】
図4に戻り、S330ではS320の内包判定の結果によって分岐する。バウンディングボックス4に視点10が内包されると判定された場合は、バウンディングボックス4と視点10とは交差すると判定し、画像生成処理に戻る。一方、バウンディングボックス4に視点が内包されないと判定された場合は、S340に進む。
【0048】
S340では面と光線12とが交差するか否かを判定する面交差判定を行う。今までの経過から、視点10の存在領域は不交差領域Aでない領域からバウンディングボックス4を除いた領域(図7(1)参照)であることがわかる。更にその領域は、光線12が、バウンディングボックス4の負頂点8を共有する3面のうちいくつの面と交差する可能性があるかによって、3つのグループに分けることができる。すなわち、光線12が1つの面とのみ交差する可能性があるグループ(図7(2)参照)、光線12が2つの面と交差する可能性があるグループ(図7(3)参照)、光線12が3つの面と交差する可能性があるグループ(図7(4)参照)の3つのグループに分けられる。また、この3つのグループのうち何れに視点10が存在するかは、S320の内包判定を実施した時点で判明している。このため、視点10がどのグループに属するかに応じて、必要最低限の面とのみ面交差判定を実施する。
【0049】
続いて、S350ではS340の結果に応じて分岐する。面と光線12とが交差する場合はバウンディングボックス4と光線12とは交差することになり、面と光線12とが交差しない場合はバウンディングボックス4と光線12とは交差しないことになる。そして、共にそれぞれの判定結果を保持しつつ画像生成処理に戻る。
【0050】
尚、S340における面交差判定は以下に示す方法で行う。
例えば対象面がyz平面に平行な面のうちX成分が大きい面(図8において符号40で示す面)であった場合、交点は下記の式1で表される。
【0051】
【数2】
Figure 0003931691
対象面に存在するか否かを判定する判定式は下記の式2で表される。
【0052】
【数3】
Figure 0003931691
ここで、対象面の各要素及び交点座標に、光線を表すベクトルのX成分を乗じると下記の式3又は式4になる。
【0053】
【数4】
Figure 0003931691
光線12を表すベクトルのX成分が正の場合は式3のようになり、負の場合は式4のようになる。式3又は式4を用いて面交差判定を行うことにより、式2を用いた場合に比べ乗算回数は増加するが除算はなくなる。尚、図9に乗算及び除算の実行時間を比較した実験結果を示す。実験の概要は、コンピューター上で乱数を発生させてその中から任意の2つの数字を選択し、乗算(0回〜32回)を行う処理を1000万回実行。この処理のうち、乗算にかかった時間を測定した。また、同様の処理を乗算の替わりに除算についても行った。
【0054】
この実験によると、除算の実行時間は乗算の実行時間のおよそ18倍かかる。したがって、式3を用いて面交差判定を行えば、面交差判定の実行時間は減少すると言える。
このように、バウンディングボックス交差判定処理において、面交差判定に比べ少ない計算量である不交差判定及び内包判定を行うことによってバウンディングボックス4と光線12とが交差するか否かが判別できる場合ができる。また、これら不交差判定及び内包判定によってバウンディングボックス4と光線12とが交差するか否かが判別できない場合でも、最小限の面に対してのみ交差判定をおこなうことによって、バウンディングボックス4と光線12とが交差するか否かが確定できる。
【0055】
したがって、本画像生成装置2によればバウンディングボックス4と光線12とが交差するか否かが少ない計算量で判別でき、画像生成処理にかかる時間を短縮できる。
[第2実施形態]
第2実施形態の画像生成装置は、第1実施形態のバウンディングボックス交差判定処理とは別の方法のバウンディングボックス交差判定処理を行う。尚、装置の構成及びその他の処理は第1実施形態と同様であるため説明を省略する。
【0056】
図10は、第2実施形態のバウンディングボックス交差判定処理である。まずS400で不交差判定を行う。この不交差判定は、第1実施形態における不交差判定(図4のS300)と同様である。続いて、S410においてS400の結果に応じて分岐する。不交差領域に視点10が存在する場合は、バウンディングボックス4と視点10とは交差しないと判定し、画像生成処理に戻る。一方、不交差領域に視点10が存在しない場合は、S420に進む。
【0057】
S420では、バウンディングボックス4の面と光線12とが交差するか否かを判定する面交差判定を行う。この面交差判定は正頂点6を共有する3面に対して行う。その際、対象面において正頂点6と対角に位置する頂点を含む2辺についてその頂点と反対側一端を延長し、対象面を含む平面を2つの部分平面に分ける。そして、2つの部分平面のうち対象面を含まない方の部分平面を非交差部分平面42(図11参照)とする。光線12と対象面を含む平面との交点が、非交差部分平面42に存在する場合は、以降の面交差判定を実行せずにバウンディングボックス4と光線12とは交差しないと判定する。
【0058】
続いて、S430ではS420の結果に応じて分岐する。面と光線12とが交差する場合はバウンディングボックス4と光線12とは交差することになり、面と光線12とが交差しない場合はバウンディングボックス4と光線12とは交差しないことになる。そして、共にそれぞれの判定結果を保持しつつ画像生成処理に戻る。
【0059】
このように、バウンディングボックス交差判定処理において、面交差判定に比べ少ない計算量である不交差判定によってバウンディングボックス4と光線12とが交差するか否かが判別できる場合ができる。また、これら不交差判定によってバウンディングボックス4と光線12とが交差するか否かが判別できない場合でも、6面全ての面について面交差判定を行わずに3面について行うだけでよい。そして更に、その3面との面交差判定を実行する途中においても、光線12と該当面を含む平面との交点を求め、その交点の存在場所によって後の面交差判定を省略できる場合がある。
【0060】
したがって、本画像生成装置2によればバウンディングボックス4と光線12とが交差するか否かが少ない計算量で判別でき、画像生成処理にかかる時間を短縮できる。
[第3実施形態]
第3実施形態の画像生成装置は、第1実施形態及び第2実施形態のバウンディングボックス交差判定処理とは別の方法のバウンディングボックス交差判定処理を実行する。尚、装置の構成及びその他の処理は第1実施形態及び第2実施形態と同様であるため説明を省略する。
【0061】
図12は、第3実施形態のバウンディングボックス交差判定処理である。まずS500で方向ベクトル14の成分のうちの何れか2成分がゼロであるか否かを判定する。何れか2成分が0であった場合はS510に進み、そうでなかった場合はS530に進む。
【0062】
S510では不交差判定を実行する。バウンディングボックス4を構成する面のうち負無限方向に最も位置する1面を選択する。そして、選択した1面を除く5面をそれぞれ含む5つの平面について、各平面によって2つに分けられる領域のうちその平面自体を含まず且つバウンディングボックス4側でない領域の和集合を不交差領域C(図13参照)とし、視点10がその不交差領域Cに含まれるか否かを判定する。
【0063】
続いて、S520ではS510の結果に応じて分岐する。視点10が不交差領域Cに存在する場合はバウンディングボックス4と光線12とは交差しないと判定し、視点10が不交差領域Cに存在しない場合はバウンディングボックス4と光線12とは交差すると判定する。そして、共にそれぞれの判定結果を保持しつつ画像生成処理に戻る。
【0064】
一方S530では面交差判定を実行する。これは、バウンディングボックス4の各面と光線12とが交差するか否かを判定する。そして、S540でS530の結果に応じて分岐する。光線12がバウンディングボックス4の何れかの面と交点を持つ場合はバウンディングボックス4と光線12とは交差するという判定結果を保持して画像生成処理に戻る。一方、光線12がバウンディングボックス4の何れの面とも交点を持たない場合はバウンディングボックス4と光線12とは交差しないという判定結果を保持して画像生成処理に戻る。
【0065】
このように、方向ベクトル14の成分のうちの何れか2成分がゼロである場合、バウンディングボックス4と光線12とが交差するか否かの判定が不交差判定を実行するだけで判定できる。したがって、本画像生成装置2によれば、画像生成処理にかかる時間を短縮できる。
【0066】
以上、本実施形態を説明したが、本発明は上記の実施形態に限定されるものではなく種々の態様を取ることができる。例えば第3実施形態において、座標軸の何れか1軸が方向ベクトル14と平行になるように座標系を設定してもよい。このようにすれば、常に方向ベクトル14の成分のうちの何れか2成分がゼロになり、常に不交差判定が実行できる。
【0067】
また、第1実施形態においてバウンディングボックス交差判定処理は、不交差判定・内包判定・面交差判定の順に行ったが、内包判定・不交差判定・面交差判定の順に行うことも可能である。更に、内包判定と面交差判定のみを行うようにすることも可能である。このようにしても、従来の画像生成装置より画像生成処理にかかる時間を短縮できる。
【0068】
また、バウンディングボックス4が所定の大きさより大きい場合だけ内包判定を実行するようにしてもよい。この所定の大きさについては、視点10がバウンディングボックス4に内包される確率(バウンディングボックス4が占める領域の体積を視点10が存在する可能性のある領域の体積で割ったもの)と、面交差判定及び内包判定の計算量とを算出し、最も効率的な内包判定の実行可否が判断できるように画像生成処理中に定める方法が考えられる。
【図面の簡単な説明】
【図1】 バウンディングボックスを用いた光線追跡法の3次元モデルの説明図である。
【図2】 画像生成装置のブロック図である。
【図3】 第1実施形態の画像生成処理を表すフローチャートである。
【図4】 第1実施形態のバウンディングボックス交差判定処理を表すフローチャートである。
【図5】 第1実施形態の不交差判定を説明するための3次元モデルである。
【図6】 第1実施形態の内包判定を説明するための3次元モデルである。
【図7】 第1実施形態の面交差判定を説明するための3次元モデルである。
【図8】 第1実施形態の面交差判定一例を説明するための3次元モデルである。
【図9】 乗算と除算の実行時間を比較した実験の概要及び結果である。
【図10】 第2実施形態のバウンディングボックス交差判定処理を表すフローチャートである。
【図11】 第2実施形態の面交差判定を説明するための3次元モデルである。
【図12】 第3実施形態のバウンディングボックス交差判定処理を表すフローチャートである。
【図13】 第3実施形態の不交差判定を説明するための3次元モデルである。
【符号の説明】
2…3次元空間、4…バウンディングボックス、6…正頂点、8…負頂点、10…視点、12…光線、14…方向ベクトル、22…画像生成装置、24…CPU、26…ROM、28…RAM、30…VRAM、32…IF、34…バス、36…表示装置、38…接続ケーブル。[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an image generation apparatus using a ray tracing method.
[0002]
[Prior art]
In the ray tracing method, an image is traced from the viewpoint in the direction of an object, and if the ray intersects with the object, the light state of the object at the intersection is obtained and projected onto an image plane (screen) to obtain a two-dimensional image. Is a method for generating Although it is necessary to obtain the intersection between the ray and the object, it takes a very long time to calculate the intersection. Therefore, various speed-up methods have been devised, and one of them is a method using a bounding volume.
[0003]
The bounding volume includes one or more objects, and has a shape of a sphere or a rectangular parallelepiped (this case is particularly referred to as a “bounding box”). Before determining the intersection of a ray and an object, determine whether the bounding volume containing the object and the ray intersect, and obtain the intersection of the ray and the object only when the bounding volume and the ray intersect , Reducing unnecessary intersection calculation.
[0004]
[Problems to be solved by the invention]
However, even if such a method is used, the calculation amount is still very large, and it takes a long time to obtain an image. Therefore, an object of the present invention is to provide an image generation apparatus and program capable of reducing the amount of calculation and shortening the time to obtain a two-dimensional image, particularly when a bounding box which is one of the bounding volumes is used.
[0005]
[Means for Solving the Problems and Effects of the Invention]
The image generation apparatus according to claim 1, wherein the control unit is configured to perform a plane intersection determination (any one of six surfaces constituting a bounding box made of a rectangular parallelepiped including a three-dimensional object). The bounding box having a surface determined to intersect with the ray is selected, and the intersection with the ray is obtained only for the three-dimensional object included in the bounding box. Perform intersection calculation. Further, the inclusion determination unit executes the inclusion determination (determination as to whether or not the viewpoint is included in the bounding box) according to a command from the control unit. Then, the control means first causes the inclusion determination means to execute the inclusion determination, and if it is determined by the inclusion determination that the viewpoint is included in the bounding box, the bounding box and the ray intersect without performing the plane intersection determination. Then, when it is determined that the viewpoint is not included by the inclusion determination, the plane intersection determination is executed to determine whether the bounding box and the viewpoint intersect.
[0006]
As described above, by including the inclusion determination unit, the control unit can determine that the bounding box and the ray intersect without performing the plane intersection determination. Therefore, it is possible to reduce the number of times the control means executes the surface intersection determination, which has a higher calculation cost than the inclusion determination, and the time until the image is generated by the image generation apparatus is shortened.
[0007]
The control means may always cause the inclusion determination means to execute the inclusion determination, but generally, the smaller the bounding box, the lower the probability that the viewpoint is included in the bounding box. For this reason, an effect commensurate with the calculation amount for performing the inclusion determination cannot be obtained unless the bounding box has a certain size. Therefore, as described in claim 2, the control means determines whether or not the target bounding box is larger than a predetermined size prior to causing the inclusion determination means to execute the inclusion determination. The inclusion determination unit may execute the inclusion determination, and if it is determined that the value is small, the surface intersection determination may be performed without causing the inclusion determination unit to execute the inclusion determination.
[0008]
In this case, the inclusion determination is performed only when the calculation amount is likely to be reduced by the inclusion determination, and the inclusion determination is not performed when the possibility of the calculation amount being reduced by the inclusion determination is low. . Therefore, the calculation amount is further reduced.
The predetermined size mentioned here can be determined, for example, by experiment in consideration of the probability that the viewpoint is included in the bounding box and the amount of calculation of the plane intersection determination and the inclusion determination.
[0009]
On the other hand, the image generating apparatus according to claim 3 is the same as in claim 1 and claim 2, wherein the control means performs a surface intersection determination to select a bounding box having a surface determined to intersect with a light beam, The intersection calculation for obtaining the intersection with the light ray is executed only for the three-dimensional object included in the bounding box. Further, the non-crossing determination means performs the following non-crossing determination according to a command from the control means. That is, for three infinite planes each including three faces sharing the positive vertex among the vertices of the target bounding box, the infinite plane itself is not included in the area divided into two by each infinite plane and the bounding An area represented by a union of areas that are not on the box side is defined as a non-crossing area (see FIG. 5 (4)), and it is determined whether the viewpoint is included in the non-crossing area. In addition, regarding the straight line including the ray, when the infinity in the vector direction of the ray is set to positive infinity and the infinity in the opposite direction is set to negative infinity when viewed from the viewpoint, the vertical line is dropped from each vertex of the bounding box. The vertex whose intersection point is located in the most positive infinity direction is defined as the positive vertex, and the vertex located in the most negative infinity direction is defined as the negative vertex.
[0010]
Then, the control unit first causes the non-crossing determination unit to execute the non-crossing determination, and performs the surface crossing determination only when it is determined that the viewpoint is not included in the non-crossing region. It is determined whether or not to intersect, and if it is determined by the non-intersection determination that the viewpoint is included in the non-intersection area, it is determined that the bounding box and the ray do not intersect without executing the surface intersection determination.
[0011]
As described above, by providing the non-intersection determining unit, the control unit can determine that the bounding box and the ray do not intersect without executing the plane crossing determination. Therefore, it is possible to reduce the number of times the control means executes the plane intersection determination, which has a higher calculation cost than the non-intersection determination, and the time until the image is generated by the image generation apparatus is shortened.
[0012]
The procedure for setting the positive vertex and the negative vertex is not limited to the above-described procedure, and any procedure may be used as long as it points to substantially the same vertex as the vertex set by the above-described procedure. Also good.
In addition to the non-crossing determination unit, an inclusion determination unit may be provided as in the image generation apparatus according to the fourth aspect. In that case, the control means first causes the inclusion determination means to execute the inclusion determination, and if the determination determines that the viewpoint is included in the bounding box, the bounding box and the ray intersect without performing another determination. Judge that. On the other hand, if it is determined by the inclusion determination that the viewpoint is not included in the bounding box, the non-crossing determination means is made to execute the non-crossing determination. If it is determined by the non-crossing determination that the viewpoint is included in the non-crossing determination area, it is determined that the ray and the bounding box do not cross each other, and the non-crossing determination determines that the viewpoint is not included in the non-crossing area. If it does, the intersection determination is executed to determine whether or not the bounding box and the viewpoint intersect.
[0013]
In this way, it is possible to further reduce the number of times the control means executes the surface intersection determination, which has a higher calculation cost than the inclusion determination and the non-intersection determination, and shorten the time until the image is generated by the image generation device. Is done.
Note that the order in which the non-intersection determination and the inclusion determination are executed may be reversed. That is, as in the image generating apparatus according to claim 5, the control unit first causes the non-crossing determination unit to execute the non-crossing determination, and if the determination determines that the viewpoint is included in the non-crossing region, the control unit And the bounding box are determined not to intersect. On the other hand, when it is determined by the non-crossing determination that the viewpoint is not included in the non-crossing region, the internal determination is performed by the internal determination unit. If it is determined by the inclusion determination that the viewpoint is included in the bounding box, it is determined that the bounding box and the ray intersect without performing the plane intersection determination, and the viewpoint is not included in the bounding box by the inclusion determination. If it is determined, it may be determined whether or not the bounding box and the viewpoint intersect by executing a plane intersection determination.
[0014]
Even if it does in this way, the effect | action and effect similar to the image generation apparatus of Claim 4 are acquired.
The inclusion determination performed by the inclusion determination unit in the image generation apparatus according to the fifth aspect may be as described in the sixth aspect. That is, for three infinite planes each including three surfaces sharing a negative vertex, the region on the bounding box side among the two regions divided by each infinite plane is set as the target region, and the product set of the three target regions is If the viewpoint is included in the represented area (see FIG. 6 (4)), it is determined that the viewpoint is included in the bounding box, and the viewpoint is included in the area represented by the product set of the three target areas. If not, it is determined that the viewpoint is not included in the bounding box.
[0015]
The reason why such a determination may be made is that it is ensured that there is no viewpoint in the non-intersection area when the inclusion determination unit executes the inclusion determination. Therefore, in the above-described inclusion determination, the determination is made on the assumption that no viewpoint exists in the non-intersection area. As a result, the time until an image is generated by the image generation apparatus is shortened.
[0016]
Furthermore, as described in claim 7, in the image generating apparatus according to claim 6, the control unit selects a target region that does not include a viewpoint from the three target regions used by the inclusion determination unit in the inclusion determination. Then, the plane crossing determination may be executed only for the bounding box planes included in the infinite plane dividing the target area (see FIGS. 6A to 6 and FIG. 7).
[0017]
This is because the region where the viewpoint can exist is estimated by the non-intersection determination and the inclusion determination already performed at the stage where the control means performs the surface intersection determination. Therefore, it is only necessary to perform the plane crossing determination for the bounding box plane that may cross the light ray in the region.
[0018]
For this reason, the number of faces on which the plane intersection determination is performed can be reduced, the amount of calculation is reduced, and the time until the image is generated by the image generation apparatus is shortened.
In addition, in the image generating apparatus according to any one of claims 1 and 4 to 6, the surface on which the control unit determines whether or not to intersect with the light beam in the surface crossing determination is defined in claim 8. As described, three faces sharing a negative vertex may be selected.
[0019]
This is because when a light ray intersects with the bounding box, the light ray always passes through two surfaces, and therefore it can be said that the light ray and the bounding box intersect if one of the two passing surfaces can be confirmed. Therefore, by doing as described above, the number of planes for determining whether or not to intersect with light rays in the plane intersection determination is reduced, and the amount of calculation executed by the control means is reduced. As a result, the time until an image is generated by the image generation apparatus is shortened. Note that if you do not select three surfaces as described above, you may not be able to determine that the ray does not intersect the bounding box unless you do at least five surface intersection determinations. Thus, the time for generating an image can be greatly shortened.
[0020]
On the other hand, as in the image generating apparatus according to claim 9, the control means determines whether the light ray intersects with any of the six surfaces constituting the bounding box composed of a rectangular parallelepiped including a three-dimensional object. A bounding box having a surface determined to intersect with the ray is selected by executing (determination of whether or not), and intersection calculation for obtaining an intersection with the ray only for the three-dimensional object included in the bounding box is executed. And
The control means selects and determines three surfaces that share the positive vertex in the surface intersection determination. The positive vertex here refers to the intersection of a straight line including a ray when the infinity in the vector direction of the ray is set to positive infinity when viewed from the viewpoint, and a perpendicular line is dropped from each vertex of the bounding box on the straight line. The vertex is located in the most positive or infinite direction.
[0021]
For the reasons described above, the number of planes for determining whether or not to intersect with a ray can be reduced in the plane crossing determination, so that the amount of calculation executed by the control means is reduced and the time until an image is generated by the image generation apparatus Is shortened.
Further, as described in claim 10, the image generation apparatus according to claim 9 further includes a non-crossing determination unit, and the control unit first causes the non-crossing determination unit to execute a non-crossing determination, and by the determination Only when it is determined that the viewpoint is not included in the non-crossing area, the plane crossing determination is performed to determine whether the bounding box and the viewpoint intersect, and if the viewpoint is included in the non-crossing area by the non-crossing determination When it is determined, it may be determined that the bounding box and the light beam do not intersect without executing the plane intersection determination.
[0022]
By doing so, there arises a case where the control means can determine that the bounding box and the light beam do not intersect without executing the surface intersection determination. Therefore, it is possible to reduce the number of times the control means executes the plane intersection determination, which has a higher calculation cost than the non-intersection determination, and the time until the image is generated by the image generation apparatus is shortened.
[0023]
In addition, as described in claim 11, in the image generating apparatus according to any one of claims 1 to 10, the control unit intersects with an infinite plane including a target surface when executing the surface intersection determination. And whether or not the intersection exists in the following non-intersecting partial plane is determined. Non-intersecting partial planes are two sides including vertices that are diagonally opposite to the positive or negative vertices on the target plane of the bounding box. It is a partial plane that is divided into partial planes and that does not include the target surface of the two partial planes (see FIG. 11).
[0024]
When the control means determines that there is an intersection on the non-intersecting partial plane, the control means determines that the bounding box and the ray do not intersect without performing subsequent surface intersection determination on the bounding box.
This is because when the intersection exists in the non-intersecting partial plane, the ray does not intersect with the bounding box. Therefore, if it carries out as mentioned above, the surface which performs a surface intersection determination can be reduced and the amount of calculations can be reduced. Therefore, the time until the image is generated by the image generation device is shortened.
[0025]
In the plane intersection determination performed by the control means, the intersection coordinates between the plane including the target surface and the light beam may be obtained, and it may be determined whether or not the intersection coordinates exist on the target surface. In the plane intersection determination, it is only necessary to know whether or not the ray intersects the target plane, and it is not necessary to accurately determine the intersection coordinates.
For this reason, as described in claim 12, in the image generating apparatus according to any one of claims 1 to 10, the control means sets the bounding box so that each side of the bounding box is parallel to the coordinate axis. It is better to set and determine the intersection determination as shown below.
[0026]
(1) When the plane including the target surface is parallel to the yz plane
Judgment is made by multiplying each element and intersection coordinates of the target surface by the x component of the direction vector of the light ray.
(2) When the plane including the target surface is parallel to the xz plane
Judgment is made by multiplying each element and intersection coordinates of the target surface by the y component of the direction vector of the light ray.
[0027]
(3) When the plane including the target surface is parallel to the xy plane
Judgment is made by multiplying each element and intersection coordinates of the target surface by the z component of the direction vector of the light ray.
By doing in this way, plane crossing determination can be performed without performing division. In general, when calculation is performed using a computer, division takes time compared to other four arithmetic operations. Therefore, it is possible to avoid performing the division by doing as described above, and it is possible to provide an image generation apparatus that shortens the time until an image is generated. In addition, when each component is multiplied, even if it is a constant multiple of that component, the same operation and effect can be obtained.
[0028]
Further, the calculation method may be applied to a conventional image generation apparatus as in the image generation apparatus according to claim 13.
In that case, the same operation and effect can be obtained.
Further, in the image generation apparatus according to claim 14, as in the past, the control unit executes a surface intersection determination to select a bounding box having a surface determined to intersect with the light ray, and is included in the bounding box. The intersection calculation for obtaining the intersection with the light ray is executed only for the three-dimensional object. Moreover, the non-crossing determination means which performs the following non-crossing determination by the instruction | indication of a control means is provided. It is the sum of the regions that do not include the infinite plane itself and that are not on the bounding box side among the five infinite planes including each of the five surfaces except for one specified by the control means. This is a determination for determining whether or not a set includes a non-crossing area and a viewpoint is included in the non-crossing area.
[0029]
Then, the control means sets the bounding box so that each side of the bounding box is parallel to the coordinate axis, and in the negative infinite direction only when any two of the components of the light direction vector are zero. Designate the non-crossing determination means by designating the most positioned surface and the non-crossing determination means. As a result, when it is determined that the viewpoint is included in the non-intersection area, it is determined that the bounding box and the ray do not intersect, and when it is determined that the viewpoint is not included in the non-intersection area, the bounding box and the ray are determined. It is determined that they intersect (see FIG. 13). In addition, regarding a straight line including a light ray, infinity in the direction opposite to the vector direction of the light ray as viewed from the viewpoint is defined as negative infinity.
[0030]
In this way, if any two of the ray direction vector components are zero, whether the ray intersects the bounding box in a simple manner without the control means performing the plane crossing determination. It can be determined whether or not. Therefore, the amount of calculation can be reduced, and the time until an image is generated by the image generation apparatus is shortened.
[0031]
In addition, each unit constituting the image generation device according to any one of claims 1 to 14 may be realized on hardware, but as shown in claim 15, for causing a computer to function. It may be realized as a program.
When realized by such a program, it can be used by recording on a computer-readable recording medium such as a magnetic disk, a magneto-optical disk, a memory card, etc., and loading and starting the computer as necessary. It can also be used by loading and starting up via a network.
[0032]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
[First Embodiment]
First, a three-dimensional model to be used will be described with reference to FIG. An outer cube indicated by reference numeral 2 represents a three-dimensional space, and a rectangular parallelepiped indicated by reference numeral 4 placed therein represents a bounding box. A vertex represented by reference numeral 6 represents a positive vertex, and a vertex represented by reference numeral 8 represents a negative vertex. Note that an object element (not shown) is included in the bounding box indicated by reference numeral 4.
[0033]
A point represented by reference numeral 10 represents a viewpoint, and an arrow represented by reference numeral 12 represents a light ray. And the arrow represented by the code | symbol 14 represents the direction vector of a light ray.
The bounding box 4, the viewpoint 10, and the direction vector 14 are set as follows.
[0034]
[Expression 1]
Figure 0003931691
Next, the configuration of the image generation device 22 will be described with reference to the block diagram of FIG. The image generation apparatus 22 mainly includes a CPU 24, a ROM 26, a RAM 28, a VRAM (video RAM) 30, and an IF (interface) 32, which are connected to each other via a bus 34.
[0035]
The CPU 24 (functioning as a control means, an inclusion determination means, and a non-intersection determination means) manages various calculations and controls. The ROM 26 stores a program for generating a two-dimensional image by the ray tracing method, and the RAM 28 executes the program. The VRAM 30 stores a two-dimensional image as a generation result. The two-dimensional image stored in the VRAM 30 is transmitted from the IF 32 to the display device 36 via the connection cable 38 and displayed as an image on the display device 36.
[0036]
When the user operates an operation unit (not shown), the CPU 24 reads a program from the ROM 26 and starts image generation processing.
FIG. 3 is a flowchart showing image generation processing. When this process is started, the light beam 12 is first set in S100. This is to set a half line that starts from the viewpoint 10 and extends further through a point (pixel) on the screen assuming that a two-dimensional image is projected. In this step, a different pixel on the screen is selected each time, and when all the pixels have been selected, no light beam is set.
[0037]
In S110, the process branches depending on whether or not the setting of the light beam 12 is performed in S100. When the setting of the light beam 12 is performed, the process proceeds to S120, and when the setting of the light beam 12 is not performed, the image generation process is ended.
In S120, the intersection determination target is set and selected. This is to set the bounding box 4 or to select the set bounding box 4 or directly the object element. The bounding box 4 is set so that each side is parallel to each coordinate axis in the xyz orthogonal coordinate system.
[0038]
Subsequently, in S130, it is determined whether or not an intersection determination target exists. If there is an intersection determination target, the process proceeds to S140, and if there is no intersection determination target (for example, if the intersection determination with all the bounding boxes 4 has been completed at this time), the process returns to S100 to return to the ray 12 Set up.
[0039]
In S140, it is determined whether or not the intersection determination target is the bounding box 4. If the intersection determination target is the bounding box 4, the process proceeds to S150, and if the intersection determination target is not the bounding box 4, that is, an object element, the process proceeds to S180.
[0040]
In S150, a bounding box intersection determination process described later is executed. In the subsequent S160, the process branches depending on whether the ray 12 and the bounding box 4 intersect based on the result of S150. If the ray 12 and the bounding box 4 do not intersect, the process proceeds to S170, and if the ray 12 and the bounding box 4 intersect, the process returns to S120.
[0041]
In S170, the bounding box 4 is excluded from the intersection determination target. Then, the process returns to S120.
On the other hand, in S180, it is determined whether or not the light beam 12 and the object element intersect. Depending on the result, the process branches at S190, and if it intersects, it proceeds to S200, and if it does not intersect, it returns to S100.
[0042]
In S200, the intersection of the light beam 12 and the object element is obtained, and the light state at the intersection is calculated. Then, the pixels on the screen to be projected are set and the image data is written into the VRAM 30. When the writing is completed, the process returns to S100. The image data written in the VRAM 30 is sent to the display device 36 one by one via the IF 32 and the connection cable 38.
[0043]
Here, the bounding box intersection determination process in S150 will be described in detail. FIG. 4 is a flowchart showing the bounding box intersection determination process. This process is also started and executed by the CPU 24.
First, non-crossing determination is performed in S300. This is because the viewpoint 10 is included in the non-intersecting region A (FIG. 5 (4)), which is the union of the Ax region, Ay region, and Az region shown in FIGS. 5 (1), (2), and (3), respectively. Determine whether or not. The Ax area is an area (not including the x = Xmax plane) that is not on the bounding box 4 side among the areas divided by the x = Xmax plane. The Ay region is a region (not including the y = Ymax plane) that is not on the bounding box 4 side among the regions divided by the y = Ymax plane. The Az region is a region on the bounding box 4 side (not including the z = Zmin plane) among the regions divided by the z = Zmin plane.
[0044]
Subsequently, in S310 of FIG. 2, the process branches according to the result of S300. If the viewpoint 10 is present in the non-intersecting area A, it is determined that the bounding box 4 and the light ray 12 do not intersect with each other, the present process is terminated, and the process proceeds to S160 in FIG. On the other hand, when the viewpoint 10 does not exist in the non-intersection area A, the process proceeds to S320.
[0045]
In S320, the inclusion determination is performed. This is whether or not the viewpoint 10 is included in the region B (FIG. 6 (4)), which is a product set of the Bx region, the By region, and the Bz region shown in FIGS. 6 (1), (2), and (3). judge. The Bx region is a region on the bounding box 4 side (including the x = Xmin plane) among regions divided by the x = Xmin plane. The By region is a region on the bounding box 4 side (including the y = Ymin plane) among regions divided by the y = Ymin plane. The Bz region is a region (including the z = Zmax plane) on the bounding box 4 side among the regions divided by the z = Zmax plane.
[0046]
Since it is known from the above-described non-crossing determination that the viewpoint 10 does not exist in the non-crossing area A (that is, the viewpoint exists in the area of FIG. 6 (5)), the viewpoint is in the area B shown in FIG. 6 (4). By determining whether or not 10 is included, it can be determined whether or not the viewpoint 10 is included in the bounding box 4 (see FIG. 6 (6)).
[0047]
Returning to FIG. 4, the process branches in S330 depending on the result of the inclusion determination in S320. When it is determined that the viewpoint 10 is included in the bounding box 4, it is determined that the bounding box 4 and the viewpoint 10 intersect, and the process returns to the image generation process. On the other hand, if it is determined that the viewpoint is not included in the bounding box 4, the process proceeds to S340.
[0048]
In S340, a surface intersection determination is performed to determine whether or not the surface and the light ray 12 intersect. From the progress so far, it can be seen that the existence region of the viewpoint 10 is a region obtained by removing the bounding box 4 from the region that is not the non-crossing region A (see FIG. 7A). Further, the region can be divided into three groups depending on how many of the three faces that the ray 12 shares the negative vertex 8 of the bounding box 4 may intersect. That is, a group in which the ray 12 may intersect only one surface (see FIG. 7 (2)), a group in which the ray 12 may intersect two surfaces (see FIG. 7 (3)), a ray 12 is divided into three groups of groups (see FIG. 7 (4)) that may intersect three faces. Further, which of the three groups has the viewpoint 10 is known when the inclusion determination in S320 is performed. For this reason, according to which group the viewpoint 10 belongs to, the plane intersection determination is performed only with the minimum necessary plane.
[0049]
Subsequently, in S350, the process branches according to the result of S340. When the surface and the light beam 12 intersect, the bounding box 4 and the light beam 12 intersect, and when the surface and the light beam 12 do not intersect, the bounding box 4 and the light beam 12 do not intersect. Then, the process returns to the image generation process while holding the respective determination results.
[0050]
In addition, the plane crossing determination in S340 is performed by the following method.
For example, when the target surface is a surface having a large X component among surfaces parallel to the yz plane (a surface indicated by reference numeral 40 in FIG. 8), the intersection point is expressed by the following formula 1.
[0051]
[Expression 2]
Figure 0003931691
A determination formula for determining whether or not the target surface exists is expressed by the following formula 2.
[0052]
[Equation 3]
Figure 0003931691
Here, when each element of the target surface and the intersection point coordinates are multiplied by the X component of the vector representing the light ray, the following Expression 3 or Expression 4 is obtained.
[0053]
[Expression 4]
Figure 0003931691
When the X component of the vector representing the light ray 12 is positive, the result is as in Expression 3, and when it is negative, as in Expression 4. By performing the surface intersection determination using Equation 3 or Equation 4, the number of multiplications is increased compared to the case where Equation 2 is used, but there is no division. FIG. 9 shows the experimental results comparing the execution times of multiplication and division. The outline of the experiment is that a random number is generated on a computer, two arbitrary numbers are selected from them, and a process of performing multiplication (0 to 32 times) is executed 10 million times. Of this process, the time taken for multiplication was measured. The same processing was performed for division instead of multiplication.
[0054]
According to this experiment, the execution time of division takes approximately 18 times the execution time of multiplication. Therefore, it can be said that if plane crossing determination is performed using Equation 3, the execution time of plane crossing determination is reduced.
As described above, in the bounding box intersection determination process, it is possible to determine whether or not the bounding box 4 and the light ray 12 intersect by performing the non-intersection determination and the inclusion determination, which have a smaller calculation amount than the plane intersection determination. . Even if it is not possible to determine whether or not the bounding box 4 and the light beam 12 intersect with each other by the non-intersection determination and the inclusion determination, by performing the intersection determination only on the minimum surface, the bounding box 4 and the light beam 12 are determined. It can be determined whether or not.
[0055]
Therefore, according to the present image generation apparatus 2, it can be determined with a small amount of calculation whether or not the bounding box 4 and the light beam 12 intersect, and the time required for the image generation processing can be shortened.
[Second Embodiment]
The image generation apparatus according to the second embodiment performs a bounding box intersection determination process using a method different from the bounding box intersection determination process according to the first embodiment. Note that the configuration of the apparatus and other processes are the same as those in the first embodiment, and thus description thereof is omitted.
[0056]
FIG. 10 is a bounding box intersection determination process according to the second embodiment. First, non-crossing determination is performed in S400. This non-crossing determination is the same as the non-crossing determination (S300 in FIG. 4) in the first embodiment. Subsequently, the process branches in S410 according to the result of S400. When the viewpoint 10 exists in the non-intersection area, it is determined that the bounding box 4 and the viewpoint 10 do not intersect, and the process returns to the image generation process. On the other hand, when the viewpoint 10 does not exist in the non-intersection area, the process proceeds to S420.
[0057]
In S420, a surface intersection determination is performed to determine whether or not the surface of the bounding box 4 and the light ray 12 intersect. This plane crossing determination is performed on three planes sharing the normal vertex 6. At this time, one end opposite to the vertex of the two sides including the vertex located diagonally to the normal vertex 6 on the target surface is extended, and the plane including the target surface is divided into two partial planes. The partial plane that does not include the target surface of the two partial planes is defined as a non-intersecting partial plane 42 (see FIG. 11). When the intersection of the light ray 12 and the plane including the target surface exists in the non-intersecting partial plane 42, it is determined that the bounding box 4 and the light ray 12 do not intersect without performing subsequent surface intersection determination.
[0058]
Subsequently, in S430, the process branches according to the result of S420. When the surface and the light beam 12 intersect, the bounding box 4 and the light beam 12 intersect, and when the surface and the light beam 12 do not intersect, the bounding box 4 and the light beam 12 do not intersect. Then, the process returns to the image generation process while holding the respective determination results.
[0059]
In this way, in the bounding box intersection determination process, it can be determined whether or not the bounding box 4 and the light beam 12 intersect by non-intersection determination, which has a smaller calculation amount than the surface intersection determination. Even if it is not possible to determine whether or not the bounding box 4 and the light beam 12 intersect by these non-intersection determinations, it is only necessary to perform the three planes without performing the plane intersection determination for all the six planes. Furthermore, even during the execution of the plane intersection determination with the three surfaces, the intersection between the light beam 12 and the plane including the corresponding surface may be obtained, and the subsequent surface intersection determination may be omitted depending on the location of the intersection.
[0060]
Therefore, according to the present image generation apparatus 2, it can be determined with a small amount of calculation whether or not the bounding box 4 and the light beam 12 intersect, and the time required for the image generation processing can be shortened.
[Third Embodiment]
The image generation apparatus according to the third embodiment executes a bounding box intersection determination process that is different from the bounding box intersection determination process according to the first embodiment and the second embodiment. Note that the configuration of the apparatus and other processes are the same as those in the first embodiment and the second embodiment, and a description thereof will be omitted.
[0061]
FIG. 12 is a bounding box intersection determination process according to the third embodiment. First, in S500, it is determined whether any two components of the direction vector 14 are zero. If any two components are 0, the process proceeds to S510, and if not, the process proceeds to S530.
[0062]
In S510, non-crossing determination is executed. Of the surfaces constituting the bounding box 4, one surface that is located most in the negative infinity direction is selected. Then, for the five planes including each of the five planes excluding the selected one plane, the union of the areas that do not include the plane itself and are not on the bounding box 4 side among the areas divided into two by each plane (See FIG. 13), and it is determined whether or not the viewpoint 10 is included in the non-crossing region C.
[0063]
Subsequently, in S520, the process branches according to the result of S510. When the viewpoint 10 exists in the non-crossing region C, it is determined that the bounding box 4 and the light ray 12 do not intersect. When the viewpoint 10 does not exist in the non-crossing region C, it is determined that the bounding box 4 and the light ray 12 intersect. . Then, the process returns to the image generation process while holding the respective determination results.
[0064]
On the other hand, in S530, plane crossing determination is executed. This determines whether each surface of the bounding box 4 and the light ray 12 intersect. In S540, the process branches according to the result of S530. If the ray 12 has an intersection with any surface of the bounding box 4, the determination result that the bounding box 4 and the ray 12 intersect is held, and the process returns to the image generation process. On the other hand, if the ray 12 has no intersection with any surface of the bounding box 4, the determination result that the bounding box 4 and the ray 12 do not intersect is held, and the process returns to the image generation process.
[0065]
As described above, when any two components of the direction vector 14 are zero, it is possible to determine whether or not the bounding box 4 and the light ray 12 intersect with each other only by executing the non-intersection determination. Therefore, according to the present image generation device 2, the time required for the image generation processing can be shortened.
[0066]
Although the present embodiment has been described above, the present invention is not limited to the above-described embodiment, and can take various forms. For example, in the third embodiment, the coordinate system may be set so that any one of the coordinate axes is parallel to the direction vector 14. In this way, any two components of the direction vector 14 are always zero, and the non-crossing determination can always be executed.
[0067]
In the first embodiment, the bounding box intersection determination process is performed in the order of non-intersection determination, inclusion determination, and plane intersection determination, but may be performed in the order of inclusion determination, non-intersection determination, and plane intersection determination. Furthermore, it is possible to perform only the inclusion determination and the surface intersection determination. Even in this case, the time required for the image generation process can be shortened compared to the conventional image generation apparatus.
[0068]
The inclusion determination may be executed only when the bounding box 4 is larger than a predetermined size. For this predetermined size, the probability that the viewpoint 10 is contained in the bounding box 4 (the volume of the area occupied by the bounding box 4 divided by the volume of the area where the viewpoint 10 may exist) and the plane intersection A method for calculating the amount of calculation for determination and inclusion determination and determining during the image generation process so that the most efficient determination of inclusion determination can be determined is conceivable.
[Brief description of the drawings]
FIG. 1 is an explanatory diagram of a three-dimensional model of a ray tracing method using a bounding box.
FIG. 2 is a block diagram of an image generation apparatus.
FIG. 3 is a flowchart illustrating image generation processing according to the first embodiment.
FIG. 4 is a flowchart showing bounding box intersection determination processing according to the first embodiment.
FIG. 5 is a three-dimensional model for explaining non-intersection determination according to the first embodiment.
FIG. 6 is a three-dimensional model for explaining inclusion determination according to the first embodiment.
FIG. 7 is a three-dimensional model for explaining plane crossing determination according to the first embodiment.
FIG. 8 is a three-dimensional model for explaining an example of plane intersection determination according to the first embodiment.
FIG. 9 is a summary and results of an experiment comparing execution times of multiplication and division.
FIG. 10 is a flowchart illustrating a bounding box intersection determination process according to the second embodiment.
FIG. 11 is a three-dimensional model for explaining plane crossing determination according to the second embodiment.
FIG. 12 is a flowchart illustrating a bounding box intersection determination process according to the third embodiment.
FIG. 13 is a three-dimensional model for explaining non-intersection determination according to the third embodiment.
[Explanation of symbols]
2 ... 3D space, 4 ... Bounding box, 6 ... Positive vertex, 8 ... Negative vertex, 10 ... Viewpoint, 12 ... Ray, 14 ... Direction vector, 22 ... Image generator, 24 ... CPU, 26 ... ROM, 28 ... RAM, 30 ... VRAM, 32 ... IF, 34 ... bus, 36 ... display device, 38 ... connection cable.

Claims (15)

視点からスクリーン上の点を通って更に延びる光線と3次元物体との交点を求め、該交点の光の状態を算出して前記スクリーン上の点の色を決定する光線追跡法を用いて3次元物体の2次元画像を生成する際に、前記3次元物体を含む直方体からなるバウンディングボックスを構成する6面の何れかの面と前記光線とが交差するか否かを判定する面交差判定を実行して、前記光線と交差すると判定された面を持つ前記バウンディングボックスを選択し、該バウンディングボックスに含まれる前記3次元物体に対してのみ前記光線との交点を求める交点計算を実行する制御手段を備える画像生成装置において、
更に、前記視点が前記バウンディングボックスに内包されるか否かを判定する内包判定を前記制御手段の指令により実行する内包判定手段を備え、
前記制御手段は、まず前記内包判定手段に前記内包判定を実行させ、該内包判定によって前記視点が前記バウンディングボックスに内包されると判定された場合は前記面交差判定を実行せずに前記バウンディングボックスと前記光線とは交差すると判定し、前記内包判定によって前記視点が内包されないと判定された場合は前記面交差判定を実行して前記バウンディングボックスと前記視点とが交差するか否かを判定することを特徴とする画像生成装置。
3D using a ray tracing method that obtains an intersection of a light beam extending further from a viewpoint through a point on the screen and a three-dimensional object, calculates a light state at the intersection, and determines a color of the point on the screen. When generating a two-dimensional image of an object, a surface intersection determination is performed to determine whether any of the six surfaces constituting the bounding box made up of a rectangular parallelepiped including the three-dimensional object intersects the ray. Control means for selecting the bounding box having a surface determined to intersect with the ray and performing intersection calculation for obtaining an intersection with the ray only for the three-dimensional object included in the bounding box; In the image generating apparatus provided,
Furthermore, it comprises an inclusion determination means for executing an inclusion determination for determining whether or not the viewpoint is included in the bounding box according to a command of the control means,
The control means first causes the inclusion determination means to execute the inclusion determination, and when it is determined by the inclusion determination that the viewpoint is included in the bounding box, the bounding box is not executed without performing the plane intersection determination. And the ray intersect, and if it is determined by the inclusion determination that the viewpoint is not included, the plane intersection determination is executed to determine whether the bounding box and the viewpoint intersect An image generation apparatus characterized by the above.
請求項1に記載の画像生成装置において、
前記制御手段は、前記内包判定手段に前記内包判定を実行させるに先立ち、前記バウンディングボックスが所定の大きさより大きいか否かを判定し、大きいと判定した場合は前記内包判定手段に前記内包判定を実行させ、小さいと判定した場合は前記内包判定手段に前記内包判定を実行させずに前記面交差判定を実行することを特徴とする画像生成装置。
The image generation apparatus according to claim 1,
Prior to causing the inclusion determination means to execute the inclusion determination, the control means determines whether or not the bounding box is larger than a predetermined size. If it is determined that the bounding box is larger, the control means determines the inclusion determination to the inclusion determination means. An image generation apparatus characterized by executing the surface intersection determination without causing the inclusion determination unit to execute the inclusion determination when it is determined that the value is small.
視点からスクリーン上の点を通って更に延びる光線と3次元物体との交点を求め、該交点の光の状態を算出して前記スクリーン上の点の色を決定する光線追跡法を用いて3次元物体の2次元画像を生成する際に、前記3次元物体を含む直方体からなるバウンディングボックスを構成する6面の何れかの面と前記光線とが交差するか否かを判定する面交差判定を実行して、前記光線と交差すると判定された面を持つ前記バウンディングボックスを選択し、該バウンディングボックスに含まれる前記3次元物体に対してのみ前記光線との交点を求める交点計算を実行する制御手段を備える画像生成装置において、
更に、対象としている前記バウンディングボックスの頂点のうち以下に示す正頂点を共有する3つの面をそれぞれ含む3つの無限平面について、各無限平面によって2つに分けられる領域のうち該無限平面自体を含まず且つ前記バウンディングボックス側でない領域の和集合で表される領域を不交差領域とし、前記視点が前記不交差領域に含まれるか否かを判定する不交差判定を前記制御手段の指令により実行する不交差判定手段を備え、
前記制御手段は、まず前記不交差判定手段に前記不交差判定を実行させ、該判定によって前記視点が前記不交差領域に含まれないと判定された場合のみ前記面交差判定を実行して前記バウンディングボックスと前記視点とが交差するか否かを判定し、前記不交差判定によって前記視点が前記不交差領域に含まれると判定された場合は前記面交差判定を実行せずに前記バウンディングボックスと前記光線とは交差しないと判定することを特徴とする画像生成装置。
前記光線を含む直線に関して、視点から見て前記光線のベクトル方向の無限遠を正無限、反対方向の無限遠を負無限とした場合、前記バウンディングボックスの各頂点から前記直線上に垂線を下ろした場合の交点位置が最も正無限方向に位置する頂点を正頂点、最も負無限方向に位置する頂点を負頂点とする。
3D using a ray tracing method that obtains an intersection of a light beam extending further from a viewpoint through a point on the screen and a three-dimensional object, calculates a light state at the intersection, and determines a color of the point on the screen. When generating a two-dimensional image of an object, a surface intersection determination is performed to determine whether any of the six surfaces constituting the bounding box made up of a rectangular parallelepiped including the three-dimensional object intersects the ray. Control means for selecting the bounding box having a surface determined to intersect with the ray and performing intersection calculation for obtaining an intersection with the ray only for the three-dimensional object included in the bounding box; In the image generating apparatus provided,
Further, of the bounding box vertices of interest, the three infinite planes each including three faces sharing the following normal vertex are included in the area divided into two by each infinite plane itself. A non-crossing region is defined as a non-crossing region, and a non-crossing determination for determining whether or not the viewpoint is included in the non-crossing region is executed according to a command from the control unit. With non-intersection judging means,
The control means first causes the non-intersection determining means to execute the non-intersection determination, and executes the surface intersection determination only when the determination determines that the viewpoint is not included in the non-intersection area. It is determined whether a box and the viewpoint intersect, and if it is determined by the non-intersection determination that the viewpoint is included in the non-intersection area, the bounding box and the viewpoint are not performed without performing the plane intersection determination. An image generation apparatus, characterized in that it is determined that it does not intersect with a ray.
When the infinity of the vector direction of the light ray is set to positive infinity and the infinity of the opposite direction is set to negative infinity when viewed from the viewpoint with respect to the straight line including the light ray, a perpendicular is dropped on the straight line from each vertex of the bounding box. In this case, the vertex where the intersection point is located in the most positive infinity direction is the positive vertex, and the vertex located in the most negative infinity direction is the negative vertex.
請求項3に記載の画像生成装置において、
更に、前記視点が前記バウンディングボックスに内包される否かを判定する内包判定を前記制御手段の指令により実行する内包判定手段を備え、
前記制御手段は、前記不交差判定手段に前記不交差判定を実行させることに先立って、前記内包判定手段に前記内包判定を実行させ、該判定によって前記視点が前記バウンディングボックスに内包されると判定された場合は他の交差判定を実行せずに前記バウンディングボックスと前記光線とが交差すると判定し、前記内包判定によって前記視点が前記バウンディングボックスに内包されないと判定された場合は続けて前記不交差判定手段に前記不交差判定を実行させ、該判定によって前記視点が前記不交差判定領域に含まれると判定された場合は前記光線と前記バウンディングボックスとは交差しないと判定し、前記不交差判定によって前記視点が前記不交差領域に含まれないと判定された場合は前記面交差判定を実行して前記バウンディングボックスと前記視点とが交差するか否かを判定することを特徴とする画像生成装置。
The image generation apparatus according to claim 3.
And an inclusion determination means for executing an inclusion determination for determining whether or not the viewpoint is included in the bounding box according to a command of the control means,
The control means causes the inclusion determination means to execute the inclusion determination prior to causing the non-crossing determination means to execute the non-crossing determination, and determines that the viewpoint is included in the bounding box by the determination. If it is determined that the bounding box and the ray intersect without performing another intersection determination, and if it is determined by the inclusion determination that the viewpoint is not included in the bounding box, the non-intersection is continued. When the determination means performs the non-crossing determination, and it is determined by the determination that the viewpoint is included in the non-crossing determination region, it is determined that the ray and the bounding box do not cross, and the non-crossing determination If it is determined that the viewpoint is not included in the non-intersection area, the bounding determination is performed and the bounding is performed. Image generating apparatus wherein the grayed box viewpoint and is characterized by determining whether the intersection.
請求項3に記載の画像生成装置において、
更に、前記視点が前記バウンディングボックスに内包されるか否かを判定する内包判定を前記制御手段の指令により実行する内包判定手段を備え、
前記制御手段は、まず前記不交差判定手段に前記不交差判定を実行させ、該判定によって前記視点が前記不交差領域に含まれると判定された場合は前記光線と前記バウンディングボックスとは交差しないと判定し、前記不交差判定によって前記視点が前記不交差領域に含まれないと判定された場合は続けて前記内包判定手段に前記内包判定を実行させ、該判定によって前記視点が前記バウンディングボックスに内包されると判定された場合は前記面交差判定を実行せずに前記バウンディングボックスと前記光線とは交差すると判定し、前記内包判定によって前記視点が前記バウンディングボックスに内包されないと判定された場合は前記面交差判定を実行することを特徴とする画像生成装置。
The image generation apparatus according to claim 3.
Furthermore, it comprises an inclusion determination means for executing an inclusion determination for determining whether or not the viewpoint is included in the bounding box according to a command of the control means,
The control means first causes the non-crossing determination means to execute the non-crossing determination, and when the determination determines that the viewpoint is included in the non-crossing area, the light ray and the bounding box do not cross each other. And when the non-intersection determination determines that the viewpoint is not included in the non-intersection area, the inclusion determination unit continuously performs the inclusion determination, and the viewpoint is included in the bounding box by the determination. If it is determined that the bounding box and the light ray intersect without performing the plane intersection determination, and if it is determined by the inclusion determination that the viewpoint is not included in the bounding box, An image generation apparatus that performs a plane intersection determination.
請求項5に記載の画像生成装置において、
前記内包判定手段が実行する前記内包判定は、前記負頂点を共有する3面をそれぞれ含む3つの無限平面について、各無限平面によって2つに分けられる領域のうち前記バウンディングボックス側である領域を対象領域にし、該3つの対象領域の積集合で表される領域に前記視点が内包されていれば前記視点は前記バウンディングボックスに内包されていると判定し、前記3つの対象領域の積集合で表される領域に前記視点が内包されていなければ、前記視点は前記バウンディングボックスに内包されていないと判定することを特徴とする画像生成装置。
The image generation apparatus according to claim 5,
The inclusion determination executed by the inclusion determination means is performed on a region that is on the bounding box side among two regions divided by each infinite plane, with respect to three infinite planes each including three surfaces sharing the negative vertex. If the viewpoint is included in an area represented by a product set of the three target areas, it is determined that the viewpoint is included in the bounding box, and the viewpoint is expressed by a product set of the three target areas. If the viewpoint is not included in the area to be processed, it is determined that the viewpoint is not included in the bounding box.
請求項6に記載の画像生成装置において、
前記制御手段は、前記内包判定手段が前記内包判定で用いた前記3つの対象領域のうち前記視点を含まなかった対象領域を選択し、該対象領域を分けている無限平面に含まれる面に対してのみ、前記面交差判定を実行することを特徴とする画像生成装置。
The image generation apparatus according to claim 6.
The control means selects a target area that does not include the viewpoint from the three target areas used by the inclusion determination means in the inclusion determination, and applies to a plane included in an infinite plane that divides the target area The image generation apparatus is characterized in that the plane intersection determination is executed.
請求項1又は、請求項4から請求項6の何れかに記載の画像生成装置において、
前記光線を含む直線に関して、視点から見て前記光線のベクトル方向の無限遠を正無限、反対方向の無限遠を負無限とした場合、前記バウンディングボックスの各頂点から前記直線上に垂線を下ろした場合の交点位置が最も正無限方向に位置する頂点を正頂点、最も負無限方向に位置する頂点を負頂点とした時、
前記制御手段は、前記面交差判定において負頂点を共有する3面を選択して判定することを特徴とする画像生成装置。
In the image generation device according to claim 1 or any one of claims 4 to 6,
When the infinity of the vector direction of the light ray is set to positive infinity and the infinity of the opposite direction is set to negative infinity when viewed from the viewpoint with respect to the straight line including the light ray, a perpendicular is dropped on the straight line from each vertex of the bounding box. When the vertex located in the most positive / infinity direction is the positive vertex and the vertex located in the most negative infinity direction is the negative vertex,
The image generating apparatus according to claim 1, wherein the control unit selects and determines three surfaces sharing a negative vertex in the surface intersection determination.
視点からスクリーン上の点を通って更に延びる光線と3次元物体との交点を求め、該交点の光の状態を算出して前記スクリーン上の点の色を決定する光線追跡法を用いて3次元物体の2次元画像を生成する際に、前記3次元物体を含む直方体からなるバウンディングボックスを構成する6面の何れかの面と前記光線とが交差するか否かを判定する面交差判定を実行して、前記光線と交差すると判定された面を持つ前記バウンディングボックスを選択し、該バウンディングボックスに含まれる前記3次元物体に対してのみ前記光線との交点を求める交点計算を実行する制御手段を備える画像生成装置において、
前記光線を含む直線に関して、視点から見て前記光線のベクトル方向の無限遠を正無限、反対方向の無限遠を負無限とした場合、前記バウンディングボックスの各頂点から前記直線上に垂線を下ろした場合の交点位置が最も正無限方向に位置する頂点を正頂点、最も負無限方向に位置する頂点を負頂点とし、
前記制御手段は、前記面交差判定において正頂点を共有する3面を選択して判定することを特徴とする画像生成装置。
3D using a ray tracing method that obtains an intersection of a light beam extending further from a viewpoint through a point on the screen and a three-dimensional object, calculates a light state at the intersection, and determines a color of the point on the screen. When generating a two-dimensional image of an object, a surface intersection determination is performed to determine whether any of the six surfaces constituting the bounding box made up of a rectangular parallelepiped including the three-dimensional object intersects the ray. Control means for selecting the bounding box having a surface determined to intersect with the ray and performing intersection calculation for obtaining an intersection with the ray only for the three-dimensional object included in the bounding box; In the image generating apparatus provided,
When the infinity of the vector direction of the light ray is set to positive infinity and the infinity of the opposite direction is set to negative infinity when viewed from the viewpoint with respect to the straight line including the light ray, a perpendicular is dropped on the straight line from each vertex of the bounding box. In this case, the vertex located at the most positive infinity direction is the positive vertex, the vertex located at the most negative infinity direction is the negative vertex,
The image generating apparatus according to claim 1, wherein the control unit selects and determines three surfaces sharing a normal vertex in the surface intersection determination.
請求項9に記載の画像生成装置において、
更に、対象としている前記バウンディングボックスの頂点のうち正頂点を共有する3つの面をそれぞれ含む3つの無限平面について、各無限平面によって2つに分けられる領域のうち該無限平面自体を含まず且つ前記バウンディングボックス側でない領域の和集合で表される領域を不交差領域とし、前記視点が前記不交差領域に含まれるか否かを判定する不交差判定を前記制御手段の指令により実行する不交差判定手段を備え、
前記制御手段は、まず前記不交差判定手段に前記不交差判定を実行させ、該判定によって前記視点が前記不交差領域に含まれないと判定された場合のみ前記面交差判定を実行して前記バウンディングボックスと前記視点とが交差するか否かを判定し、前記不交差判定によって前記視点が前記不交差領域に含まれると判定された場合は前記面交差判定を実行せずに前記バウンディングボックスと前記光線とは交差しないと判定することを特徴とする画像生成装置。
The image generation apparatus according to claim 9.
Further, for three infinite planes each including three faces sharing the positive vertex among the vertices of the bounding box of interest, the infinite plane itself is not included in the region divided into two by each infinite plane, and A non-crossing determination in which a region represented by a union of regions not on the bounding box side is defined as a non-crossing region, and a non-crossing determination is performed based on a command from the control unit to determine whether the viewpoint is included in the non-crossing region With means,
The control means first causes the non-intersection determining means to execute the non-intersection determination, and executes the surface intersection determination only when the determination determines that the viewpoint is not included in the non-intersection area. It is determined whether a box and the viewpoint intersect, and if it is determined by the non-intersection determination that the viewpoint is included in the non-intersection area, the bounding box and the viewpoint are not performed without performing the plane intersection determination. An image generation apparatus, characterized in that it is determined that it does not intersect with a ray.
請求項1から請求項10の何れかに記載の画像生成装置において、
前記制御手段は、前記面交差判定を実行する際に対象の面を含む無限平面との交点を求め、該交点が以下に示す非交差部分平面に存在するか否かを判定し、前記交点が前記非交差部分平面に存在した場合は前記バウンディングボックスに対して以降の前記面交差判定を実行せずに前記バウンディングボックスと前記光線とは交差しないと判定することを特徴とする画像生成装置。
前記光線を含む直線に関して、視点から見て前記光線のベクトル方向の無限遠を正無限、反対方向の無限遠を負無限とした場合、前記バウンディングボックスの各頂点から前記直線上に垂線を下ろした場合の交点位置が最も正無限方向に位置する頂点を正頂点、最も負無限方向に位置する頂点を負頂点とした時、前記バウンディングボックスの対象面において正頂点又は負頂点と対角に位置する頂点を含む2辺について、該頂点と反対側一端を延長し、対象面を含む無限平面を二つの部分平面に分け、該部分平面のうち対象の面を含まない方の部分平面を非交差部分平面とする。
The image generation device according to any one of claims 1 to 10,
The control means obtains an intersection with an infinite plane including the target surface when performing the plane intersection determination, determines whether the intersection exists in a non-intersection partial plane shown below, and the intersection is The image generating apparatus according to claim 1, wherein if the plane exists in the non-intersecting partial plane, the bounding box and the light ray are determined not to intersect without performing the subsequent plane intersection determination on the bounding box.
When the infinity of the vector direction of the light ray is set to positive infinity and the infinity of the opposite direction is set to negative infinity when viewed from the viewpoint with respect to the straight line including the light ray, a perpendicular is dropped on the straight line from each vertex of the bounding box. In this case, when the vertex located at the most positive infinite direction is the positive vertex and the vertex located at the most negative infinite direction is the negative vertex, the intersection point is located diagonally to the positive or negative vertex on the target surface of the bounding box. For two sides including the vertex, one end opposite to the vertex is extended, the infinite plane including the target surface is divided into two partial planes, and the partial plane that does not include the target surface of the partial planes is a non-intersecting portion A plane.
請求項1から請求項10の何れかに記載の画像生成装置において、
前記制御手段は、前記バウンディングボックスの各辺が座標軸と平行になるように前記バウンディングボックスを設定し、前記面交差判定を以下に示すように判定することを特徴とする画像生成装置。
(1)対象面を含む平面がyz平面に平行である場合
対象面の各要素及び交点座標に、前記光線の方向ベクトルのx成分を乗じて判定。
(2)対象面を含む平面がxz平面に平行である場合
対象面の各要素及び交点座標に、前記光線の方向ベクトルのy成分を乗じて判定。
(3)対象面を含む平面がxy平面に平行である場合
対象面の各要素及び交点座標に、前記光線の方向ベクトルのz成分を乗じて判定。
The image generation device according to any one of claims 1 to 10,
The image generation apparatus according to claim 1, wherein the control unit sets the bounding box so that each side of the bounding box is parallel to a coordinate axis, and determines the plane intersection determination as follows.
(1) When the plane including the target plane is parallel to the yz plane, each element and intersection coordinates of the target plane are multiplied by the x component of the direction vector of the light beam.
(2) When the plane including the target plane is parallel to the xz plane, each element and intersection coordinates of the target plane are multiplied by the y component of the direction vector of the light beam.
(3) When the plane including the target surface is parallel to the xy plane, each element and intersection coordinates of the target surface are multiplied by the z component of the direction vector of the light beam.
視点からスクリーン上の点を通って更に延びる光線と3次元物体との交点を求め、該交点の光の状態を算出して前記スクリーン上の点の色を決定する光線追跡法を用いて3次元物体の2次元画像を生成する際に、前記3次元物体を含む直方体からなるバウンディングボックスを構成する6面の何れかの面と前記光線とが交差するか否かを判定する面交差判定を実行して、前記光線と交差すると判定された面を持つ前記バウンディングボックスを選択し、該バウンディングボックスに含まれる前記3次元物体に対してのみ前記光線との交点を求める交点計算を実行する制御手段を備える画像生成装置において、
前記制御手段は、前記バウンディングボックスの各辺が座標軸と平行になるように前記バウンディングボックスを設定し、前記面交差判定を以下に示すように判定することを特徴とする画像生成装置。
(1)対象面を含む平面がyz平面に平行である場合
対象面の各要素及び交点座標に、前記光線の方向ベクトルのx成分を乗じて判定。
(2)対象面を含む平面がxz平面に平行である場合
対象面の各要素及び交点座標に、前記光線の方向ベクトルのy成分を乗じて判定。
(3)対象面を含む平面がxy平面に平行である場合
対象面の各要素及び交点座標に、前記光線の方向ベクトルのz成分を乗じて判定。
3D using a ray tracing method that obtains an intersection of a light beam extending further from a viewpoint through a point on the screen and a three-dimensional object, calculates a light state at the intersection, and determines a color of the point on the screen. When generating a two-dimensional image of an object, a surface intersection determination is performed to determine whether any of the six surfaces constituting the bounding box made up of a rectangular parallelepiped including the three-dimensional object intersects the ray. Control means for selecting the bounding box having a surface determined to intersect with the ray and performing intersection calculation for obtaining an intersection with the ray only for the three-dimensional object included in the bounding box; In the image generating apparatus provided,
The image generation apparatus according to claim 1, wherein the control unit sets the bounding box so that each side of the bounding box is parallel to a coordinate axis, and determines the plane intersection determination as follows.
(1) When the plane including the target plane is parallel to the yz plane, each element and intersection coordinates of the target plane are multiplied by the x component of the direction vector of the light beam.
(2) When the plane including the target plane is parallel to the xz plane, each element and intersection coordinates of the target plane are multiplied by the y component of the direction vector of the light beam.
(3) When the plane including the target surface is parallel to the xy plane, each element and intersection coordinates of the target surface are multiplied by the z component of the direction vector of the light beam.
視点からスクリーン上の点を通って更に延びる光線と3次元物体との交点を求め、該交点の光の状態を算出して前記スクリーン上の点の色を決定する光線追跡法を用いて3次元物体の2次元画像を生成する際に、前記3次元物体を含む直方体からなるバウンディングボックスを構成する6面の何れかの面と前記光線とが交差するか否かを判定する面交差判定を実行して、前記光線と交差すると判定された面を持つ前記バウンディングボックスを選択し、該バウンディングボックスに含まれる前記3次元物体に対してのみ前記光線との交点を求める交点計算を実行する制御手段を備える画像生成装置において、
更に、前記制御手段から指定される1面を除く5面をそれぞれ含む5つの無限平面について、各無限平面によって2つに分けられる領域のうち該無限平面自体を含まず且つ前記バウンディングボックス側でない領域の和集合を不交差領域とし、前記視点が前記不交差領域に含まれるか否かを判定する不交差判定を前記制御手段の指令により実行する不交差判定手段を備え、
前記制御手段は、前記バウンディングボックスの各辺が座標軸と平行になるように前記バウンディングボックスを設定し、前記光線の方向ベクトルの成分のうち何れか2つの成分がゼロである場合に限り、以下に示す負無限方向に最も位置する1面を指定して前記不交差判定手段に前記不交差判定を実行させ、前記不交差判定によって前記視点が前記不交差領域に含まれると判定された場合は前記バウンディングボックスと前記光線とは交差しないと判定し、前記不交差判定によって前記視点が前記不交差領域に含まれないと判定された場合は前記バウンディングボックスと前記光線とは交差すると判定することを特徴とする画像生成装置。
前記光線を含む直線に関して、視点から見て前記光線のベクトル方向と反対方向の無限遠を負無限とする。
3D using a ray tracing method that obtains an intersection of a light beam extending further from a viewpoint through a point on the screen and a three-dimensional object, calculates a light state at the intersection, and determines a color of the point on the screen. When generating a two-dimensional image of an object, a surface intersection determination is performed to determine whether any of the six surfaces constituting the bounding box made up of a rectangular parallelepiped including the three-dimensional object intersects the ray. Control means for selecting the bounding box having a surface determined to intersect with the ray and performing intersection calculation for obtaining an intersection with the ray only for the three-dimensional object included in the bounding box; In the image generating apparatus provided,
Further, for five infinite planes each including five surfaces except for one surface designated by the control means, an area that does not include the infinite plane itself and is not on the bounding box side among the areas divided into two by each infinite plane A non-crossing determination unit that executes a non-crossing determination according to a command of the control unit to determine whether or not the viewpoint is included in the non-crossing region.
The control means sets the bounding box so that each side of the bounding box is parallel to the coordinate axis, and only when any two of the components of the direction vector of the ray are zero: If the non-crossing determining means executes the non-crossing determination by designating one surface located in the negative infinity direction, and the non-crossing determination determines that the viewpoint is included in the non-crossing region, It is determined that the bounding box and the light ray do not intersect, and when it is determined by the non-intersection determination that the viewpoint is not included in the non-intersection area, it is determined that the bounding box and the light beam intersect. An image generating apparatus.
With respect to the straight line including the light ray, infinity in the direction opposite to the vector direction of the light ray as viewed from the viewpoint is defined as negative infinity.
コンピュータを、請求項1から請求項14の何れかに記載の画像生成装置を構成する各手段として機能させるためのプログラム。The program for functioning a computer as each means which comprises the image generation apparatus in any one of Claims 1-14.
JP2002062325A 2002-03-07 2002-03-07 Image generating apparatus and program Expired - Lifetime JP3931691B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002062325A JP3931691B2 (en) 2002-03-07 2002-03-07 Image generating apparatus and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002062325A JP3931691B2 (en) 2002-03-07 2002-03-07 Image generating apparatus and program

Publications (2)

Publication Number Publication Date
JP2003263649A JP2003263649A (en) 2003-09-19
JP3931691B2 true JP3931691B2 (en) 2007-06-20

Family

ID=29196153

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002062325A Expired - Lifetime JP3931691B2 (en) 2002-03-07 2002-03-07 Image generating apparatus and program

Country Status (1)

Country Link
JP (1) JP3931691B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101705072B1 (en) * 2010-09-28 2017-02-09 삼성전자주식회사 Image processing apparatus and method
CN112733428B (en) * 2020-12-17 2022-09-06 上海理工大学 Scanning attitude and coverage path planning method for optical measurement

Also Published As

Publication number Publication date
JP2003263649A (en) 2003-09-19

Similar Documents

Publication Publication Date Title
US8648856B2 (en) Omnidirectional shadow texture mapping
JP4948218B2 (en) Image processing apparatus and control method thereof
JP3294149B2 (en) Three-dimensional texture mapping processing device and three-dimensional image generation device using the same
CN111127623B (en) Model rendering method and device, storage medium and terminal
US10593096B2 (en) Graphics processing employing cube map texturing
JP5437475B2 (en) Shading generation method for images
US10529119B2 (en) Fast rendering of quadrics and marking of silhouettes thereof
JPH05114032A (en) Shadow testing method in three-dimensional graphics
JP2012252725A (en) Method, apparatus, and computer program product for improved graphics performance
US20060071930A1 (en) Image processing apparatus, and computer program
US7158133B2 (en) System and method for shadow rendering
GB2406252A (en) Generation of texture maps for use in 3D computer graphics
JP2002352254A (en) Method for rendering mesh including a plurality of polygons representing graphics models
JP3931691B2 (en) Image generating apparatus and program
CN115953290A (en) Scene voxelization method based on GPU (graphics processing Unit) rasterizer
JP3931701B2 (en) Image generating apparatus and program
KR101227155B1 (en) Graphic image processing apparatus and method for realtime transforming low resolution image into high resolution image
US5821942A (en) Ray tracing through an ordered array
US5751290A (en) Three dimensional graphics system and method with correction to z buffer value errors
JPH09305791A (en) Device and method for generating three-dimensional image
JP4297557B2 (en) 3D image generation apparatus and 3D image generation method
KR20100060191A (en) Apparatus and method for rendering and generating of three dimensional model in electronic device
JP5024831B2 (en) Image creating apparatus and program
KR100261278B1 (en) The scan converting method in parc algorithm for ray casting of volume data
KR0153664B1 (en) 3d object generator in a graphic system

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20040506

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20070213

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: 20070220

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20070305

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20100323

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20110323

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20120323

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20120323

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20130323

Year of fee payment: 6