Rendering学習日記

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

NVIDIA Gelatoでレンダリング

次のサイトを参考にして、組んでみました。
横浜国立大学教育人間科学部マルチメディア文化課程の西村研究室参考
http://nishimulabo.edhs.ynu.ac.jp/~povray/beginner/p4-14.html
情報B:POV-Rayが教材になるか?
http://arashi50.cocolog-nifty.com/blog/2008/04/bpovray_8e8d.html

nishimura_pov.jpg

#nishimura_pov.pyg
from math import *

Output ("nishimura_pov.tif", "tiff", "rgb", "camera", "float gain", 1, "float gamma",
1, "string filter", "gaussian", "float[2] filterwidth", (2, 2))
Attribute ("float shadingquality",1.2)
Attribute ("string projection", "perspective")
Attribute ("float fov", 80)
Attribute ("int[2] resolution", (640, 480))
#placecam 0 6 -9 0 0 0
Rotate (-33.69, 1.00, 0.00, 0.00)
Translate (0.00, -6.00, 9.00)

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

World ()
Light ( "light0", "ambientlight", "float intensity", 0.2 )
Light ("light1", "pointlight", "float intensity", 1400, "point from", (-20, 20, -20),"string shadowname", "shadows")

PushTransform ()
Attribute ("color C", (0.2, 0.4, 0.75))
Sphere (100, -100, 100, 360)
PopTransform ()

PushTransform ()
Attribute ("color C", (1, 1, 1))
Shader ("surface", "metal", "string envname", "reflection",
"float Kd", 0.05, "float roughness", 0.1, "float Kr", 0.75,
"float Ka", 0.5,
# "float samples", 4, "float blur", 0.05,
"float twosided", 1
)
Sphere (2, -2, 2, 360)
PopTransform ()

T = -360
while (T <= 360):
PushTransform ()
Attribute ("color C", (0.001*T, 1-0.001*T, 0.8))
Shader ("surface", "plastic")
Rotate (T,0,1,0)
Translate (3.5,0.01*T,0)
Scale (1,0.5,3.5)
Input ("BoxGeom.rib")
PopTransform ()
T = T + 45


Translate (0, -5, 0)
Rotate (90.00, 1.00, 0.00, 0.00)
Scale (10,10,10)
ShaderGroupBegin ()
Attribute ("color C", (1, 1, 1))
Shader ("surface", "checker", "checklayer","float stilesize",0.01,"float ttilesize",0.01,"color color2", ( 0.6, 0.6, 1.0 ))
Shader ("surface", "plastic", "plasticlayer")
ConnectShaders ("checklayer", "Cout", "plasticlayer", "C")
ConnectShaders ("checklayer", "fout", "plasticlayer", "Ks")
ShaderGroupEnd ()
Input("PlaneGeom.rib")
Render()
  • -
  • -

これだけで大丈夫?「情報」におけるグラフィック1

以下、POV-Rayチュートリアルを参考にNVIDIA Gelatoでつくりました。
ありがとうございます。
これだけで大丈夫 「情報」におけるグラフィック
http://izumi-math.jp/sanae/cg/pov/pov.htm

【第1回】最初のシーンファイル
例題1 基本の3要素
立方体を作成せよ。
box_kore1.jpg

#box_kore1.pyg
Output ("box_kore01.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", 10)
Attribute ("int[2] resolution", (320, 240))
#placecam 0 0 -10 0 0 0
#Rotate (-19.47, 1.00, 0.00, 0.00)
#Rotate (45.00, 0.00, 1.00, 0.00)
Translate (0.00, 0.00, 10.00)
World ()
Light ("light1", "pointlight", "float intensity", 1000, "point from", (-10, 3, -20))

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

Render()
  • -
  • -

これだけで大丈夫?「情報」におけるグラフィック2

例題2 図形の変換(1) 回転
例題1の立方体を回転させよ。
box_kore2.jpg
回転した表示が微妙に違います。
rotate <-30,20,0>
X軸、Y軸の順番だと思いましたが、
クォータニオン、オイラー角など
少し厳密にやらないといけないかな。
ありがとうございます。
#box_kore2.pyg
Output ("box_kore02.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", 10)
Attribute ("int[2] resolution", (320, 240))
#placecam 0 0 -10 0 0 0
#Rotate (-19.47, 1.00, 0.00, 0.00)
#Rotate (45.00, 0.00, 1.00, 0.00)
Translate (0.00, 0.00, 10.00)
World ()
Light ("light1", "pointlight", "float intensity", 800, "point from", (-10, 3, -20))
Light ("light2", "pointlight", "float intensity", 350, "point from", (10, 10, -10))

PushTransform ()
Attribute ("color C", (1, 0, 0))
Shader ("surface", "plastic")
Rotate (20,0,1,0)
Rotate (-30,1,0,0)
Input ("BoxGeom.rib")
PopTransform ()

Render()
  • -
  • -
<< 8/10 >>