くりかえし処理を利用して、らせん構造に球体を4185個生成しています。
カメラ画角を8にしました。
si.SetProperty1('cam1', 'fov', 8)
si.SetProperty1('cam1', 'fov', 35)
地面floor位置をY軸-12に下げています。
以下はPythonサンプルです。レンダリング時間は1分50秒でした。
#!/usr/bin/env python
from math import *
#export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.6/site-packages/:$HOME/Fujiyama-Renderer/bin/
import fujiyama
si = fujiyama.SceneInterface()
#plugins
si.OpenPlugin('ConstantShader')
si.OpenPlugin('PlasticShader')
#Camera
si.NewCamera('cam1', 'PerspectiveCamera')
#Calculate python fujicam.py 5 10 50 0 4 0
si.SetSampleProperty3('cam1', 'rotate', -5.68, 5.71, 0, 0) #4
si.SetSampleProperty3('cam1', 'translate', 5, 10, 50, 0) #4
si.SetProperty1('cam1', 'fov', 35)
#Light
si.NewLight('light1', 'SphereLight')
si.SetProperty3('light1', 'translate', 0, 10, 10)
si.SetProperty3('light1', 'scale', .5, .5, .5)
si.SetProperty1('light1', 'intensity', 1.25)
si.SetProperty1('light1', 'sample_count', 16)
si.NewLight('light2', 'SphereLight')
si.SetProperty3('light2', 'translate', -5, 0, 10)
si.SetProperty3('light2', 'scale', .5, .5, .5)
si.SetProperty1('light2', 'intensity', 1.25)
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', .2, .25, .3)
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')
#ObjectInstance
si.NewObjectInstance('dome1', 'dome_mesh')
si.SetProperty3('dome1', 'rotate', 0, 0, 0)
j=0
BaseIncAngle = 8
Limit = 360
AngleXY = -360
spname=[]
while (AngleXY <= Limit ):
RadXY=radians(AngleXY)
AngleXZ = 0
while (AngleXZ <= Limit):
RadXZ=radians(AngleXZ)
spname.append('sphere'+str(j))
si.NewObjectInstance('sphere'+str(j), 'sphere_mesh')
si.AssignShader('sphere'+str(j), 'sphere_shader' )
si.SetProperty3('sphere'+str(j), 'translate',cos(RadXZ) *2 * sin(RadXY) ,RadXY * 3.3 + RadXZ * 0.5,sin(RadXZ) *2 * sin(RadXY))
si.SetProperty3('sphere'+str(j), 'scale', 0.13,0.13,0.13)
AngleXZ = AngleXZ + BaseIncAngle
j+=1
AngleXY = AngleXY + BaseIncAngle
#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.SetProperty3('floor1', 'translate', 0, -12, 0)
si.AssignShader('floor1', 'floor_shader')
#ObjectGroup
si.NewObjectGroup('group1')
for i in spname:
si.AddObjectToGroup('group1', i)
for i in spname:
si.AssignObjectGroup(i, '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', '../povsp51.fb')
#Run commands
si.Run()
#si.Print()
- -
- -