As a test of what it takes to build something from scratch, here is a very simple (and ugly) hello world program.
import Blender
from Blender import Scene, Object, Camera, Text3d
from Blender import Lamp
from Blender.Scene import Render
from Blender import Material
from Blender import Window
#
scene = Scene.New()
camdata = Camera.New()
lampdata = Lamp.New()
lampdata.setEnergy(10.0)
lampdata.setSpotSize(180)
txt = Text3d.New()
txt.setText('Hello World')
cam = scene.objects.new(camdata)
cam.setLocation(0.0,-7.0,1.0)
cam.setEuler(1.5,0.0,-0.35)
lamp = scene.objects.new(lampdata)
lamp.setLocation(0.0,-1,5)
msg = scene.objects.new(txt)
msg.setEuler(1.8,0.0,-0.05)
#
mat = Material.New('newMat') # create a new Material called 'newMat'
mat.rgbCol = [0.8, 0.2, 0.2] # change its color
mat.setAlpha(0.2) # mat.alpha = 0.2 -- almost transparent
mat.emit = 0.7 # equivalent to mat.setEmit(0.8)
mat.mode = Material.Modes.ZTRANSP # turn on Z-Buffer transparency
mat.setName('RedBansheeSkin') # change its name
mat.setAdd(0.8) # make it glow
mat.setMode('Halo')
#
msg.setMaterials([mat])
#
Window.RedrawAll()
#
After executing this program and using the renderer to create an image, the following image is created.
No comments:
Post a Comment