Page 1 of 3

Sprite Batch Render addon for Blender

PostPosted: Sat Jan 25, 2014 5:46 pm
by cce
Hello!

Image

Creating Doom sprites by hand is very tedious but Sprite Batch Render addon makes it a lot easier.

It's a Blender addon that renders the given scene from multiple directions by rotating the object and creates Doom compatible sprite names.

The addon interface looks like this:
Image

Obviously you need to also set sprite offsets to use the sprites in Doom.

Documentation and script download at
https://github.com/seece/SpriteBatchRender

See also Blender addon installation instructions.

Edit: Updated screenshot.

Re: Sprite Batch Render addon for Blender

PostPosted: Sat Jan 25, 2014 7:00 pm
by HavoX
But then it would be cheating. :P

Still, looks very promising.

Re: Sprite Batch Render addon for Blender

PostPosted: Sat Jan 25, 2014 11:35 pm
by Gez
It's interesting, though there is some subtlety with rotation steps. ZDoom supports 16 rotation angles, but to make it compatible with the usual 8 angles, the characters for the in-between rotations come after the letters from the original 8 rotations.

That's not clear at all, so basically:
for 8 rotations: stepnames = "12345678"
for 16 rotations: stepnames = "192A3B4C5D6E7F8G" and not "123456789ABCDEFG"

Re: Sprite Batch Render addon for Blender

PostPosted: Sun Jan 26, 2014 12:57 am
by Nash
WOW! Thank you so much! I was always doing it the manual way... this is going to save soooooo much time in my asset pipeline! Thanks for providing this!

Re: Sprite Batch Render addon for Blender

PostPosted: Sun Jan 26, 2014 3:36 am
by Batandy
I've added the script to 2.66/scripts/addons, but the addon doesn't show up in the User Preferences :(
I've also tried installing it from Blender, with no results
I'm using Blender 2.66.1

Re: Sprite Batch Render addon for Blender

PostPosted: Sun Jan 26, 2014 4:18 am
by Nash
File -> User Preferences, File tab, be sure "Auto run Python scripts" is ticked.

(Also be sure to click "Save User Settings" at the bottom because Blender always starts with a clean slate by default)

EDIT: Derp. Misintepreted your problem. According the PY source of the script, it's apparently made for Blender 2.68 and above. Maybe that's why it's not appearing in your copy of Blender.

EDIT 2: Confirmed as showing up in my version of Blender 2.69. Haven't actually used the script though, will have to try that when I have more time.

(I have a quick suggestion - the Rotation Steps control should be buttons that allow you to select either 8 or 16 only because right now with the way it's being setup as a vaue slider, it's possible to set it to ridiculous values that won't be useful for ZDoom usage and might be prone to user error. Or possibly a "mirrored" option so that it only exports half of the angles and intelligently names the files so that mirroring will work. See the wiki page Gez linked to for more info)

Re: Sprite Batch Render addon for Blender

PostPosted: Sun Jan 26, 2014 5:02 am
by Batandy
Updated to 2.69, still no results, it doesn't appear in the user settings' addon tab,again, i've tried to place it in the new addons folder and also installing it by loading the py file, nothing :(

Re: Sprite Batch Render addon for Blender

PostPosted: Sun Jan 26, 2014 7:34 am
by cce
Thanks for all the feedback!

I made a little update to the script applying the following changes:

  • Lowered the version requirement down to 2.60 (I hope it works!)
  • Added custom step name option to help when rendering 16-step rotation sprites
  • Removed custom frame name checkbox, custom frame names are now always used
  • Created a sample blend file: monkeeh.blend

Download at https://github.com/seece/SpriteBatchRender

Batandy wrote:Updated to 2.69, still no results, it doesn't appear in the user settings' addon tab,again, i've tried to place it in the new addons folder and also installing it by loading the py file, nothing :(

Make sure you placed sprite_batch_render.py at
Code: Select allExpand view
%APPDATA%/Roaming/Blender Foundation/Blender/$VERSION/scripts/addons
For example
Code: Select allExpand view
C:\Users\Username\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons


I also uploaded some scripts I used to postprocess the generated tiles. They are basically used to join multiple frames to a single tileset with Imagemagick, and to split them back to singular sprites afterwards. Use at your own risk :wink:

Re: Sprite Batch Render addon for Blender

PostPosted: Sun Nov 22, 2015 12:15 pm
by Nash
Hello, the example monkeeh.blend download isn't available anymore, can you please reupload it? Thanks. Nevermind, found it! The hyperlink is wrong but the text is the correct link. :D I was doing this hastily and didn't see that the text and the hyperlink were different.

EDIT: Had a lot of trouble figuring this out, here are some additional notes for anyone who's looking for information:

1) To setup the camera tracking setup that this script expects to work with:

- Delete any cameras in the scene if there are any, add a new camera (there must be only 1 camera in the scene) and position it however you want the sprite to end up looking like (adding a new viewport and using the camera view (keypad 0) might be helpful for you at this stage)
- With the camera selected, go to the Constraints tab (it should look like a chain, to the right of the Object tab)
- Add object constraint -> Track to
- For the Target, click it and choose the object you want to render (your monster/character/whatever)
- To: -Z
- Up: Y
- After setting the To and Up options correctly, the red colour from the constraint name should disappear, meaning it is now setup properly.

2) New users will most probably still get errors when trying to run this script. There is an oversight in the source code. In sprite_batch_render.py, line 169, the path needs to be fixed to this: C:/temp/sprite/sprite%s%s.png (it previously was using %s%d which was wrong. Alternatively, the user can just correct the path themselves before clicking the Render Batch button, but having the Python script fixed with the correct defaults is more user friendly)

3) HANDY TIP! If you plan to render your model with lighting, be sure to add constraints to your lights as well, with the Camera as the target. Depending on how your lights are setup, tick and untick the X, Y and Z boxes accordingly. If your lights don't have any constraints, the lighting will remain static, and because the script actually physically rotates the camera around the world, some angles in the render will have dark shadows, which you most probably do not want.

Re: Sprite Batch Render addon for Blender

PostPosted: Sun Nov 22, 2015 1:38 pm
by Gez
Nash wrote:Hello, the example monkeeh.blend download isn't available anymore, can you please reupload it? Thanks.


http://www.lofibucket.com/blender/monkeeh.blend works for me.

It's linked from the project's readme.

Re: Sprite Batch Render addon for Blender

PostPosted: Mon Nov 23, 2015 1:23 am
by Nash
Ahh I see it now; the hyperlink is wrong but the text is the correct link. :D I was doing this hastily and didn't see that the text and the hyperlink were different.

Re: Sprite Batch Render addon for Blender

PostPosted: Mon Nov 23, 2015 5:26 am
by Tormentor667
This is neat
Image

Re: Sprite Batch Render addon for Blender

PostPosted: Tue May 24, 2016 5:29 pm
by Nash
Hi cce, semi Blender related question... I hope you can help me out.

I'm trying to modify your script to write the camera's current angle in every frame to a text file... based on what I have so far, it seems to be writing the frame number correctly, but the angle of the camera seems to be ignored! What am I doing wrong here?

File with script embedded: https://dl.dropboxusercontent.com/u/473 ... ngle.blend

Re: Sprite Batch Render addon for Blender

PostPosted: Thu May 26, 2016 9:55 am
by MetallicaSepultura
i did a similar thing some days ago using maya, but since i don't think there's such plugin, i had to rotate the camera manually.

Re: Sprite Batch Render addon for Blender

PostPosted: Fri Sep 02, 2016 6:15 am
by cce
Nash wrote:based on what I have so far, it seems to be writing the frame number correctly, but the angle of the camera seems to be ignored! What am I doing wrong here?

The camera angle is read correctly, but because the script does no rotation it's the same every frame. You can see that the number written changes if you rotate the camera. So I guess you want to add back in the rotation from the original script :)

MetallicaSepultura wrote:i did a similar thing some days ago using maya, but since i don't think there's such plugin, i had to rotate the camera manually. --

Pretty sweet!

Edit: I also updated the plugin to be more user friendly. Now the camera stays still and just an user selectable object rotates. Grab the latest version from GitHub.