以下、colorinc.py 未完成ですが、いろいろやってみる。
#! /usr/bin/env python
#colorinc.py
import fujiyama
si = fujiyama.SceneInterface()
#plugins
si.OpenPlugin('ConstantShader')
si.OpenPlugin('PlasticShader')
si.OpenPlugin('GlassShader')
si.NewShader('Blue_shader', 'PlasticShader')
si.SetProperty3('Blue_shader', 'diffuse', 0, 0.6, 1)
si.NewShader('Red_shader', 'PlasticShader')
si.SetProperty3('Red_shader', 'diffuse', 1, 0, 0)
si.NewShader('Green_shader', 'PlasticShader')
si.SetProperty3('Green_shader', 'diffuse', 0, 1, 0.5)
si.NewShader('Violet_shader', 'PlasticShader')
si.SetProperty3('Violet_shader', 'diffuse', 1, 0.2, 1)
si.NewShader('Orange_shader', 'PlasticShader')
si.SetProperty3('Orange_shader', 'diffuse', 1, 0.6, 0.2)
si.NewShader('Yellow_shader', 'PlasticShader')
si.SetProperty3('Yellow_shader', 'diffuse', 1,1,0)
si.NewShader('Cyan_shader', 'PlasticShader')
si.SetProperty3('Cyan_shader', 'diffuse', 0, 1, 1)
si.NewShader('Magenta_shader', 'PlasticShader')
si.SetProperty3('Magenta_shader', 'diffuse', 1, 0, 1)
si.NewShader('White_shader', 'PlasticShader')
si.SetProperty3('White_shader', 'diffuse', 1, 1, 1)
si.NewShader('Black_shader', 'PlasticShader')
si.SetProperty3('Black_shader', 'diffuse', 0, 0, 0)
si.NewShader('DimGray_shader', 'PlasticShader')
si.SetProperty3('DimGray_shader', 'diffuse',0.329412,0.329412,0.329412)
si.NewShader('Gray_shader', 'PlasticShader')
si.SetProperty3('Gray_shader', 'diffuse',0.752941,0.752941,0.752941)
si.NewShader('LightGray_shader', 'PlasticShader')
si.SetProperty3('LightGray_shader', 'diffuse',0.658824,0.658824,0.658824)
si.NewShader('VLightGray_shader', 'PlasticShader')
si.SetProperty3('VLightGray_shader', 'diffuse',0.80,0.80,0.80)
si.NewShader('Aquamarine_shader', 'PlasticShader')
si.SetProperty3('Aquamarine_shader', 'diffuse',0.439216,0.858824,0.576471)
si.NewShader('BlueViolet_shader', 'PlasticShader')
si.SetProperty3('BlueViolet_shader', 'diffuse',0.62352,0.372549,0.623529)
si.NewShader('Brown_shader', 'PlasticShader')
si.SetProperty3('Brown_shader', 'diffuse',0.647059,0.164706,0.164706)
si.NewShader('CadetBlue_shader', 'PlasticShader')
si.SetProperty3('CadetBlue_shader', 'diffuse',0.372549,0.623529,0.623529)
si.NewShader('Coral_shader', 'PlasticShader')
si.SetProperty3('Coral_shader', 'diffuse',1.0,0.498039,0.0)
si.NewShader('CornflowerBlue_shader', 'PlasticShader')
si.SetProperty3('CornflowerBlue_shader', 'diffuse',0.258824,0.258824,0.435294)
si.NewShader('DarkGreen_shader', 'PlasticShader')
si.SetProperty3('DarkGreen_shader', 'diffuse',0.184314,0.309804,0.184314)
si.NewShader('DarkOliveGreen_shader', 'PlasticShader')
si.SetProperty3('DarkOliveGreen_shader', 'diffuse',0.309804,0.309804,0.184314)
si.NewShader('DarkOrchid_shader', 'PlasticShader')
si.SetProperty3('DarkOrchid_shader', 'diffuse',0.6,0.196078,0.8)
si.NewShader('DarkSlateBlue_shader', 'PlasticShader')
si.SetProperty3('DarkSlateBlue_shader', 'diffuse',0.119608,0.137255,0.556863)
si.NewShader('DarkSlateGray_shader', 'PlasticShader')
si.SetProperty3('DarkSlateGray_shader', 'diffuse',0.184314,0.309804,0.309804)
si.NewShader('DarkTurquoise_shader', 'PlasticShader')
si.SetProperty3('DarkTurquoise_shader', 'diffuse',0.439216,0.576471,0.858824)
si.NewShader('Firebrick_shader', 'PlasticShader')
si.SetProperty3('Firebrick_shader', 'diffuse',0.556863,0.137255,0.137255)
si.NewShader('ForestGreen_shader', 'PlasticShader')
si.SetProperty3('ForestGreen_shader', 'diffuse',0.137255,0.556863,0.137255)
si.NewShader('Gold_shader', 'PlasticShader')
si.SetProperty3('Gold_shader', 'diffuse',0.8,0.498039,0.196078)
si.NewShader('Goldenrod_shader', 'PlasticShader')
si.SetProperty3('Goldenrod_shader', 'diffuse',0.858824,0.858824,0.439216)
si.NewShader('GreenYellow_shader', 'PlasticShader')
si.SetProperty3('GreenYellow_shader', 'diffuse',0.576471,0.858824,0.439216)
si.NewShader('IndianRed_shader', 'PlasticShader')
si.SetProperty3('IndianRed_shader', 'diffuse',0.309804,0.184314,0.184314)
si.NewShader('Khaki_shader', 'PlasticShader')
si.SetProperty3('Khaki_shader', 'diffuse',0.623529,0.623529,0.372549)
"""
LightBlue=vector3(0.74902,0.847059,0.847059)
LightSteelBlue=vector3(0.560784,0.560784,0.737255)
LimeGreen=vector3(0.196078,0.8,0.196078)
Maroon=vector3(0.556863,0.137255,0.419608)
MediumAquamarine=vector3(0.196078,0.8,0.6)
MediumBlue=vector3(0.196078,0.196078,0.8)
MediumForestGreen=vector3(0.419608,0.556863,0.137255)
MediumGoldenrod=vector3(0.917647,0.917647,0.678431)
MediumOrchid=vector3(0.576471,0.439216,0.858824)
MediumSeaGreen=vector3(0.258824,0.435294,0.258824)
MediumTurquoise=vector3(0.439216,0.858824,0.858824)
MediumVioletRed=vector3(0.858824,0.439216,0.576471)
MidnightBlue=vector3(0.184314,0.184314,0.309804)
Navy=vector3(0.137255,0.137255,0.556863)
NavyBlue=vector3(0.137255,0.137255,0.556863)
Orange=vector3(1,0.5,0.0)
Orchid=vector3(0.858824,0.439216,0.858824)
PaleGreen=vector3(0.560784,0.737255,0.560784)
Pink=vector3(0.737255,0.560784,0.560784)
Plum=vector3(0.917647,0.678431,0.917647)
Salmon=vector3(0.435294,0.258824,0.258824)
SeaGreen=vector3(0.137255,0.556863,0.419608)
Sienna=vector3(0.556863,0.419608,0.137255)
SkyBlue=vector3(0.196078,0.6,0.8)
SteelBlue=vector3(0.137255,0.419608,0.556863)
Tan=vector3(0.858824,0.576471,0.439216)
Thistle=vector3(0.847059,0.74902,0.847059)
Turquoise=vector3(0.678431,0.917647,0.917647)
Violet=vector3(0.309804,0.184314,0.309804)
VioletRed=vector3(0.8,0.196078,0.6)
Wheat=vector3(0.847059,0.847059,0.74902)
YellowGreen=vector3(0.6,0.8,0.196078)
SummerSky=vector3(0.22,0.69,0.87)
RichBlue=vector3(0.35,0.35,0.67)
Brass=vector3( 0.71,0.65,0.26)
Copper=vector3(0.72,0.45,0.20)
Bronze=vector3(0.55,0.47,0.14)
Bronze2=vector3(0.65,0.49,0.24)
Silver=vector3(0.90,0.91,0.98)
BrightGold=vector3(0.85,0.85,0.10)
OldGold=vector3( 0.81,0.71,0.23)
Feldspar=vector3(0.82,0.57,0.46)
Quartz=vector3(0.85,0.85,0.95)
NeonPink=vector3(1.00,0.43,0.78)
DarkPurple=vector3(0.53,0.12,0.47)
NeonBlue=vector3(0.30,0.30,1.00)
CoolCopper=vector3(0.85,0.53,0.10)
MandarinOrange=vector3(0.89,0.47,0.20)
LightWood=vector3(0.91,0.76,0.65)
MediumWood=vector3(0.65,0.50,0.39)
DarkWood=vector3(0.52,0.37,0.26)
SpicyPink=vector3(1.00,0.11,0.68)
SemiSweetChoc=vector3(0.42,0.26,0.15)
BakersChoc=vector3(0.36,0.20,0.09)
Flesh=vector3(0.96,0.80,0.69)
NewTan=vector3(0.92,0.78,0.62)
NewMidnightBlue=vector3(0.00,0.00,0.61)
VeryDarkBrown=vector3(0.35,0.16,0.14)
DarkBrown=vector3(0.36,0.25,0.20)
DarkTan=vector3(0.59,0.41,0.31)
GreenCopper=vector3(0.32,0.49,0.46)
DkGreenCopper=vector3(0.29,0.46,0.43)
DustyRose=vector3(0.52,0.39,0.39)
HuntersGreen=vector3(0.13,0.37,0.31)
Scarlet=vector3(0.55,0.09,0.09)
Med_Purple=vector3( 0.73,0.16,0.96)
Light_Purple=vector3(0.87,0.58,0.98)
Very_Light_Purple=vector3(0.94,0.81,0.99)
"""
さらにcolorinc.pyをインポートするシーン例
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#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')
si.OpenPlugin('GlassShader')
#Camera
si.NewCamera('cam1', 'PerspectiveCamera')
si.SetProperty3('cam1', 'rotate', -26.57, 0.00, 0.00)
#si.SetProperty3('cam1', 'rotate', 0.00, 180.00, 0.00)
si.SetProperty3('cam1', 'translate', 0.00, 5.00, 10.00)
#Light
"""
si.NewLight('lighta', 'PointLight')
si.SetProperty3('lighta', 'translate', -5, 4, 5)
si.SetProperty1('lighta', 'intensity', 0.03)
si.NewLight('lightb', 'SphereLight')
si.SetProperty3('lightb', 'translate', 5, 4, 5)
si.SetProperty3('lightb', 'scale', .5, .5, .5)
si.SetProperty1('lightb', 'intensity', 0.03)
"""
#Light
si.NewLight( 'light0', 'PointLight')
si.SetProperty3( 'light0', 'translate', 0.900771, 12, 4.09137)
si.SetProperty1( 'light0', 'intensity', 0.03125)
si.NewLight( 'light1', 'PointLight')
si.SetProperty3( 'light1', 'translate', 2.02315, 12, 5.28021)
si.SetProperty1( 'light1' ,'intensity', 0.03125)
si.NewLight( 'light2', 'PointLight')
si.SetProperty3( 'light2', 'translate', 10.69, 12, 13.918)
si.SetProperty1( 'light2', 'intensity', 0.03125)
si.NewLight( 'light3', 'PointLight')
si.SetProperty3( 'light3', 'translate', 4.28027, 12, 7.58462)
si.SetProperty1( 'light3', 'intensity', 0.03125)
si.NewLight( 'light4', 'PointLight')
si.SetProperty3( 'light4', 'translate', 12.9548, 12, 1.19914)
si.SetProperty1( 'light4', 'intensity', 0.03125)
si.NewLight( 'light5', 'PointLight')
si.SetProperty3( 'light5', 'translate', 6.55808, 12, 2.31772)
si.SetProperty1( 'light5', 'intensity', 0.03125)
si.NewLight( 'light6', 'PointLight')
si.SetProperty3( 'light6', 'translate', 0.169064, 12, 10.9623)
si.SetProperty1( 'light6', 'intensity', 0.03125)
si.NewLight( 'light7', 'PointLight')
si.SetProperty3( 'light7', 'translate', 1.25002, 12, 4.51314)
si.SetProperty1( 'light7', 'intensity', 0.03125)
si.NewLight( 'light8', 'PointLight')
si.SetProperty3( 'light8', 'translate', 2.46758, 12, 5.73382)
si.SetProperty1( 'light8', 'intensity', 0.03125)
si.NewLight( 'light9', 'PointLight')
si.SetProperty3( 'light9', 'translate', 3.55644, 12, 6.84334)
si.SetProperty1( 'light9','intensity', 0.03125)
si.NewLight( 'light10', 'PointLight')
si.SetProperty3( 'light10', 'translate', 4.76112, 12, 8.00264)
si.SetProperty1( 'light10', 'intensity', 0.03125)
si.NewLight( 'light11', 'PointLight')
si.SetProperty3( 'light11', 'translate', 13.3267,12, 9.10333)
si.SetProperty1( 'light11', 'intensity', 0.03125)
si.NewLight( 'light12', 'PointLight')
si.SetProperty3( 'light12', 'translate', 14.4155, 12, 2.68084)
si.SetProperty1( 'light12', 'intensity', 0.03125)
si.NewLight( 'light13', 'PointLight')
si.SetProperty3( 'light13', 'translate', 8.10755, 12, 3.79629)
si.SetProperty1( 'light13', 'intensity', 0.03125)
si.NewLight( 'light14', 'PointLight')
si.SetProperty3( 'light14', 'translate', 9.21103, 12, 4.9484)
si.SetProperty1( 'light14', 'intensity', 0.03125)
si.NewLight( 'light15', 'PointLight')
si.SetProperty3( 'light15', 'translate', 2.83469, 12, 6.09221)
si.SetProperty1( 'light15', 'intensity', 0.03125)
si.NewLight( 'light16', 'PointLight')
si.SetProperty3( 'light16', 'translate', 4.00945, 12, 7.18302)
si.SetProperty1( 'light16', 'intensity', 0.03125)
si.NewLight( 'light17', 'PointLight')
si.SetProperty3( 'light17', 'translate', 12.6072, 12, 0.832089)
si.SetProperty1( 'light17', 'intensity', 0.03125)
si.NewLight( 'light18', 'PointLight')
si.SetProperty3( 'light18', 'translate', 6.21169, 12, 1.98055)
si.SetProperty1( 'light18', 'intensity', 0.03125)
si.NewLight( 'light19', 'PointLight')
si.SetProperty3( 'light19', 'translate', 7.39599, 12, 10.5563)
si.SetProperty1( 'light19', 'intensity', 0.03125)
si.NewLight( 'light20', 'PointLight')
si.SetProperty3( 'light20', 'translate', 8.52421, 12, 4.15086)
si.SetProperty1( 'light20', 'intensity', 0.03125)
si.NewLight( 'light21', 'PointLight')
si.SetProperty3( 'light21', 'translate', 9.5891, 12, 5.39715)
si.SetProperty1( 'light21', 'intensity', 0.03125)
si.NewLight( 'light22', 'PointLight')
si.SetProperty3( 'light22', 'translate', 3.18967, 12, 13.9542)
si.SetProperty1( 'light22', 'intensity', 0.03125)
si.NewLight( 'light23','PointLight')
si.SetProperty3( 'light23', 'translate', 4.41432, 12, 0.082813)
si.SetProperty1( 'light23', 'intensity', 0.03125)
si.NewLight( 'light24', 'PointLight')
si.SetProperty3( 'light24', 'translate', 5.48803, 12, 1.21856)
si.SetProperty1( 'light24', 'intensity', 0.03125)
si.NewLight( 'light25', 'PointLight')
si.SetProperty3( 'light25', 'translate', 6.57647, 12, 2.31432)
si.SetProperty1( 'light25', 'intensity', 0.03125)
si.NewLight( 'light26', 'PointLight')
si.SetProperty3( 'light26', 'translate', 0.265098, 12, 10.9453)
si.SetProperty1( 'light26', 'intensity', 0.03125)
si.NewLight( 'light27', 'PointLight')
si.SetProperty3( 'light27', 'translate', 8.84422, 12, 12.1117)
si.SetProperty1( 'light27', 'intensity', 0.03125)
si.NewLight( 'light28', 'PointLight')
si.SetProperty3( 'light28', 'translate', 10.0154, 12, 5.67625)
si.SetProperty1( 'light28', 'intensity', 0.03125)
si.NewLight( 'light29', 'PointLight')
si.SetProperty3( 'light29', 'translate', 11.0907, 12, 14.4043)
si.SetProperty1( 'light29', 'intensity', 0.03125)
si.NewLight( 'light30', 'PointLight')
si.SetProperty3( 'light30', 'translate', 4.71726, 12, 7.98851)
si.SetProperty1( 'light30', 'intensity', 0.03125)
si.NewLight( 'light31', 'PointLight')
si.SetProperty3( 'light31', 'translate', 13.3907, 12, 9.08986)
si.SetProperty1( 'light31', 'intensity', 0.03125)
#Shader
si.NewShader('floor_shader', 'PlasticShader')
si.SetProperty3('floor_shader', 'diffuse', .2, .25, .3)
si.SetProperty1('floor_shader', 'ior', 2)
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
si.NewObjectInstance('cube1', 'cube_mesh')
si.AssignShader('cube1', 'DarkTurquoise_shader')
si.SetProperty3('cube1', 'translate', 0,0, 0)
si.NewObjectInstance('cube2', 'cube_mesh')
si.AssignShader('cube2', 'Firebrick_shader')
si.SetProperty3('cube2', 'translate', -2,0, 0)
si.NewObjectInstance('cube3', 'cube_mesh')
si.AssignShader('cube3', 'ForestGreen_shader')
si.SetProperty3('cube3', 'translate', 2,0, 0)
si.SetProperty3('cube3', 'rotate', 0,45, 0)
si.NewObjectInstance('cube4', 'cube_mesh')
si.AssignShader('cube4', 'Gold_shader')
si.SetProperty3('cube4', 'translate', -2,0, -2)
si.NewObjectInstance('cube5', 'cube_mesh')
si.AssignShader('cube5', 'Goldenrod_shader')
si.SetProperty3('cube5', 'translate', 0,0, -2)
si.NewObjectInstance('cube6', 'cube_mesh')
si.AssignShader('cube6', 'GreenYellow_shader')
si.SetProperty3('cube6', 'translate', 2,0, -2)
si.NewObjectInstance('floor1', 'floor_mesh')
si.AssignShader('floor1', 'Blue_shader')
si.SetProperty3('Blue_shader', 'reflect', 0.5, 0.5, 0.5)
si.SetProperty3('floor1', 'translate', 0,-0.5, 0)
si.SetProperty3('floor1', 'scale', 10, 10, 10)
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', 512, 300)
#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', '../boxcolor01.fb')
#Run commands
si.Run()
#si.Print()
カメラの画角調整 20度
si.SetProperty1('cam1', 'fov', 20)
ありがとうございます。
- -
- -