日本語マニュアルをちょっと手直しさせていただきました。
ありがとうございます。
■日本語マニュアル チュートリアルです。
http://rman.sakura.ne.jp/sfx/lf_man/index.html
>
#! /usr/bin/env python
from lightflowPM import *
s = scene()
s.lightOn( s.newLight( "ambient", [ "color", vector3( 0.5, 0.5, 0.5 ) ] ) )
s.lightOn( s.newLight( "soft", [ "position", vector3( 5.0, -5.0, 4.0 ),
"color", vector3( 200.0, 200.0, 200.0 ) ] ) )
plastic = s.newMaterial( "standard",
[ "kc", vector3( 1, 1, 1 ),
"kr", vector3( 0.2, 0.2, 0.2 ),
"kd", 0.5, "km", 0.1 ] )
wood = s.newPattern( "wood",
[ "color",
1.0, vector3( 1.0, 0.85, 0.7 ), vector3( 1.0, 0.85, 0.7 ),
0.0, vector3( 0.8, 0.60, 0.4 ), vector3( 0.8, 0.60, 0.4 ),
"scale", 0.15,
"turbulence.amount", 0.5,
"turbulence.frequency", 2.0,
"turbulence.octaves", 1 ] )
mat_wood = s.newMaterial( "standard",
[ "kc", vector3( 0.8, 0.8, 0.8 ),
"kd", 0.7,
"km", 0.1,
"kc", wood ] )
sky = s.newMaterial( "matte", [ "kc", vector3( 0.2, 0.4, 1.0 ) ] )
blotchy = s.newPattern( "multifractal",
[ "color",
0.0, vector3(0.1, 0.1, 0.1), vector3(0.1, 0.1, 0.1),
1.0, vector3(1.0, 1.0, 1.0), vector3(1.0, 1.0, 1.0),
"basis", "sin",
"scale", 8.0,
"turbulence.omega", 0.3, 0.6,
"turbulence.octaves", 2] )
envmap = s.newPattern( "envmap",
[ "pattern", blotchy,
"center", vector3( 0, 0, 0 ),
"radius", 10.0,
"reflection", vector3( 0.8, 1.0, 0.9 ),
"refraction", vector3( 0.1, 1.0, 0.4 ),
"IOR", 1.67,
"fresnel", 1, 0.1, 0.1 ] )
glass = s.newMaterial( "generic",
[ "fresnel", 1,0.16,0.0,
"IOR", 1.67,
"kdr", vector3( 0, 0, 0 ),
"kdt", vector3( 0, 0, 0 ),
"ksr", vector3( 0.8, 1.0, 0.9 ), vector3( 0.4, 1, 1 ),
"ka", vector3( 1, 1, 1 ),
"kt",vector3(0.4,0.4,0.4),
"ka", envmap,
"km", 0.1,
"shinyness", 0.85,
"radiosity", 1 ] )
#4つの箱を回転重ねて配置
s.materialBegin( glass )
s.addObject( s.newObject( "box", [ "position", vector3(-2, -2, -2), vector3(2, 2, 2) ] ) )
s.materialEnd()
s.materialBegin( glass )
s.transformBegin( transform().rotationAroundX( -3.141592 / 4 ) )
s.addObject( s.newObject( "box", [ "position", vector3(-2, -2, -2), vector3(2, 2, 2) ] ) )
s.transformEnd()
s.transformBegin( transform().rotationAroundZ( -3.141592 / 4 ) )
s.addObject( s.newObject( "box", [ "position", vector3(-2, -2, -2), vector3(2, 2, 2) ] ) )
s.transformEnd()
s.transformBegin( transform().rotationAroundY( -3.141592 / 4 ) )
s.addObject( s.newObject( "box", [ "position", vector3(-2, -2, -2), vector3(2, 2, 2) ] ) )
s.transformEnd()
s.materialEnd()
s.materialBegin( plastic ) #地面
s.transformBegin( transform().translation( vector3( 0.0, 0.0, -3 ) ) )
s.addObject( s.newObject( "disc", [ "radius", 100.0 ] ) )
s.transformEnd()
s.materialEnd()
s.materialBegin( sky ) #球体の空
s.addObject( s.newObject( "sphere", [ "radius", 200.0 ] ) )
s.materialEnd()
saver = s.newImager( "tga-saver", [ "file", "glassbox.tga" ] )
s.imagerBegin( saver )
camera = s.newCamera( "pinhole", [ "eye", vector3( -2, -8, 5 ),
"aim", vector3( 0, 0, 0 ),
#"aa-samples", 1,2
] )
s.imagerEnd()
s.radiosity()
s.render( camera, 480, 480 )
- -
- -