Posted: Wed Feb 10, 2010 11:52 am
not Bryce 5.5c, please
THe rendering engine is too old.
If you are starting from scratch I suggest Blender.
THe rendering engine is too old.
If you are starting from scratch I suggest Blender.
A discussion of all things Transcendence
https://forums.kronosaur.com/
Code: Select all
# rotation script
#
# first press the big render button and make
# sure it looks how the first frame should be,
# then press alt + p to run this script and
# it'll save to the 'rotated' directory.
#
# june 18 2005 s
# aug 6 2005 s & db
FILENAME = "MakayevCruiser"
OBJECTNAME ="Warship"
CAMERAANGLE = 0
dodebug = 0
dorolls = 0
doleftrolls = 1
dorightrolls = 1
import Blender
import math
from Blender import *
from Blender.Scene import Render
# code by timmeh (#blenderchat)
def save_frame(frameno):
scn = Scene.GetCurrent()
context = scn.getRenderingContext()
#context.setImageType(Render.TARGA)
context.setImageType(Render.PNG)
# should probably set a frame and at the end of the prog render
# the animation instead of rendering each frame one by one.
# that would also give the advantage of being able to render to
# a video directly (i think).
context.setRenderPath("rotated/%s%02d-" % (FILENAME, frameno))
context.startFrame(1)
context.endFrame(1)
context.renderAnim()
# code by timmeh (#blenderchat)
def save_roll_frame(frameno):
scn = Scene.GetCurrent()
context = scn.getRenderingContext()
#context.setImageType(Render.TARGA)
context.setImageType(Render.PNG)
# should probably set a frame and at the end of the prog render
# the animation instead of rendering each frame one by one.
# that would also give the advantage of being able to render to
# a video directly (i think).
context.setRenderPath("rotated/%sroll%03d-" % (FILENAME, frameno))
context.startFrame(1)
context.endFrame(1)
context.renderAnim()
def to_rad(a):
return a * math.pi / 180
def set_angle(obj, degrees):
if CAMERAANGLE:
sigma = to_rad(0 - degrees)
x = math.cos(sigma)
y = math.sin(phi) * math.sin(sigma)
obj.RotZ = math.atan2(y, x)
else:
obj.RotZ = - degrees * math.pi / 180
# main
# get object
obj = Blender.Object.Get(OBJECTNAME)
# calc phi
phi = to_rad(CAMERAANGLE)
# debug, rotates once (doesn't render, see 3d view)
if dodebug:
set_angle(obj, 45)
Blender.Redraw()
else:
# 40 normal rotations
for i in range(40):
set_angle(obj, i * 9)
#Blender.Redraw()
save_frame(i)
# 400 rolls
if dorolls:
if doleftrolls:
# left rolls
for j in range(5):
obj.RotY = to_rad((5 - j) * 9)
for i in range(40):
set_angle(obj, i * 9)
#Blender.Redraw()
save_roll_frame(j * 40 + i)
# right rolls
if dorightrolls:
for j in range(5):
obj.RotY = - to_rad((j + 1) * 9)
for i in range(40):
set_angle(obj, i * 9)
#Blender.Redraw()
save_roll_frame(200 + j * 40 + i)
# restore back to normal
obj.RotZ = 0
obj.RotY = 0
Blender.Redraw()