<< LightFlow 地面を加えて,様々な色の立方体を配置する 戻る LightFlow 円柱と円すいを表示する >>

LightFlow 地面をチェック模様にする

下記のようにマテリアルを変更追加しました。

check_ground=s.newPattern("check",["color",vector3( 0.1, 1.0, 0.1 ),"scale",0.025])

ground=s.newMaterial( "standard",[ "kc", check_ground,"kc",vector3( 1.0, 1.0, 1.0 ),"ka",check_ground ] ) #チェック緑

以下、サンプル。

#! /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( 1, 1, 0 ) ] )

check_ground=s.newPattern("check",["color",vector3( 0.1, 1.0, 0.1 ),"scale",0.025]) #チェック緑
ground=s.newMaterial( "standard",[ "kc", check_ground,"kc",vector3( 1.0, 1.0, 1.0 ),"ka",check_ground ] ) #チェックkc 1 1 1は白

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.transformBegin( transform().rotationAroundY( pi/7.0 ))
#s.transformBegin( transform().scaling( vector3(2,2,2)))
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.transformEnd()
s.materialEnd()

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", "my_box8.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 )

myb8.jpg
  • -
  • -

<< LightFlow 地面を加えて,様々な色の立方体を配置する 戻る LightFlow 円柱と円すいを表示する >>