Rendering学習日記

日々、3DCGの世界は進歩しています。勉強して理解したことをまとめていきます。RenderMan互換レンダラーやグローバル・イルミネーション。いろんなことに好奇心を持って、面白くなる。目指せShader書き!!
ありがとうございます。

MayaからRIB出力した基本図形

Gelatoでは、デフォルトで持っている基本図形は球体だけ。後はInputフォルダにあるティーポットなどのアーカイブのみ。
primitive.jpg
ということで、MayaのデフォルトのNurbsサーフェイスをrib exportしてみた。まず、注意しなければならないのは、そのままではつかえないこと。
WorldBegin〜EndやObjectBeginステートメント、Perspectiveなどはすべて削除。オブジェクトのみ。Nupatchだけにした。当然、原点で作成している。たとえば、円錐Coneは、次のようになる。
ファイル名はcone.ribとした。なお、gelatoでribを読み込むには
RMRからlibをダウンロードする必要がある。
NuPatch 11 4 [-2 -2 -1
0 1 2 3 4 5 6 7 8 9 10 10] 0 8 4 4 [0 0 0 0 2.23607 2.23607 2.23607 2.23607] 0 2.23607 "Pw" [0.783612 -1 -0.783612 1 1.10819 -1 6.51994e-017 1
0.783612 -1 0.783612 1 3.21127e-016 -1 1.10819 1 -0.783612 -1 0.783612 1
-1.10819 -1 2.72688e-016 1 -0.783612 -1 -0.783612 1 -5.95213e-016 -1 -1.10819 1
0.783612 -1 -0.783612 1 1.10819 -1 6.51994e-017 1 0.783612 -1 0.783612 1
0.522408 -0.333333 -0.522408 1 0.738796 -0.333333 6.3877e-017 1 0.522408 -0.333333 0.522408 1
2.14085e-016 -0.333333 0.738796 1 -0.522408 -0.333333 0.522408 1 -0.738796 -0.333333 2.02203e-016 1
-0.522408 -0.333333 -0.522408 1 -3.96809e-016 -0.333333 -0.738796 1 0.522408 -0.333333 -0.522408 1
0.738796 -0.333333 6.3877e-017 1 0.522408 -0.333333 0.522408 1 0.261204 0.333333 -0.261204 1
0.369398 0.333333 6.25547e-017 1 0.261204 0.333333 0.261204 1 1.07042e-016 0.333333 0.369398 1
-0.261204 0.333333 0.261204 1 -0.369398 0.333333 1.31718e-016 1 -0.261204 0.333333 -0.261204 1
-1.98404e-016 0.333333 -0.369398 1 0.261204 0.333333 -0.261204 1 0.369398 0.333333 6.25547e-017 1
0.261204 0.333333 0.261204 1 0 1 6.12323e-017 1 0 1 6.12323e-017 1
0 1 6.12323e-017 1 0 1 6.12323e-017 1 0 1 6.12323e-017 1
0 1 6.12323e-017 1 0 1 6.12323e-017 1 0 1 6.12323e-017 1
0 1 6.12323e-017 1 0 1 6.12323e-017 1 0 1 6.12323e-017 1]

NuPatch 11 4 [-2 -2 -1
0 1 2 3 4 5 6 7 8 9 10 10] 0 8 4 4 [0 0 0 0 2.23607 2.23607 2.23607 2.23607] 0 2.23607 "Pw" [0.783612 -1 -0.783612 1 1.10819 -1 6.51994e-017 1
0.783612 -1 0.783612 1 3.21127e-016 -1 1.10819 1 -0.783612 -1 0.783612 1
-1.10819 -1 2.72688e-016 1 -0.783612 -1 -0.783612 1 -5.95213e-016 -1 -1.10819 1
0.783612 -1 -0.783612 1 1.10819 -1 6.51994e-017 1 0.783612 -1 0.783612 1
0.522408 -0.333333 -0.522408 1 0.738796 -0.333333 6.3877e-017 1 0.522408 -0.333333 0.522408 1
2.14085e-016 -0.333333 0.738796 1 -0.522408 -0.333333 0.522408 1 -0.738796 -0.333333 2.02203e-016 1
-0.522408 -0.333333 -0.522408 1 -3.96809e-016 -0.333333 -0.738796 1 0.522408 -0.333333 -0.522408 1
0.738796 -0.333333 6.3877e-017 1 0.522408 -0.333333 0.522408 1 0.261204 0.333333 -0.261204 1
0.369398 0.333333 6.25547e-017 1 0.261204 0.333333 0.261204 1 1.07042e-016 0.333333 0.369398 1
-0.261204 0.333333 0.261204 1 -0.369398 0.333333 1.31718e-016 1 -0.261204 0.333333 -0.261204 1
-1.98404e-016 0.333333 -0.369398 1 0.261204 0.333333 -0.261204 1 0.369398 0.333333 6.25547e-017 1
0.261204 0.333333 0.261204 1 0 1 6.12323e-017 1 0 1 6.12323e-017 1
0 1 6.12323e-017 1 0 1 6.12323e-017 1 0 1 6.12323e-017 1
0 1 6.12323e-017 1 0 1 6.12323e-017 1 0 1 6.12323e-017 1
0 1 6.12323e-017 1 0 1 6.12323e-017 1 0 1 6.12323e-017 1]

NuPatch 11 4 [-2 -2 -1
0 1 2 3 4 5 6 7 8 9 10 10] 0 8 4 4 [0 0 0 0 1 1 1 1] 0 1 "Pw" [0 -1 0 1 0 -1 0 1
0 -1 0 1 0 -1 0 1 0 -1 0 1
0 -1 0 1 0 -1 0 1 0 -1 0 1
0 -1 0 1 0 -1 0 1 0 -1 0 1
0.261204 -1 -0.261204 1 0.369398 -1 -9.12038e-018 1 0.261204 -1 0.261204 1
1.58307e-016 -1 0.369398 1 -0.261204 -1 0.261204 1 -0.369398 -1 1.62571e-016 1
-0.261204 -1 -0.261204 1 -2.49669e-016 -1 -0.369398 1 0.261204 -1 -0.261204 1
0.369398 -1 -9.12038e-018 1 0.261204 -1 0.261204 1 0.522408 -1 -0.522408 1
0.738796 -1 -1.82408e-017 1 0.522408 -1 0.522408 1 3.16613e-016 -1 0.738796 1
-0.522408 -1 0.522408 1 -0.738796 -1 3.25142e-016 1 -0.522408 -1 -0.522408 1
-4.99337e-016 -1 -0.738796 1 0.522408 -1 -0.522408 1 0.738796 -1 -1.82408e-017 1
0.522408 -1 0.522408 1 0.783612 -1 -0.783612 1 1.10819 -1 -2.73611e-017 1
0.783612 -1 0.783612 1 4.7492e-016 -1 1.10819 1 -0.783612 -1 0.783612 1
-1.10819 -1 4.87713e-016 1 -0.783612 -1 -0.783612 1 -7.49006e-016 -1 -1.10819 1
0.783612 -1 -0.783612 1 1.10819 -1 -2.73611e-017 1 0.783612 -1 0.783612 1]

NuPatch 11 4 [-2 -2 -1
0 1 2 3 4 5 6 7 8 9 10 10] 0 8 4 4 [0 0 0 0 1 1 1 1] 0 1 "Pw" [0 -1 0 1 0 -1 0 1
0 -1 0 1 0 -1 0 1 0 -1 0 1
0 -1 0 1 0 -1 0 1 0 -1 0 1
0 -1 0 1 0 -1 0 1 0 -1 0 1
0.261204 -1 -0.261204 1 0.369398 -1 -9.12038e-018 1 0.261204 -1 0.261204 1
1.58307e-016 -1 0.369398 1 -0.261204 -1 0.261204 1 -0.369398 -1 1.62571e-016 1
-0.261204 -1 -0.261204 1 -2.49669e-016 -1 -0.369398 1 0.261204 -1 -0.261204 1
0.369398 -1 -9.12038e-018 1 0.261204 -1 0.261204 1 0.522408 -1 -0.522408 1
0.738796 -1 -1.82408e-017 1 0.522408 -1 0.522408 1 3.16613e-016 -1 0.738796 1
-0.522408 -1 0.522408 1 -0.738796 -1 3.25142e-016 1 -0.522408 -1 -0.522408 1
-4.99337e-016 -1 -0.738796 1 0.522408 -1 -0.522408 1 0.738796 -1 -1.82408e-017 1
0.522408 -1 0.522408 1 0.783612 -1 -0.783612 1 1.10819 -1 -2.73611e-017 1
0.783612 -1 0.783612 1 4.7492e-016 -1 1.10819 1 -0.783612 -1 0.783612 1
-1.10819 -1 4.87713e-016 1 -0.783612 -1 -0.783612 1 -7.49006e-016 -1 -1.10819 1
0.783612 -1 -0.783612 1 1.10819 -1 -2.73611e-017 1 0.783612 -1 0.783612 1]


以下は、上記の画像をつくるために配置したpygです。
#primitive.pyg
Output ("primitive.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)

Attribute ("string geometryset", "+shadows")

World ()
Light ("light1", "pointlight", "float intensity", 350, "point from", (-10, 10, -10),"string shadowname", "shadows")
Light ("light2", "pointlight", "float intensity", 350, "point from", (10, 10, -10),"string shadowname", "shadows")

Attribute ("color C", (0.8, 1, 0.8))
Input("backplane.pyg")

PushTransform ()
Attribute ("color C", (0.2, 0.9, 0.2))
Shader ("surface", "clay")
Translate ( 2, 1.1, 0)
Input ("cone.rib")
PopTransform ()

PushTransform ()
Attribute ("color C", (0.9, 0.9, 0.9))
Shader ("surface", "veinedmarble")
Translate ( -2, 1.1, 0)
Input ("cyl.rib")
PopTransform ()

PushTransform ()
Attribute ("color C", (0.9, 0.5, 0.5))
Shader ("surface", "plastic")
Translate ( 1, 0.5, -3)
Input ("torus.rib")
PopTransform ()

Scale (2,2,2)
#Rotate (90.00, 0.00, 1.00, 0.00)
Rotate (90.00, 1.00, 0.00, 0.00)
Attribute ("color C", (1, 1, 1))
Shader ("surface", "oakplank","float Km", 1)
Input("PlaneGeom.rib")

Render()
  • -
  • -

NVIDIA Gelatoで影表示

復習の意味で、pygをいじってみる。
# sphere_test2.pyg

PushTransform ()
Scale(1, 1, -1)
Rotate (30, 1, 0, 0)
Rotate (5, 0, 1, 0)
Translate (0, 0, -20)
Camera ("main", "int[2] resolution", (640, 480), "string projection", "perspective", "float fov", 45)
PopTransform ()

Output ("sphere_test.tif", "tiff", "rgb", "main", "float gain", 1, "float gamma", 1, "string filter", "gaussian", "float[2] filterwidth", (2, 2))


Attribute ("string geometryset", "+shadows")

Light ("light1", "ambientlight", "float intensity", 0.1)
Light ("light2", "pointlight", "point from", (10, 10, -10), "float intensity", 800, "string shadowname" ,"shadows")
#Light ("light2", "distantlight", "point from", (1, 1, -1), "point to", (0, 0, 0), "float intensity", 1.2, "string shadowname" ,"shadows")

World ()

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

PushAttributes ()
Attribute ("color C", (1, 1, 1))
Shader ("surface", "matte")
PushTransform ()
Scale (100, 0.5, 100)
PushTransform ()
Scale (1, 1, 1)
Patch ("linear", 2, 2, "vertex point 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))
Rotate (90, 0, 0, 1)
Patch ("linear", 2, 2, "vertex point 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))
Rotate (90, 0, 0, 1)
Patch ("linear", 2, 2, "vertex point 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))
Rotate (90, 0, 0, 1)
Patch ("linear", 2, 2, "vertex point 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))
Rotate (90, 0, 1, 0)
Patch ("linear", 2, 2, "vertex point 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))
Rotate (180, 0, 1, 0)
Patch ("linear", 2, 2, "vertex point 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))
PopTransform ()
PopTransform ()
PopAttributes ()

Render ()



sphere_test.jpg

いろいろと試してみることが大切です。
ありがとうございます。
  • -
  • -

NVIDIA Gelato 2.2 Mango User's Guide 日本語翻訳

Gelato 2.2 Mango User's Guide 日本語翻訳のURL
貼ります。
ありがとうございます。
Maya2008以降は、対応しておりませんが・・・

http://www20.atwiki.jp/e1-605265/
  • -
  • -
<< 10/10