<< はじめてのFujiyama Renderer その16 戻る はじめてのFujiyama Renderer その18 >>

はじめてのFujiyama Renderer その17

各オブジェクトの変形を行ってみる。
povspbox01.jpg

#!/usr/bin/env python

#export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.6/site-packages/:$HOME/Fujiyama-Renderer/bin/
from colorinc import si
import fujiyama

#si = fujiyama.SceneInterface()

#plugins
si.OpenPlugin('ConstantShader')
si.OpenPlugin('PlasticShader')

#Camera
si.NewCamera('cam1', 'PerspectiveCamera')
#si.SetSampleProperty3('cam1', 'translate', 0, 8, 8, 0)
#si.SetSampleProperty3('cam1', 'rotate', -45, 0, 0, 0)
#Calculate python fujicam.py 0 1 -8 0 1 0
#si.SetSampleProperty3('cam1', 'rotate',0.00, 180, 0.00,0)
si.SetSampleProperty3('cam1', 'translate', 0, 1, 8,0)
si.SetProperty1('cam1', 'fov', 35)

#Light
si.NewLight('light1', 'SphereLight')
si.SetProperty3('light1', 'translate', -10, 10, 10)
si.SetProperty3('light1', 'scale', .5, .5, .5)
si.SetProperty1('light1', 'intensity', 1)
si.SetProperty1('light1', 'sample_count', 16)

si.NewLight('light2', 'SphereLight')
si.SetProperty3('light2', 'translate', 10, 10, 10)
si.SetProperty3('light2', 'scale', .5, .5, .5)
si.SetProperty1('light2', 'intensity', 1)
si.SetProperty1('light2', 'sample_count', 16)

#Texture
si.NewTexture('tex1', '../mip/pisa.mip')

#Shader
si.NewShader('dome_shader', 'ConstantShader')
si.AssignTexture('dome_shader', 'texture', 'tex1')

si.NewShader('floor_shader', 'PlasticShader')
si.SetProperty3('floor_shader', 'diffuse', .9, .2, .2)

intensity = 0
si.NewShader('sphere_shader', 'PlasticShader')
si.SetProperty3('sphere_shader', 'diffuse', intensity, intensity, intensity)
si.SetProperty1('sphere_shader', 'ior', 40)

#Mesh
si.NewMesh('dome_mesh', '../mesh/dome.mesh')
si.NewMesh('floor_mesh', '../mesh/floor.mesh')
si.NewMesh('sphere_mesh', '../mesh/sphere.mesh')
si.NewMesh('cube_mesh', '../mesh/cube.mesh')

#ObjectInstance
si.NewObjectInstance('cube1', 'cube_mesh')
si.AssignShader('cube1', 'DarkTurquoise_shader')
si.SetProperty3('cube1', 'translate', 2,0.6, 0)

si.NewObjectInstance('cube2', 'cube_mesh')
si.AssignShader('cube2', 'ForestGreen_shader')
si.SetProperty3('cube2', 'translate', 0.5,1.1, 0)
si.SetProperty3('cube2', 'scale', 0.5, 2, 1)
si.SetProperty3('cube2', 'rotate', 0,-30, 0)

si.NewObjectInstance('cube3', 'cube_mesh')
si.AssignShader('cube3', 'Blue_shader')
si.SetProperty3('Blue_shader', 'reflect', 0.5, 0.5, 0.5)
si.SetProperty3('cube3', 'translate', -1,1.1, 0)
si.SetProperty3('cube3', 'scale', 0.5, 2, 1)
si.SetProperty3('cube3', 'rotate', -30,0, 30)

si.NewObjectInstance('sphere1', 'sphere_mesh')
si.AssignShader('sphere1', 'sphere_shader')
si.SetProperty3('sphere1', 'translate', -2.5, 1, 0)
#si.SetProperty3('sphere1', 'scale', .5, .5, .5)

si.NewObjectInstance('dome1', 'dome_mesh')
si.SetProperty3('dome1', 'rotate', 0, 0, 0)
#si.SetProperty3('dome1', 'scale', -.5, .5, .5)
si.SetProperty3('dome1', 'scale', -2, 2, 2)
si.AssignShader('dome1', 'dome_shader')

si.NewObjectInstance('floor1', 'floor_mesh')
si.SetProperty3('floor1', 'scale', 50, 50, 50)
si.AssignShader('floor1', 'floor_shader')

#ObjectGroup
si.NewObjectGroup('group1')
si.AddObjectToGroup('group1', 'sphere1')
si.AddObjectToGroup('group1', 'cube1')
si.AddObjectToGroup('group1', 'cube2')
si.AddObjectToGroup('group1', 'cube3')
si.AssignObjectGroup('cube1', 'shadow_target', 'group1')
si.AssignObjectGroup('cube2', 'shadow_target', 'group1')
si.AssignObjectGroup('cube3', 'shadow_target', 'group1')
si.AssignObjectGroup('sphere1', 'shadow_target', 'group1')
si.AssignObjectGroup('floor1', 'shadow_target', 'group1')

#FrameBuffer
si.NewFrameBuffer('fb1', 'rgba')

#Renderer
si.NewRenderer('ren1')
si.AssignCamera('ren1', 'cam1')
si.AssignFrameBuffer('ren1', 'fb1')
si.SetProperty2('ren1', 'resolution', 512, 384)
#si.SetProperty2('ren1', 'resolution', 160, 120)
#si.SetProperty2('ren1', 'pixelsamples', 12, 12)

#Rendering
si.RenderScene('ren1')

#Output
si.SaveFrameBuffer('fb1', '../povspbox01.fb')

#Run commands
si.Run()
#si.Print()

  • -
  • -

<< はじめてのFujiyama Renderer その16 戻る はじめてのFujiyama Renderer その18 >>