RIB ファイルとは、RenderMan (及び blenderなどの RenderMan 互換ソフトウエア)で使用されているシーン記述ファイルである.
このページでは,Pixer RIB ファイルにおけるプリミティブ(球などの要素)の記述,カメラの指定などについて, 基本的な文法と機能を説明している.
この Web ページに記載の RIB ファイルは,RenderMan 互換のレンダラーである aqsis で確認済みである.
参考 Web ページ
RIB ファイルを作成する.そのファイル名は何でもよいが,以下の説明 sample.rib であるとしておく.
Display "sample.tiff" "file" "rgba"
Display "+sample.tiff" "framebuffer" "rgb"
Format 800 600 1
Projection "perspective" "fov" [60]
WorldBegin
Translate 0 0 2
Color 0.2 0.4 1
Sphere 1 -1 1 360
WorldEnd
aqsis.exe -progress "sample.rib" で描画
下記のように表示されるので確認する
投影方法は,perspective, orthographic がある.
perspective の場合,「"fov" [60]」をつけると,視野角 60 度 (視野角は 0 から 180 の範囲で指定できる)
シーンの記述を囲む
表面色の r,g,b 成分, 0 から 1 の値
モデルを,世界座標系の (x,y,z)に平行移動
Display "sample.tiff" "file" "rgba"
Display "+sample.tiff" "framebuffer" "rgb"
Format 800 600 1
Projection "perspective" "fov" [60]
WorldBegin
LightSource "ambientlight" 0.2 "intensity" .8
Translate 0 0 6
Rotate -90 1 0 0
## A sphere
Color 1 0 0
Translate -2 0 1
Sphere 0.5 -0.5 0.5 360
## A cone
Color 0 1 0
Translate 2 0 -1
Cone 1 0.5 360
## A cylinder
Color 0 0 1
Translate 2 0 1
Cylinder 0.5 -0.5 0.5 360
## A hyperboloid
Color 1 1 0
Translate -4 0 -2
Hyperboloid 0.4 -0.4 -0.4 0.4 0.4 0.4 360
## A paraboloid
Color 1 0 1
Translate 2 0 -1
Paraboloid 0.5 0 0.9 360
## A torus
Color 0 1 1
Translate 2 0 1
Torus .4 .15 0 360 360
## A disk
Color 0 1 0
Translate -2 0 3
Disk 0 .5 360
WorldEnd
表示は,下記のようになる