LightFlowのファイルもPythonだから、注意しなくてはならない。
エディタで開いて、まったく見た目は同じファイルでも動かないことがありました。
原因は、改行コードがMacintoshになっていたこと。
エディタで別名で保存で、Windowsの改行コードにして保存しなおした。
ダウンロードしたサンプルファイルできました。
ありがとうございます。
#!/usr/bin/python
# Created by PyLightflow export Plug-in for Shade version 1.0
from lightflowPM import *
s = scene()
s.lightOn( s.newLight("directional",["direction",vector3(-0.691714,-0.691714,-0.207514),"color",vector3(1.000000,1.000000,1.000000)]))
s.lightOn( s.newLight("ambient",["color",vector3(0.200000,0.200000,0.200000)]))
# Default Surface
def default(r=1.0,g=1.0,b=1.0):
return
s.newMaterial("standard",["ka",vector3(0.010000,0.010000,0.010000),
"kc",vector3( r+0.1, g+0.1, b+0.1),
"kr",vector3( 0.0, 0.0, 0.0 ),
"kt",vector3( 0.0, 0.0, 0.0 ),
"kd", 0.7,
"km", 0.03,
"shinyness", 1.0,])
# Master Surface
#BEGIN Part_N0
s.materialBegin( s.newMaterial("standard",["ka",vector3(0.010000,0.010000,0.010000),
"kc",vector3(1.000000,1.000000,1.000000),
"kd",0.800000,
"kr",vector3(0.000000,0.000000,0.000000),
"kt",vector3(0.000000,0.000000,0.000000),
"kb",0.000000,
"km",0.020000,
"shinyness",1.000000,]) )
#BEGIN Sphere_N1
s.transformBegin(transform().scaling(vector3(200.000000,200.000000,200.000000)))
s.materialBegin( s.newMaterial("standard",["ka",vector3(0.010000,0.010000,0.010000),
"kc",vector3(1.000000,1.000000,1.000000),
"kd",0.800000,
"kr",vector3(0.000000,0.000000,0.000000),
"kt",vector3(0.000000,0.000000,0.000000),
"kb",0.000000,
"km",0.020000,
"shinyness",1.000000,]))
Sphere_N1 = s.newObject("sphere",["radius",1.0])
s.materialEnd()
s.transformEnd()
#END Sphere_N1
#BEGIN Sphere_N2
s.transformBegin(transform().translation(vector3(0.000000,0.000000,-1000.000000)))
s.transformBegin(transform().scaling(vector3(200.000000,200.000000,200.000000)))
s.materialBegin( s.newMaterial("standard",[
"ka",vector3(0.010000,0.010000,0.010000),
"kc",vector3(1.000000,1.000000,1.000000),
"kd",0.800000,
"kr",vector3(0.000000,0.000000,0.000000),
"kt",vector3(0.000000,0.000000,0.000000),
"kb",0.000000,
"km",0.020000,
"shinyness",1.000000,
]) )
Sphere_N2 = s.newObject("sphere",["radius",1.0])
s.materialEnd()
s.transformEnd()
s.transformEnd()
#END Sphere_N2
#BEGIN Sphere_N3
s.transformBegin(transform().translation(vector3(0.000000,0.000000,-500.000000)))
s.transformBegin(transform().scaling(vector3(200.000000,200.000000,200.000000)))
s.materialBegin( s.newMaterial("standard",[
"ka",vector3(0.010000,0.010000,0.010000),
"kc",vector3(1.000000,1.000000,1.000000),
"kd",0.800000,
"kr",vector3(0.000000,0.000000,0.000000),
"kt",vector3(0.000000,0.000000,0.000000),
"kb",0.000000,
"km",0.020000,
"shinyness",1.000000,
]) )
Sphere_N3 = s.newObject("sphere",["radius",1.0])
s.materialEnd()
s.transformEnd()
s.transformEnd()
#END Sphere_N3
#BEGIN Sphere_N4
s.transformBegin(transform().translation(vector3(0.000000,0.000000,500.000000)))
s.transformBegin(transform().scaling(vector3(200.000000,200.000000,200.000000)))
s.materialBegin( s.newMaterial("standard",[
"ka",vector3(0.010000,0.010000,0.010000),
"kc",vector3(1.000000,1.000000,1.000000),
"kd",0.800000,
"kr",vector3(0.000000,0.000000,0.000000),
"kt",vector3(0.000000,0.000000,0.000000),
"kb",0.000000,
"km",0.020000,
"shinyness",1.000000,
]) )
Sphere_N4 = s.newObject("sphere",["radius",1.0])
s.materialEnd()
s.transformEnd()
s.transformEnd()
#END Sphere_N4
#BEGIN Sphere_N5
s.transformBegin(transform().translation(vector3(0.000000,0.000000,1000.000000)))
s.transformBegin(transform().scaling(vector3(200.000000,200.000000,200.000000)))
s.materialBegin( s.newMaterial("standard",[
"ka",vector3(0.010000,0.010000,0.010000),
"kc",vector3(1.000000,1.000000,1.000000),
"kd",0.800000,
"kr",vector3(0.000000,0.000000,0.000000),
"kt",vector3(0.000000,0.000000,0.000000),
"kb",0.000000,
"km",0.020000,
"shinyness",1.000000,
]) )
Sphere_N5 = s.newObject("sphere",["radius",1.0])
s.materialEnd()
s.transformEnd()
s.transformEnd()
#END Sphere_N5
s.materialEnd()
Part_N0 = s.newObject("boundary",["surfaces",
Sphere_N5,
Sphere_N4,
Sphere_N3,
Sphere_N2,
Sphere_N1,
])
#END Part_N0
#ADD OBJECT
s.addObject( Part_N0 )
s.newInterface("default",[
"shadows",0,
"trace-depth",5,
"lighting-depth",5,
])
saver = s.newImager("tga-saver",["file","focus.tga"])
s.imagerBegin(saver)
camera = s.newCamera("pinhole", [
"eye",vector3(1111.725464,10.746529,2006.758911),
"aim",vector3(69.891151,2.468822,586.831482),
"up",vector3(0.000000,1.000000,0.000000),
"aspect",1.000000,
"aperture",200.000000,
"aa-samples",3,5,
"fov",0.356186,
])
s.imagerEnd()
print "image size 200x100"
s.render( camera,400, 200)
# END
- -
- -