<< Lightflow チェック模様 その1 戻る Lightflow 立方体回転 >>

Lightflow チェック模様 その2

地面のチェックの色を好きな色に変更できます。
MatSpiderでスクリプトを出力して書き換えました。

box_ground2.jpg


#! /usr/bin/env python
from lightflowPM import *
from math import *

s = scene()

s.lightOn( s.newLight( "point", [ "position", vector3( 5.0, -5.0, 4.0 ), "color", vector3( 300.0, 300.0, 300.0 ) ] ) )

s.lightOn( s.newLight( "ambient", [ "color", vector3( 0.3, 0.3, 0.3 ) ] ) ) #環境光を加える。

plastic = s.newMaterial( "standard",[ "kc", vector3( 1, 0, 0 ) ] ) #赤

plastic2 = s.newMaterial( "standard",[ "kc", vector3( 0, 1, 0 ) ] ) #緑

plastic3 = s.newMaterial( "standard",[ "kc", vector3( 0, 0, 1 ) ] ) #青

#ground=s.newMaterial( "standard",[ "kc", vector3( 1, 1, 1 ) ] ) #白

#Pattern2
scale01 = 0.02500
Pattern1 = s.newPattern("check",[ "scale" , scale01 ])

color01 = vector3( 0.200 , 0.400 , 0.600) #青
color02 = vector3(1.00, 0.58, 0.59) #ピンク

Pattern2 = s.newPattern("gradient",[
"pattern" , Pattern1 ,
"color" , 1.00000 , color01 , color02 ])

ground = s.newMaterial("diffuse",[ "kr" , Pattern2 ])


s.materialBegin( plastic )
s.addObject( s.newObject( "box", [ "position",vector3( -1.0, -1.0, -1.0 ),vector3( 1.0, 1.0, 1.0 )] ) )
s.materialEnd()


s.materialBegin( plastic2 )
s.transformBegin( transform().translation( vector3(-3.0,0,0)))

s.addObject( s.newObject( "box", [ "position",vector3( -1.0, -1.0, -1.0 ),vector3( 1.0, 1.0, 1.0 )] ) )

s.transformEnd()
s.materialEnd()


s.materialBegin( plastic3 )
s.transformBegin( transform().translation( vector3(3.0,0,0)))
s.transformBegin( transform().rotationAroundZ( pi/4 ))

s.addObject( s.newObject( "box", [ "position",vector3( -1.0, -1.0, -1.0 ),vector3( 1.0, 1.0, 1.0 )] ) )

s.transformEnd()
s.transformEnd()
s.materialEnd()


#白色の地面groundをpatchで作成しています。高さ(z軸)を-1.0にしてぴったり立方体とあわせています。
s.materialBegin( ground )

s.addObject( s.newObject( "patch", [ "points",vector3( -50, -50, -1.0 ),vector3( -50, 50, -1.0 ),vector3( 50, -50, -1.0 ),vector3( 50, 50, -1.0 )] ) )

s.materialEnd()

saver = s.newImager( "tga-saver", [ "file", "box_ground2.tga" ] )

s.imagerBegin( saver )

camera = s.newCamera( "pinhole", [ "eye", vector3( 0, -10, 5 ), "aim", vector3( 0, 0, 0 ) ] )

s.imagerEnd()

s.render( camera, 300, 300 )

  • -
  • -

<< Lightflow チェック模様 その1 戻る Lightflow 立方体回転 >>