Sprite Batch Render addon for Blender

Any utility that assists in the creation of mods, assets, etc, go here. For example: Ultimate Doom Builder, Slade, WadSmoosh, Oblige, etc.
Forum rules
The Projects forums are ONLY for YOUR PROJECTS! If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
cce
Posts: 17
Joined: Tue Dec 11, 2012 8:12 am

Sprite Batch Render addon for Blender

Post 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.
Last edited by cce on Fri Sep 02, 2016 8:10 am, edited 3 times in total.
HavoX
Posts: 272
Joined: Wed Apr 11, 2012 10:31 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10 Pro 21H1
Graphics Processor: nVidia with Vulkan support
Location: St. Louis, MO

Re: Sprite Batch Render addon for Blender

Post by HavoX »

But then it would be cheating. :P

Still, looks very promising.
Gez
 
 
Posts: 17934
Joined: Fri Jul 06, 2007 3:22 pm

Re: Sprite Batch Render addon for Blender

Post by Gez »

It's interesting, though there is some subtlety with rotation steps. ZDoom supports [wiki=sprite]16 rotation angles[/wiki], 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"
User avatar
Nash
 
 
Posts: 17465
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: Sprite Batch Render addon for Blender

Post 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!
User avatar
Batandy
Posts: 1279
Joined: Tue Jul 19, 2011 2:56 am

Re: Sprite Batch Render addon for Blender

Post 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
User avatar
Nash
 
 
Posts: 17465
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: Sprite Batch Render addon for Blender

Post 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)
User avatar
Batandy
Posts: 1279
Joined: Tue Jul 19, 2011 2:56 am

Re: Sprite Batch Render addon for Blender

Post 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 :(
cce
Posts: 17
Joined: Tue Dec 11, 2012 8:12 am

Re: Sprite Batch Render addon for Blender

Post 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 all

%APPDATA%/Roaming/Blender Foundation/Blender/$VERSION/scripts/addons
For example

Code: Select all

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:
User avatar
Nash
 
 
Posts: 17465
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: Sprite Batch Render addon for Blender

Post 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.
Last edited by Nash on Mon Jan 25, 2016 10:11 pm, edited 4 times in total.
Gez
 
 
Posts: 17934
Joined: Fri Jul 06, 2007 3:22 pm

Re: Sprite Batch Render addon for Blender

Post 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.
User avatar
Nash
 
 
Posts: 17465
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: Sprite Batch Render addon for Blender

Post 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.
User avatar
Tormentor667
Posts: 13549
Joined: Wed Jul 16, 2003 3:52 am

Re: Sprite Batch Render addon for Blender

Post by Tormentor667 »

This is neat
Image
User avatar
Nash
 
 
Posts: 17465
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: Sprite Batch Render addon for Blender

Post 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
User avatar
MetallicaSepultura
Posts: 178
Joined: Sun May 15, 2016 3:49 am
Location: Futura City, currently slaughtering Rahzs

Re: Sprite Batch Render addon for Blender

Post 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.
cce
Posts: 17
Joined: Tue Dec 11, 2012 8:12 am

Re: Sprite Batch Render addon for Blender

Post 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.

Return to “Creation, Conversion, and Editing”