Since for my proyect I need octane to do flythrough animation I created a python script for blender that saves the camera position on each frame and then runs octane for each position.
Usage:
- Export your .obj file as you would normally do.
- Import into octane, change all settings you need to render your scene and save into a .ocs file.
- Open your blender original scene, copy the script below and paste it into blender's text editor, change all necessary Variables (fully explained in script).
- Hit Alt + p over the text editor.
- Check the console, the last line should read "export finished", if not, it will show where the error is.
- Run the .bat file
- Return a couple of hour later to see your results .
The script:
- Code: Select all
#Octane export camera script, writes a bat that launches octane several times for animations
#Thanks to Dave Jarvis, for the inspiration
#Made by CGgap in blendeartist, Curious Guy in Octane forums
#Known issues:
# -The export bat is generated in the disk root
# -octane has to close every time a image is rendered
# -Camera and camera target cant be parented
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
import Blender
print "export started"
################################# VARIABLES #####################################
# Put your camera name where Camera is:
cam = Blender.Object.Get('Camera')
# Put your camera target name where target is:
camt = Blender.Object.Get("target")
# Write your osc full path here, watch out for \a, \n, \r, \t and others \something! and watch for spaces!
oscfile = "C:\est/enim.ocs"
# Write your octane path here:
octpath = "C:\Program Files/3D/Octane Render 1.021 x64"
# Write the path where you want to create your export file: (for some reason I can't get the file out of C:\)
path = "C:/octaneexport.bat"
# Mesh object name (in octane)
mesh = "anim_000001.obj"
# Write how you want to call your rendered images
IM = "C:\IM/test"
# Number of maximum samples:
samples = "300"
# Set your starting and ending frame:
firstFrame = 1
lastFrame = 360
##################################################################################
f = file(path, 'w')
f.writelines("cd "+octpath+"\n")
for frame in range( firstFrame, lastFrame+1, 1 ):
f.writelines("octane -m "+mesh+" --cam-pos-x "+str(cam.LocX)+" --cam-pos-y "+str(cam.LocZ)+" --cam-pos-z "+str(cam.LocY*-1)+" --cam-target-x "+str(camt.LocX)+" --cam-target-y "+str(camt.LocZ)+" --cam-target-z "+str(camt.LocY*-1)+" -o "+IM+str(frame)+" -s "+samples+" -e "+oscfile+'\n')
print "exported frame: "+str(frame)
print "Camera coordinates: "+str(cam.LocX)+", "+str(cam.LocY)+", "+str(cam.LocZ)
print "Target coordinates: "+str(camt.LocX)+", "+str(camt.LocY)+", "+str(camt.LocZ)
Blender.Set( 'curframe', frame )
f.close()
print "export finished"
Limitations:
- The export bat is generated in the disk root
- Octane has to close every time a image is rendered (Radiance: There is a way to avoid this?)
- Camera and camera target can't be parented (actually i'm not sure of this)
Maybe I will also add blender to octane conversion lens and changing .obj file between frames.
Here is a little example:
Ok, it's staring to get late here, must go to bed
Cheers