1/1

最初のNVIDIA Gelatoその1

最初は簡単な球を表示してみましょう。

コマンドプロンプトから、下記のように打つとレンダリングか始まる。
>gelato -iv my_first.pyg


#my_first.pyg
Output ("my_first01.tif", "tiff", "rgb", "camera", "float gain", 1, "float gamma",
1, "string filter", "gaussian", "float[2] filterwidth", (2, 2))
Attribute ("string projection", "perspective")
Attribute ("float fov", 45)
Attribute ("int[2] resolution", (640, 480))
Light ("light1", "ambientlight", "float intensity", 0.1)
Light ("light2", "distantlight", "point from", (1, 1, -1), "point to", (0, 0, 0)
, "float intensity", 1.5)
Translate (0, 0, 10)
World ()
Attribute ("color C", (1, 0, 0))
Shader ("surface", "plastic")
Sphere (3, -3, 3, 360)
Render()

my_first01.jpg
  • -
  • -

最初のNVIDIA Gelatoその2

>gelato -iv -threads 4 my_first2.pyg
クアッドCPUで4スレッド使用してレンダリング速い!!
2つの球体をちょっと移動して配置する。
#my_first2.pyg
Output ("my_first02.tif", "tiff", "rgb", "camera", "float gain", 1, "float gamma", 1, "string filter", "gaussian", "float[2] filterwidth", (2, 2))
Attribute ("string projection", "perspective")
Attribute ("float fov", 45)
Attribute ("int[2] resolution", (640, 480))
Light ("light1", "ambientlight", "float intensity", 0.1)
Light ("light2", "distantlight", "point from", (1, 1, -1), "point to", (0, 0, 0)
, "float intensity", 1.5)
Translate (0, 0, 5)
World ()

PushTransform ()
Attribute ("color C", (1, 0, 0))
#Shader ( "surface", "metal","string envname","reflection" )
Shader ("surface", "plastic")
Translate ( 1.2, 0, 0)
Sphere (1, -1, 1, 360)
PopTransform ()

PushTransform ()
Attribute ("color C", (0, 0, 1))
Shader ("surface", "plastic")
Translate ( -1.2, 0, 0)
Sphere (1, -1, 1, 360)
PopTransform ()

Render()


my_first02.jpg
  • -
  • -

NVIDIA GelatoへのReadArchive

Ribelato-1.0.0.24.win.zipをダウンロードし、
libフォルダにrib.generator.dllを入れておくと、

たとえば、立方体
Patch "bilinear" "P" [-0.5 0.5 -0.5 0.5 0.5 -0.5 -0.5 -0.5 -0.5 0.5 -0.5 -0.5]
Patch "bilinear" "P" [-0.5 -0.5 -0.5 0.5 -0.5 -0.5 -0.5 -0.5 0.5 0.5 -0.5 0.5]
Patch "bilinear" "P" [-0.5 0.5 -0.5 -0.5 -0.5 -0.5 -0.5 0.5 0.5 -0.5 -0.5 0.5]
Patch "bilinear" "P" [0.5 0.5 -0.5 -0.5 0.5 -0.5 0.5 0.5 0.5 -0.5 0.5 0.5]
Patch "bilinear" "P" [0.5 -0.5 -0.5 0.5 0.5 -0.5 0.5 -0.5 0.5 0.5 0.5 0.5]
Patch "bilinear" "P" [-0.5 -0.5 0.5 0.5 -0.5 0.5 -0.5 0.5 0.5 0.5 0.5 0.5]

以上をたとえばBoxGeom.ribという名前で保存しておく。
呼び出し方は、同じディレクトリに置いて、
Input ("BoxGeom.rib")
で良い。

同じく、平面は
Patch "bilinear" "P" [-5.0 -5.0 0.0 5.0 -5.0 0.0 -5.0 5.0 0.0 5.0 5.0 0.0]

以上をたとえばPlaneGeom.ribで保存しておく。
呼び出し方は、同じディレクトリに置いて、
Input("PlaneGeom.rib")
で良い。
  • -
  • -

BOXを表示する。その1

RIBを呼び出す形で、以下のように記述する。
なお、カメラ位置は、placecam.exeを使って算出。10,5,-10から原点を見ている。
#box0.pyg
Output ("box01.tif", "tiff", "rgb", "camera", "float gain", 1, "float gamma",
1, "string filter", "gaussian", "float[2] filterwidth", (2, 2))
Attribute ("string projection", "perspective")
Attribute ("float fov", 20)
Attribute ("int[2] resolution", (640, 480))
#placecam 10 5 -10 0 0 0
Rotate (-19.47, 1.00, 0.00, 0.00)
Rotate (45.00, 0.00, 1.00, 0.00)
Translate (-10.00, -5.00, 10.00)
World ()
Light ("light1", "pointlight", "float intensity", 350, "point from", (-10, 10, -10))
Light ("light2", "pointlight", "float intensity", 350, "point from", (10, 10, -10))

PushTransform ()
Attribute ("color C", (1, 1, 0))
Shader ("surface", "plastic")
Translate ( 0, 0.5, 0)
Input ("BoxGeom.rib")
PopTransform ()

Attribute ("color C", (1, 1, 1))
Shader ("surface", "plastic")
Rotate (90.00, 1.00, 0.00, 0.00)
Input("PlaneGeom.rib")
Render()

box0.jpg
  • -
  • -

1/1