ありがとうございます。
- -
- -
日々3DCGの世界は進歩しているけど、勉強して理解したことをまとめていきたい。RenderMan互換レンダラーやグローバル・イルミネーション。いろんなことに好奇心を持ち面白くなってくる。目指せShader書き!!
<< 3/3
#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()
#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()
#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()
#box_kore3.pyg
Output ("box_kore03.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", (320, 240))
#placecam 0 0 -10 0 0 0
Translate (0.00, 0.00, 10.00)
Attribute ("string geometryset", "+shadows")
World ()
Light ("light1", "pointlight", "float intensity", 800, "point from", (-10, 3, -20),"string shadowname", "shadows")
Light ("light2", "pointlight", "float intensity", 300, "point from", (10, 10, -10))
PushTransform ()
Attribute ("color C", (0.2, 0.4, 0.75))
Sphere (100, -100, 100, 360)
PopTransform ()
PushTransform ()
Attribute ("color C", (1, 0, 0))
Shader ("surface", "plastic")
Rotate (20,0,1,0)
Rotate (-30,1,0,0)
Input ("BoxGeom.rib")
PopTransform ()
PushTransform ()
Translate (0.00, -1.0, 0.00)
Rotate (90.00, 1.00, 0.00, 0.00)
ShaderGroupBegin ()
Attribute ("color C", (1, 1, 1))
Shader ("surface", "checker", "checklayer","float stilesize",0.05,"float ttilesize",0.05,"color color2", ( 0.0, 1, 0.0 ))
Shader ("surface", "plastic", "plasticlayer")
ConnectShaders ("checklayer", "Cout", "plasticlayer", "C")
ConnectShaders ("checklayer", "fout", "plasticlayer", "Ks")
ShaderGroupEnd ()
Input("PlaneGeom.rib")
PopTransform ()
Render()
#displace01.pyg
Output ("displace01.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))
#placecam 0 0 -10 0 0 0
Translate (0.00, 0.00, 8.00)
Rotate(-15,1,0,0)
Attribute ("string geometryset", "+shadows")
Attribute ("string geometryset", "+reflection")
World ()
Light ("light1", "pointlight", "float intensity", 1000, "point from", (-10, 3, -15),"string shadowname", "shadows")
Light ("light2", "pointlight", "float intensity", 300, "point from", (10, 10, -10))
PushTransform ()
Attribute ("color C", (0.2, 0.4, 0.75))
Sphere (100, -100, 100, 360)
PopTransform ()
PushTransform ()
Scale(3,3,3)
Translate (0.00, -1.0, 0.00)
Rotate (90.00, 1.00, 0.00, 0.00)
ShaderGroupBegin ()
Attribute ("color C", (1, 1, 1))
Shader ("surface", "checker", "checklayer","float stilesize",0.02,"float ttilesize",0.02,"color color2", ( 0.0, 1, 0.0 ))
Shader ("surface", "plastic", "plasticlayer")
ConnectShaders ("checklayer", "Cout", "plasticlayer", "C")
ConnectShaders ("checklayer", "fout", "plasticlayer", "Ks")
ShaderGroupEnd ()
Input("PlaneGeom.rib")
PopTransform ()
PushTransform ()
Attribute ("color C", (0.9, 0.9, 0.7))
Shader ( "surface", "metal","string envname","reflection" )
Shader ( "displacement", "dented", "float Km", 0.1 )
Attribute ("float displace:maxradius", 0.1)
PushAttributes ()
Translate ( 0, -2, 0 )
Rotate ( -90, 1, 0, 0 )
Input ("teapot.pyg")
PopAttributes ()
PopTransform ()
Render()
#test.pyg
Output ("test.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))
Input("cameralights.pyg")
Rotate (-10.14, 1, 0, 0)
Rotate (26.57, 0, 1, 0)
Translate (-5, -2, 10)
World ()
Attribute ("color C", (0.8, 1, 0.8))
Input("backplane.pyg")
PushTransform()
Attribute ("color C", (1, 0, 0))
Shader ("surface", "plastic")
Translate(-2,-1,0)
Rotate(-90,1,0,0)
Input("teapot.pyg")
PopTransform()
PushTransform()
Attribute ("color C", (1, 1, 1))
Shader ("surface", "clay")
Translate(2,-1,0)
Input("cube.pyg")
PopTransform()
Render()
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
#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()
# 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 ()
<< 3/3