11. 物体の形状

POV-Rayは物体(オブジェクト)に、その形状と材質を設定することでざまざまなものを表現している。このセクションでは、物体の形状の設定に関して示す。

11.1 プリミティブ

シーンを作成するときに使う基本図形をプリミティブと呼ぶ。物体(オブジェクト)はプリミティブで構成されている。プリミティブを積み木のように組み合わせて物体が表現される。このようなモデルの作成方法をCSGと呼ぶ。ここでは以下の27種類について示す。

(1) ボックス(box)
(2) 球(sphere)
(3) 円柱(cylinder)
(4) コーン(cone)
(5) トーラス(torus)
(6) 卵形(ovus)
(7) 円盤(disc)
(8) 超2次曲面(superellipsoid)
(9) 3角形(triangle)
(10) スムーズ3角形(smooth_triangle)
(11) 多角形(polygon)
(12) メッシュ(mesh)
(13) メッシュ2(mesh2)
(14) 簡易回転体(sor)
(15) 回転体(lathe)
(16) 角柱(prism)
(17) 球スイープ(sphere_sweep)
(18) ハイトフィールド(height_field)
(19) ブロブ(blob)
(20) フラクタル(julia_fractal)
(21) 3Dテキスト(text)
(22) 無限平面(plane)
(23) 2次曲面(quadric)
(24) 3次曲面(cubic)
(25) 4次曲面(quartic)
(26) 高次曲面(poly)
(27) ベジエ曲面(bicubic_patch)
  

※ この他にも、マクロ定義された形状が添付のインクルードファイルにある。 ▷「14. inc ファイル」参照

※ プリミティブは単体で物体として使用できるが、CSGにより複数のプリミティブを組 み合わせて1つの物体として扱うことがよく行われる。▷「11.3 CSG」参照

※ プリミティブ(有限ソリッド、無限パッチプリミティブ)は、クリッピング形状(ある物体の一部を切り取ることができる物体) として使用できる。▷「11.4 形状設定オプション」参照

<プリミティブの3タイプ>

①有限ソリッドプリミティブ(内側と外側の境界があり、大きさが有限の形状)
②有限パッチプリミティブ(内側と外側の境界がなく、大きさが有限の形状)
③無限パッチプリミティブ(内側と外側の境界があり、大きさが無限の形状)

①有限ソリッドプリミティブ

有限ソリッドプリミティブは、大きさが有限で内側と外側の境界が明確な形状のことである。下記の14種類のものは有限ソリッドプリミティブとして扱われる。

●ブロブ(blob)
●ボックス(box)
●コーン(cone)
●円柱(cylinder)
●ハイトフィールド(height_field)
●フラクタル(julia_fractal)
●角柱(prism)
●回転体(lathe)
●卵形(ovus)
●簡易回転体(sor)
●球(sphere)
●球スイープ(sphere_sweep)
●超2次曲面(superellipsoid)
●3Dテキスト(text)
●トーラス(torus)
   

※ これらのプリミティブは内側がはっきり定義できるため、CSG(▷「11.3 CSG」)で使 用できる。

※ これらのものは有限であるため自動的にバウンディング(境界の設定)が行われる。

②有限パッチプリミティブ

有限パッチプリミティブは、大きさが有限で厚さがなく、内側と外側の境界が明確でない形状のことである。下記の7種類のものは有限パッチプリミティブとして扱われる。

 ●ベジエ曲面(bicubic_patch)
 ●円盤(disc)
 ●メッシュ(mesh)
 ●メッシュ2(mesh2)
 ●多角形(polygon)
 ●3角形(triangle)
 ●スムーズ3角形(smooth_triangle)

※ これらのものは内側がはっきり定義できないため、クリッピング形状としては使用でき ない。またCSGでも使用できない場合がある。

※ これらのものは有限であるため自動的にバウンディング(境界の設定)が行われる。

③無限パッチプリミティブ

無限パッチプリミティブは大きさが無限で厚さがなく、内側と外側が明確な形状のことである。下記の5種類のものは無限パッチプリミティブとして扱われる。

 ●無限平面(plane)
 ●2次曲面(quardric)
 ●3次曲面(cubic)
 ●4次曲面(quartic)
 ●高次曲面(poly)

※ これらのものは内側が定義できるため、クリッピング形状として使用できる。またCSG でも使用できる。


11.1-1 ボックス(box)

ボックスは、立方体や直方体のことである。対角の2点を設定し、直方体を表現する。

図11.1-1a ボックス(box)

//--------------- Fig. 11.1-1a /box/ #version 3.7 #include "colors.inc" global_settings {assumed_gamma 2.2} camera{ location<1,-2,1.5> sky<0,0,1> right <-image_width/image_height,0,0> look_at<0,0,0.5> } light_source {<300,-500,1000> color White} //====================================== /// box /// box{0,1 pigment{checker White*1.2, ForestGreen scale 0.25} finish{phong 1 reflection 0.1} translate <-0.5,-0.5,0> } //----------------ground disc{0, <0,0,1>, 5 pigment{brick White*1.2, CoolCopper*1.2 scale 0.07} normal{brick 0.01 scale 0.1} finish{reflection 0.3 crand 0.1} } //----------------sky sky_sphere{ pigment{ wrinkles color_map{ [ 0.3 SkyBlue] [ 0.9 White ] } scale <1, 0.2, 0.2> } }

※ ボックスは能率的に計算されるため、バウンディングとしても最適である。 ▷「11.4 形状設定オプション」参照

  ●プリミティブのタイプ:有限ソリッド
  ●クリッピング形状:○
  ●CSG:○

< box の構文 >

box { <CORNER1> , <CORNER2> [ OBJECT_MODIFIERS... ] }
box ボックスのキーワード
<CORNER1> , <CORNER2> ボックスの対角の頂点の x,y,z 座標(図11.1-1b)
OBJECT_MODIFIERS... 物体の変形・テクスチャなどの設定

図11.1-1b ボックスのパラメータ


11.1-2 球(sphere)

球は中心と半径を設定して作る。スケーリングでxyzの倍率が同じ値でないときに楕円体となる。

図11.1-2a 球(sphere)

//-------------------- Fig. 11.1-2a /sphere/ #version 3.7 #include "colors.inc" global_settings {assumed_gamma 2.2} camera{ location<0,-5.2,2.5> sky<0,0,1> right <-image_width/image_height,0,0> look_at<0,0,0.2> } light_source {<-300,-1000,1000> color White} #declare tex01= texture{ pigment{checker White*1.2, ForestGreen scale 0.5} finish{phong 1 reflection 0.2} } //================================= /// sphere /// sphere{<0,0,1.5>,1 texture {tex01} } sphere{0,1 scale <0.5,2,0.5> rotate x*15 texture {tex01} translate <-2,0,1>} sphere{0,1 scale <0.1,2,0.5> rotate x*15 texture {tex01} translate <2,0,1>} sphere{0,1 scale z*0.3 texture {tex01} translate <0,-2,0.2>} //----------------ground disc{0, <0,0,1>, 5 pigment{brick White, CoolCopper scale 0.09} normal{brick 0.01 scale 0.1} finish{reflection 0.3 crand 0.1} } //----------------sky sky_sphere{ pigment{ wrinkles color_map{ [ 0.3 SkyBlue] [ 0.9 White ] } scale <1, 0.2, 0.2> } }

球は効率的に計算されるため、バウンディング形状に適している。 ▷「11.4 形状設定オプション」参照

  ●プリミティブのタイプ:有限ソリッド
  ●クリッピング形状:○
  ●CSG:○

< sphere の構文 >

sphere { <CENTER>, RADIUS [ OBJECT_MODIFIERS... ] }
sphere 球のキーワード
<CENTER> 球の中心 x,y,z 座標
RADIUS 球の半径
OBJECT_MODIFIERS... 物体の変形・テクスチャなどの設定

図11.1-2b 球のパラメータ


11.1-3 円柱(cylinder)

両端の底面の座標と底面の半径を設定し円柱を作る。またオプションのキーワード open を追加し両端の円形部分を取り除き、円筒を作ることもできる。

図11.1-3a 円柱(cylinder)
//--------------- Fig. 11.1-3a /cylinder/ #version 3.7 #include "colors.inc" global_settings {assumed_gamma 2.2} camera{ location<0,-2,2> sky<0,0,1> right <-image_width/image_height,0,0> look_at<0,0,0.5> } light_source {<300,-500,1000> color White} //============================== /// cylinder /// cylinder{0,z*1,0.5 pigment{checker White*1.2, Yellow scale 0.25} finish{phong 1 reflection 0.1} translate <-0.7,0,0> } cylinder{0,z*1,0.5 open pigment{checker White*1.2, Red scale 0.25} finish{phong 1 reflection 0.1} translate <0.7,0,0> } //----------------ground disc{0, <0,0,1>, 5 pigment{brick White, CoolCopper scale 0.08} normal{brick 0.01 scale 0.1} finish{reflection 0.3 crand 0.1} } //----------------sky sky_sphere{ pigment{ wrinkles color_map{ [ 0.3 SkyBlue] [ 0.9 White ] } scale <1, 0.2, 0.2> } }

  ●プリミティブのタイプ:有限ソリッド
  ●クリッピング形状:○
  ●CSG:○

< cylinder の構文 >

cylinder { <BASE_POINT> , <CAP_POINT> , RADIUS [ open ] [ OBJECT_MODIFIERS... ] }
cylinder 円柱のキーワード
<BASE_POINT> , <CAP_POINT> 底面と上面の中心 x,y,z 座標
RADIUS 円柱の半径
open 両端面を取り除く設定、筒となる。
OBJECT_MODIFIERS... 物体の変形・テクスチャなどの設定

図11.1-3b 円柱のパラメータ


11.1-4 コーン(cone)

コーンは、円錐または円錐台である。コーンは底面と頂点の座標と半径を設定して作る。またオプションのキーワード open の追加によって、両端面を取り除くとメガホン状の物体となる。

図11.1-4a コーン(cone)
//--------------- Fig. 11.1-4a /cone/ #version 3.7 #include "colors.inc" global_settings {assumed_gamma 2.2} camera{ location<0,-4,2> sky<0,0,1> right <-image_width/image_height,0,0> look_at<0,0,1> } light_source {<300,-1000,1000> color White} //============================= /// cone /// cone{0,1,z*2,0 pigment{checker White*1.2, Red scale 0.5} finish{phong 1 reflection 0.1} translate <0,0,0> } cone{0,1,z*1,0.5 pigment{checker White*1.2,Blue scale 0.5} finish{phong 1 reflection 0.1} rotate x*60 translate <2,1,1> } cone{0,1,z*1,0.5 open pigment{checker White*1.2, Blue scale 0.5} finish{phong 1 reflection 0.1} rotate x*60 translate <-2,1,1> } //----------------ground disc{0, <0,0,1>, 5 pigment{brick White, CoolCopper scale 0.09} normal{brick 0.01 scale 0.1} finish{reflection 0.3 crand 0.1} } //----------------sky sky_sphere{ pigment{ wrinkles color_map{ [ 0.3 SkyBlue] [ 0.9 White ] } scale <1, 0.2, 0.2> } }

  ●プリミティブのタイプ:有限ソリッド
  ●クリッピング形状:○
  ●CSG:○

< cone の構文 >

cone { <BASE_POINT>, BASE_RADIUS, <CAP_POINT>, CAP_RADIUS [ open ] [ OBJECT_MODIFIERS... ] }
cone コーンのキーワード
<BASE_POINT> 底面の中心 x,y,z 座標
BASE_RADIUS 底面の半径
<CAP_POINT> 上面の中心 x,y,z 座標
CAP_RADIUS 上面の半径
open 両端面を取り除く設定
OBJECT_MODIFIERS... 物体の変形・テクスチャなどの設定

※ 底面または上面の半径、どちらかを0にすると円錐となる。

図11.1-4b コーンのパラメータ


11.1-5 トーラス(torus)

トーラスはドーナツやタイヤのチューブのような形状である。

図11.1-5a トーラス(torus)
//--------------- Fig. 11.1-5a /torus/ #version 3.7 #include "colors.inc" global_settings {assumed_gamma 2.2} camera{ location<0,-3,1.5> sky<0,0,1> right <-image_width/image_height,0,0> look_at<0,0,0.75> } light_source {<300,-1000,1000> color White} //==================================== /// torus /// torus{1,0.3 pigment{checker MediumGoldenrod*1.2,Tan*1.2 scale 0.5} finish{phong 1 reflection 0.2} rotate x*-60 translate z*1 } //----------------ground disc{0, <0,0,1>, 5 pigment{brick White, CoolCopper scale 0.05} normal{brick 0.01 scale 0.1} finish{reflection 0.3 crand 0.1} } //----------------sky sky_sphere{ pigment{ wrinkles color_map{ [ 0.3 SkyBlue] [ 0.9 White ] } scale <1, 0.2, 0.2> } }

  ●プリミティブのタイプ:有限ソリッド
  ●クリッピング形状:○
  ●CSG:○

< torus の構文 >

torus { MAJOR_RADIUS , MINOR_RADIUS [ sturm ] [ OBJECT_MODIFIERS... ] }
torus トーラスのキーワード
MAJOR_RADIUS 大半径(穴の中心から断面の小円中心までの距離)
MINOR_RADIUS 小半径(断面の小円半径)
sturm 形状が正しく描かれない場合に、時間をかけて正確な計算をする設定
OBJECT_MODIFIERS... 物体の変形・テクスチャなどの設定

※ トーラスは常に中心が原点で y 軸に垂直に作られる。

図11.1-5b トーラスの位置、向き、パラメータの関係


11.1-6 卵形(ouvs)

卵のような形を生成する。半径を2つ設定し、さまざまな卵形を作成する。

図11.1-6a 卵形(ouvs)
//--------------- Fig. 11.1-6a /ovus/ #version 3.7 #include "colors.inc" global_settings {assumed_gamma 2.2} camera{ location<0,-4,2> sky<0,0,1> right <-image_width/image_height,0,0> look_at<0,0,1> } light_source {<300,-1000,1000> color White} //================================ /// ovus /// ovus{ 2,0.5 scale 0.5 rotate x*90 pigment{checker White*1.2, Red scale 0.5} finish{phong 1 reflection 0.1} translate <0,0,1> } ovus{ 1.3 1 scale 0.5 pigment{checker White*1.2,Blue scale 0.5} finish{phong 1 reflection 0.1} rotate x*90 translate <2,0,1> } ovus{ 1, 1.3 scale 0.5 pigment{checker White*1.2, Blue scale 0.5} finish{phong 1 reflection 0.1} rotate x*90 translate <-2,0,1> } //----------------ground disc{0, <0,0,1>, 5 pigment{brick White, CoolCopper scale 0.09} normal{brick 0.01 scale 0.1} finish{reflection 0.3 crand 0.1} } //----------------sky sky_sphere{ pigment{ wrinkles color_map{ [ 0.3 SkyBlue] [ 0.9 White ] } scale <1, 0.2, 0.2> } }

  ●プリミティブのタイプ:有限ソリッド
  ●クリッピング形状:○
  ●CSG:○

< ouvs の構文 >

ovus { Botton_radius, Top_radius [ OBJECT_MODIFIERS... ] }
ovus 卵形のキーワード
Botton_radius 卵形の下方の半径
Top_radius 卵形の上方の半径
OBJECT_MODIFIERS... 物体の変形・テクスチャなどの設定

図11.1-6b 卵形のパラメータ


11.1-7 円盤(disc)

円盤は、中心の座標、面の向きを決める法線ベクトル、半径の設定によって作る。また、半径をもう1つ追加し、中心に穴をあけることもできる。

図11.1-7a 円盤(disc)
//--------------- Fig. 11.1-7a /disc/ #version 3.7 #include "colors.inc" global_settings {assumed_gamma 2.2} camera{ location<0,-2.5,2> sky<0,0,1> right <-image_width/image_height,0,0> look_at<0,0,0.8> } light_source {<300,-500,1000> color White} //================================ /// disc /// disc{0,z,1.0,0.5 pigment{checker White*1.2, SlateBlue scale 0.25} finish{phong 1 reflection 0.1} rotate x*15 translate z*0.5 } disc{0,z,1 pigment{checker White*1.2, OrangeRed scale 0.25} finish{phong 1 reflection 0.1} rotate x*15 translate <0,0.5,1.5> } //----------------ground disc{0, <0,0,1>, 5 pigment{brick White, CoolCopper scale 0.05} normal{brick 0.01 scale 0.1} finish{reflection 0.3 crand 0.1} } //----------------sky sky_sphere{ pigment{ wrinkles color_map{ [ 0.3 SkyBlue] [ 0.9 White ] } scale <1, 0.2, 0.2> } }

  ●プリミティブのタイプ:有限パッチ
  ●クリッピング形状:×
  ●CSG:△(面の端部は×)

< disc の構文 >

disc { <CENTER>, <NORMAL>, RADIUS [, HOLE_RADIUS ] [ OBJECT_MODIFIERS... ] }
disc 円盤のキーワード
<CENTER> 円盤の中心 x,y,z 座標
<NORMAL> 面の法線ベクトル(円盤の向きを決定)
RADIUS 円盤の半径
HOLE_RADIUS 円盤の中心にあける穴の半径
OBJECT_MODIFIERS... 物体の変形・テクスチャなどの設定

図11.1-7b 円盤のパラメータ


11.1-8 超2次曲面(superellipsoid)

超2次曲面は、2次曲面を拡張した超楕円球である。パラメータの設定により角の丸いボックスや円柱などを作ることができる。

<e, n> の設定、左から:<1, 1> <0.5, 0.5> <0.1, 0.1>
図11.1-8a 超2次曲面-1(superellipsoid)

<e, n> の設定、左から:<1, 1> <1, 0.5> <1, 0.1>
図11.1-8b 超2次曲面-2(superellipsoid)
//--------------- Fig. 11.1-8a /superellipsoid/ // +W512 +H256 +A // #version 3.7 #include "colors.inc" global_settings {assumed_gamma 2.2} camera{ location<0,-2.5,2> sky<0,0,1> right <-image_width/image_height,0,0> look_at<0.1,0,0.5> angle 68 } light_source {<300,-1000,1000> color White} //============================= /// superellipsoid /// // <e,n> e=n : <1,1> <0.5,0.5> <0.1,0.1> superellipsoid{<1,1> pigment{checker White*1.2, Firebrick scale 2.5} finish{phong 1 reflection 0.2} scale 0.45 translate <-1.2,0,0.5> } superellipsoid{<0.5,0.5> pigment{checker White*1.2, NewMidnightBlue scale 2.5} finish{phong 1 reflection 0.2} scale 0.45 translate <0,0,0.5> } superellipsoid{<0.1,0.1> pigment{checker White*1.2, Green scale 2.5} finish{phong 1 reflection 0.2} scale 0.45 translate <1.2,0,0.5> } //----------------ground disc{0, <0,0,1>, 5 pigment{brick White, CoolCopper scale 0.1} normal{brick 0.01 scale 0.1} finish{reflection 0.3 crand 0.1} } //----------------sky sky_sphere{ pigment{ wrinkles color_map{ [ 0.3 SkyBlue] [ 0.9 White ] } scale <1, 0.2, 0.2> } }
//--------------- Fig. 11.1-8b /superellipsoid/ // +W512 +H256 +A // #version 3.7 #include "colors.inc" global_settings {assumed_gamma 2.2} camera{ location<0,-2.5,2> sky<0,0,1> right <-image_width/image_height,0,0> look_at<0.1,0,0.5> angle 68 } light_source {<300,-1000,1000> color White} //============================= /// superellipsoid /// // <e,n> e=1 : <1,1> <1,0.5> <1,.1> superellipsoid{<1,1> pigment{checker White*1.2, Firebrick scale 2.5} finish{phong 1 reflection 0.2} scale 0.45 translate <-1.2,0,0.5> } superellipsoid{<1,0.5> pigment{checker White*1.2, NewMidnightBlue scale 2.5} finish{phong 1 reflection 0.2} scale 0.45 translate <0,0,0.5> } superellipsoid{<1,0.1> pigment{checker White*1.2, Green scale 2.5} finish{phong 1 reflection 0.2} scale 0.45 translate <1.2,0,0.5> } //----------------ground disc{0, <0,0,1>, 5 pigment{brick White, CoolCopper scale 0.1} normal{brick 0.01 scale 0.1} finish{reflection 0.3 crand 0.1} } //----------------sky sky_sphere{ pigment{ wrinkles color_map{ [ 0.3 SkyBlue] [ 0.9 White ] } scale <1, 0.2, 0.2> } }
  ●プリミティブのタイプ:有限ソリッド
  ●クリッピング形状:○
  ●CSG:○

< superellipsoid の構文 >

superellipsoid { <e, n> [ OBJECT_MODIFIERS... ] }
superellipsoid 超2次曲面のキーワード
<e, n> 角の丸みを決定する。通常は0~1の数値で設定する。値を大きくするほど角が丸くなり、1より大きい値を使うと角の部分が中心に向かって引っ張られたような形状になる。
e=1, n=1:球
e=n, 0<e<1, 0<n<1:角丸のボックス生成(図11.1.8a)
e=1, 0<n<1:角丸の円柱生成(図11.1.8b)
値が小さすぎると正確に計算されない場合がある。超楕円球は常に原点を中心にして作られる。
OBJECT_MODIFIERS... 物体の変形・テクスチャなどの設定

図11.1-8c <e, n> の設定値によるさまざまな形状


 ▷ 次を見る