Python API fujiyama.pyを利用。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.6/site-packages/:$HOME/Fujiyama-Renderer/bin/
from math import *
import fujiyama
si = fujiyama.SceneInterface()
#plugins
si.OpenPlugin('ConstantShader')
si.OpenPlugin('PlasticShader')
si.OpenPlugin('GlassShader')
#Camera
si.NewCamera('cam1', 'PerspectiveCamera')
si.SetProperty3('cam1', 'translate', 0, 2, 6)
si.SetProperty3('cam1', 'rotate', -11.309932474020213, 0, 0)
#Light
si.NewLight('light1', 'PointLight')
si.SetProperty3('light1', 'position', 10, 12, 10)
#Shader
si.NewShader('floor_shader', 'PlasticShader')
si.SetProperty3('floor_shader', 'diffuse', .2, .25, .3)
si.SetProperty1('floor_shader', 'ior', 2)
si.NewShader('cube_shader', 'PlasticShader')
si.SetProperty3('cube_shader', 'diffuse', .9, .2, .2)
#si.NewShader('cube_shader3', 'PlasticShader')
#si.SetProperty3('cube_shader3', 'diffuse', .1, .2, .8)
#si.NewShader('cube_shader2', 'PlasticShader')
#si.SetProperty3('cube_shader2', 'diffuse', .1, .95, .1)
si.NewShader('dome_shader', 'ConstantShader')
si.SetProperty3('dome_shader', 'diffuse', .8, .8, .8)
#Mesh
si.NewMesh('dome_mesh', '../mesh/dome.mesh')
si.NewMesh('floor_mesh', '../mesh/floor.mesh')
si.NewMesh('cube_mesh', '../mesh/cube.mesh')
#ObjectInstance
N1=5
J=1
for i in range(5):
si.NewShader('cube_shader'+str(i), 'PlasticShader')
si.SetProperty3('cube_shader'+str(i), 'diffuse', 0.5*(1+sin(2*pi/N1*J)),0.5, 0.5*(1+cos(2*pi/N1*J)))
si.NewObjectInstance('cube'+str(i), 'cube_mesh')
si.AssignShader('cube'+str(i), 'cube_shader'+str(i))
si.SetProperty3('cube'+str(i), 'translate', i-2,.6, 0)
si.SetProperty3('cube'+str(i), 'scale', .8,.8, .8)
J+=1
si.NewObjectInstance('floor1', 'floor_mesh')
si.AssignShader('floor1', 'floor_shader')
si.NewObjectInstance('dome1', 'dome_mesh')
si.AssignShader('dome1', 'dome_shader')
#FrameBuffer
si.NewFrameBuffer('fb1', 'rgba')
#Properties
si.ShowPropertyList('Renderer')
#Renderer
si.NewRenderer('ren1')
si.AssignCamera('ren1', 'cam1')
si.AssignFrameBuffer('ren1', 'fb1')
si.SetProperty2('ren1', 'resolution', 640, 480)
#si.SetProperty2('ren1', 'resolution', 160, 120)
si.SetProperty1('ren1', 'raymarch_step', .01)
si.SetProperty1('ren1', 'raymarch_shadow_step', .02)
si.SetProperty1('ren1', 'raymarch_reflect_step', .02)
#Rendering
si.RenderScene('ren1')
#Output
si.SaveFrameBuffer('fb1', '../cube03.fb')
#Run commands
si.Run()
#si.Print()