<< 5/5

球体の質感1

球体の質感について調整する。
基本質感。
sphere_glass01.jpg

以下はサンプルファイル参考にしてください。

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

s = scene()

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

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

plastic = s.newMaterial( "standard",[ "kc", vector3( 0.6, 0.6, 0.6 ),"kd", 0.33 ] )

plastic2 = s.newMaterial( "standard",[ "kc", vector3( 0.6, 0.6, 0.6 ),"kd", 0.33 ] )

plastic3 = s.newMaterial( "standard",[ "kc", vector3( 0.6, 0.6, 0.6 ),"kd", 0.33 ] )

check_ground=s.newPattern("check",["color",vector3( 0.2, 0.4, 0.6),"scale",0.025])

ground=s.newMaterial( "standard",[ "kc", check_ground,"kc",vector3( 1.0, 1.0, 1.0 ),"ka",check_ground ] )

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


s.materialBegin( plastic )
s.addObject( s.newObject( "sphere", [ "radius",1.4] ) )
s.materialEnd()


#地面groundをpatchで作成しています。高さ(z軸)を-1.4にしてぴったり球とあわせています。
s.materialBegin( ground )

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

s.materialEnd()

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

s.imagerBegin( saver )

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

s.imagerEnd()

s.render( camera, 512, 300 )

  • -
  • -

球体の質感2

映り込みの設定
"kr",vector3(0.4,0.4,0.4)
sphere_glass02.jpg

以下のサンプルファイルを参考にしてください。

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

s = scene()

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

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

plastic = s.newMaterial( "standard",[ "kc", vector3( 0.6, 0.6, 0.6 ),"kd", 0.33 ,"kr",vector3(0.4,0.4,0.4)] )

plastic2 = s.newMaterial( "standard",[ "kc", vector3( 0.6, 0.6, 0.6 ),"kd", 0.33 ] )

plastic3 = s.newMaterial( "standard",[ "kc", vector3( 0.6, 0.6, 0.6 ),"kd", 0.33 ] )

check_ground=s.newPattern("check",["color",vector3( 0.2, 0.4, 0.6),"scale",0.025])

ground=s.newMaterial( "standard",[ "kc", check_ground,"kc",vector3( 1.0, 1.0, 1.0 ),"ka",check_ground ] )

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


s.materialBegin( plastic )
s.addObject( s.newObject( "sphere", [ "radius",1.4] ) )
s.materialEnd()


#地面groundをpatchで作成しています。高さ(z軸)を-1.4にしてぴったり球とあわせています。
s.materialBegin( ground )

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

s.materialEnd()

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

s.imagerBegin( saver )

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

s.imagerEnd()

s.render( camera, 512, 300 )

  • -
  • -

球体の質感3

透明度を加える。
plastic = s.newMaterial( "standard",[ "kc", vector3( 0.2, 0.2, 0.2 ),"kd", 0.01 ,"kr",vector3(0.2,0.2,0.2),"kt",vector3(0.8,0.8,0.8),"IOR",1.12] )

sphere_glass03.jpg

以下のサンプルファイルを参考にしてください。

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

s = scene()

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

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

plastic = s.newMaterial( "standard",[ "kc", vector3( 0.2, 0.2, 0.2 ),"kd", 0.01 ,"kr",vector3(0.2,0.2,0.2),"kt",vector3(0.8,0.8,0.8),"IOR",1.12] )

plastic2 = s.newMaterial( "standard",[ "kc", vector3( 0.6, 0.6, 0.6 ),"kd", 0.33 ] )

plastic3 = s.newMaterial( "standard",[ "kc", vector3( 0.6, 0.6, 0.6 ),"kd", 0.33 ] )

check_ground=s.newPattern("check",["color",vector3( 0.2, 0.4, 0.6),"scale",0.025])

ground=s.newMaterial( "standard",[ "kc", check_ground,"kc",vector3( 1.0, 1.0, 1.0 ),"ka",check_ground ] )

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


s.materialBegin( plastic )
s.addObject( s.newObject( "sphere", [ "radius",1.4] ) )
s.materialEnd()


#地面groundをpatchで作成しています。高さ(z軸)を-1.4にしてぴったり球とあわせています。
s.materialBegin( ground )

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

s.materialEnd()

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

s.imagerBegin( saver )

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

s.imagerEnd()

s.render( camera, 512, 300 )

  • -
  • -

球体の質感4

コースティクス(集光模様)を入れるためにラジオシティのスイッチを入れる。記述の最後の行のひとつ上に
s.radiosity()
を加える。
質感は以下のように設定した。屈折率を調整すると面白い。
plastic = s.newMaterial( "standard",[ "kc", vector3( 0.2, 0.2, 0.2 ),"kd", 0.01 ,"kr",vector3(0.2,0.2,0.2),"kt",vector3(0.8,0.8,0.8),"IOR",1.26,"caustics", 4, 4] )


sphere_glass04.jpg

#! /usr/bin/env python

from lightflowPM import *

from math import *

s = scene()

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

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

plastic = s.newMaterial( "standard",[ "kc", vector3( 0.2, 0.2, 0.2 ),"kd", 0.01 ,"kr",vector3(0.2,0.2,0.2),"kt",vector3(0.8,0.8,0.8),"IOR",1.26,"caustics", 4, 4] )

plastic2 = s.newMaterial( "standard",[ "kt",vector3(0.95,0.95,0.95), "kr",vector3(0.05,0.05,0.05), "kd",0.01, "IOR",1.26,"caustics", 4, 4] )

plastic3 = s.newMaterial( "standard",[ "kt",vector3(0.85,0.85,0.85), "kr",vector3(0.15,0.15,0.15), "kd",0.01, "IOR",1.15,"transmission",1,"radiosity",1 ] )

check_ground=s.newPattern("check",["color",vector3( 0.2, 0.4, 0.6),"scale",0.025])

ground=s.newMaterial( "standard",[ "kc", check_ground,"kc",vector3( 1.0, 1.0, 1.0 ),"ka",check_ground ] )

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


s.materialBegin( plastic1 )
s.addObject( s.newObject( "sphere", [ "radius",1.4] ) )
s.materialEnd()


#地面groundをpatchで作成しています。高さ(z軸)を-1.4にしてぴったり球とあわせています。
s.materialBegin( ground )

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

s.materialEnd()

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

s.imagerBegin( saver )

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

s.imagerEnd()
s.radiosity()
s.render( camera, 512, 300 )
  • -
  • -

屈折率を計算する

以下のようにファイル出力するようにした。
idx=[1.05,1.1,1.15,1.2,1.22,1.24,1.26,1.28,1.3,1.4]
10個の屈折率を割り当てて10枚出力する
sphere_glass04pl1.jpg

sphere_glass04pl2.jpg

#! /usr/bin/env python

from lightflowPM import *

from math import *

for f in range(10):
s = scene()
s.lightOn( s.newLight( "point", [ "position", vector3( 5.0, -2.0, 5.0 ), "color", vector3( 300.0, 300.0, 300.0 ) ] ) )

s.lightOn( s.newLight( "ambient", [ "color", vector3( 0.2, 0.2, 0.2 ) ] ) ) #環境光を加える。
idx=[1.05,1.1,1.15,1.2,1.22,1.24,1.26,1.28,1.3,1.4]
plastic = s.newMaterial( "standard",[ "kc", vector3( 0.2, 0.2, 0.2 ),"kd", 0.01 ,"kr",vector3(0.2,0.2,0.2),"kt",vector3(0.8,0.8,0.8),"IOR",idx[f],"caustics", 4, 4] )
plastic2 = s.newMaterial( "standard",[ "kt",vector3(0.95,0.95,0.95), "kr",vector3(0.05,0.05,0.05), "kd",0.01, "IOR",1.26,"caustics", 4, 4] )

plastic3 = s.newMaterial( "standard",[ "kt",vector3(0.85,0.85,0.85), "kr",vector3(0.15,0.15,0.15), "kd",0.01, "IOR",1.15,"transmission",1,"radiosity",1 ] )
check_ground=s.newPattern("check",["color",vector3( 0.2, 0.4, 0.6),"scale",0.025])

ground=s.newMaterial( "standard",[ "kc", check_ground,"kc",vector3( 1.0, 1.0, 1.0 ),"ka",check_ground ] )

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

s.materialBegin( plastic )
s.addObject( s.newObject( "sphere", [ "radius",1.4] ) )
s.materialEnd()

#地面groundをpatchで作成しています。高さ(z軸)を-1.4にしてぴったり球とあわせています。
s.materialBegin( ground )
s.addObject( s.newObject( "patch", [ "points",vector3( -50, -50, -1.4 ),vector3( -50, 50, -1.4 ),vector3( 50, -50, -1.4 ),vector3( 50, 50, -1.4 )] ) )

s.materialEnd()
saver = s.newImager( "tga-saver", [ "file", ("sphere_glass_%03d" % f)+".tga" ] )
s.imagerBegin( saver )

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

s.imagerEnd()
s.radiosity()
s.render( camera, 512, 300 )

  • -
  • -

<< 5/5