Forum Moderators: Lobo3433 Forum Coordinators: LuxXeon
Blender F.A.Q (Last Updated: 2024 Nov 24 8:44 pm)
Quote - I'm creating isometric sprites that I'm rendering from 4 or 8 sides. I render one side, save it, rotate the camera around it 45 or 90 degrees, render again, repeat. It would be nice if I could just hit a button, leave it alone for a while, and come back and all of the angles are done (or, you know, still chugging away at it but not in need of my help). I haven't really tried writing any python scripts for blender, so is that doable? And if each were an animation that I wanted to save as a series of stills, would it still be doable?
I've been writing a lot of scripts lately. It sounds very do-able. I'm not 100% clear on what you're looking for, how ever, I know how to locate objects with python, manipulate them, etc. I'm also sure I've seen the options to render and save the output as well, although that's not something I've needed to use before.
Just yesterday, I was curious about loading a gray scale image and using it as an elevation map to create a grid mesh from. I was able to write a script for that in about an hour or so. It was easier than I thought it would be.
If you like, send your file my way with another description of what you're trying to accomplish, and at the very least, I'll see if I can cut down your clicking responsibilities.
:)
I just read your post again...it sounds like your creating sprites basically like they used to use for the game Doom and the like. I think I'm with you.
If you have a model and have it set up to animate from frame 0 to 250 (or more) for each of the actions you wish it to perform, I'm sure I could come up with a script for you that would snap a picture of it from 4 or 8 different angles, advance the frame by one, rinse and repeat.
:D
Reddog9
Tutorials, Samples and Models
www.blender3dclub.com
Got it.
Sample Blend File with Script:
Spritemaker
It reads the start and stop frame set from the usual Anim Tab.
Selects your Armature (or Object) (Enter the name in the script)
Starts at the first frame, renders an image, saves it as a PNG with the animation name (manually entered) followed by the angle of rotation and then the frame number. For example: walk_45_1, walk_45_2, walk_45_3, etc.
It advances the frame by one and repeats the render, saving and rotation again until it completes the final frame.
import Blender
from Blender import *
from Blender.Scene import Render
print
print '--------------------------------------'
# Enter spritename for this animation
# Enter armature name here in order to have it rotated
# (or the object name if not using armature)
# File type is set to PNG but can be changed.
# Set the start and stop frame as usual from the Anim
# tab.
# Images are saved in the sub-directory of /myRenderdir/
spritename = 'Running'
Thing = Blender.Object.Get('Armature')
# =================================================
rotation = Thing.RotZ
Thing.RotZ = 0
Blender.Redraw()
scn = Blender.Scene.getCurrent()
context = scn.getRenderingContext()
context.extensions = True
context.renderPath = "//myRenderdir/"
context.sizePreset(Render.PC)
context.imageType = Render.PNG
start = context.sFrame
stop = context.eFrame
for framecount in range(start,stop+1):
context.cFrame = framecount
for x in range(0,8):
ang = x*0.785398185253
Thing.RotZ = ang
context.render()
angle = x * 45
name = spritename + '' + str(angle) + '' + str(framecount)
context.saveRenderedImage(name)
Blender.Redraw()
Thing.RotZ = 0
Render.CloseRenderWindow()
Reddog9
Tutorials, Samples and Models
www.blender3dclub.com
Oh, wow, I didn't have time to reply this morning and next I know you have it done already! You rock :):) Took me a bit to figure out where it was saving things (nowhere, I'm on windows and it turns out, until I changed it to C:tmp, the //tmp/ format doesn't work like it does elsewhere) and how to get it to stop before frame 250, but I've got it now. Thanks!
I was actually looking to have the camera rotate around the center of the scene (where the cursor is) because the thing being rendered may have multiple parts. As is is fine, it's faster to join things anyway rather than importing them all piecemeal from other files like I was, but I'm curious. It looks like rotX is the local rotation property, so if I wanted to rotate around a point I'd have to create my own rotate function that did the math.
Edit: actually, though, some sort of dummy object to parent it to may do....
Attached Link: http://www.pamgriffith.net/share/MP_Isometric.blend
Aha, I did get it to work with the camera. But the positions of child objects (e.g. the lights and ground) relative to the parent (the camera) become awry after the last image is rendered. They keep up fine after that point, and running the script again seems to adjust them correctly. Do you know what might be going on there?Attached Link: New version
I created an empty at ground zero and parented everything to it. Seems to work fine. Not sure how to get the script to update the final rotation at the end of everything else, so just a quick ALT-R with the empty selected clears them up.It looked like the armature was working for you as well.
Let me know if I can help any more.
Oh.. also, from what I've experienced, when you're writing directory names, you need to use '//' slashes instead of ''
Unless I'm wrong, but that's what I need to do in order for it to work correctly.
Reddog9
Tutorials, Samples and Models
www.blender3dclub.com
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
I'm creating isometric sprites that I'm rendering from 4 or 8 sides. I render one side, save it, rotate the camera around it 45 or 90 degrees, render again, repeat. It would be nice if I could just hit a button, leave it alone for a while, and come back and all of the angles are done (or, you know, still chugging away at it but not in need of my help). I haven't really tried writing any python scripts for blender, so is that doable? And if each were an animation that I wanted to save as a series of stills, would it still be doable?