[Guide] Making spritesheets with Blender

Place to post guides, observations, things related to modding that are not mods themselves.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [Guide] Making spritesheets with Blender

Post by darkfrei »

Also, for spritify you can use this tool: Just insert yours sprites and start the .bat-file what you need or make the new one.
Factorio_IMagick.7z
(5.18 MiB) Downloaded 318 times
Make this code, then it's not crop sprite at 128 pixels anymore. And it makes one sprite sheet with 8 columns.

Code: Select all

montage "Sprites/file*.png" -geometry +0+0 -tile 8x -background rgba(0,0,0,0) -quality 100% Sprite_x_8x.png
With 8 raws:

Code: Select all

montage "Sprites/file*.png" -geometry +0+0 -tile x8 -background rgba(0,0,0,0) -quality 100% Sprite_x_x8.png
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [Guide] Making spritesheets with Blender

Post by darkfrei »

If your sprites have too big alpha border, it can be cropped with this script:

Code: Select all

magick "Input/*.png" -background none ^
   ( -clone 0--1 -layers merge ^
   -set option:cropper "%%[@]" +delete ) ^
   -crop %%[cropper] +repage ^
   MIFF:- | magick montage MIFF:- -background none ^
   -tile 2x2 -geometry +0+0 Output\best_spritesheet_2x2.png
Examples, code from this forum, a lot of thanks to GeeMack.

Pros: You are cut all alpha from sprites, so your spritesheet will have much tiny dimensions. All sprites have same dimensions, no pixel with graphics will be deleted.
How to use: place your sprites to Input folder and start .bat-file.
Factorio_IMagick_best_spritesheet.7z
Example
(5.03 MiB) Downloaded 306 times
Code for rotating clockwise 90 degree.

Code: Select all

magick "Input/*.png" -background none ^
   -rotate 90 ^
   Input/rotated_90_%%04d.png
Mirroring

Code: Select all

magick "Input/*.png" -background none ^
   -flop ^
   Input/flop_%%04d.pnge
User avatar
JesseDGamer
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Jul 26, 2018 12:59 am

Re: [Guide] Making spritesheets with Blender

Post by JesseDGamer »

For people having trouble when trying to generate the sprite sheet, specifically when blender can't find the "montage.exe" file, here's a fix I did.
I replaced line 121 in the spritify.py file with the full path + file name of the montage.exe that ImageMagick installed :

Code: Select all

"C:\Program Files\ImageMagick-7.0.8-Q16\montage.exe",
where it used to be

Code: Select all

"montage",
Idk for sure, but I think it has something to do with environment variables or something.

My problem now is that it's removing transparency from all the output images no matter what color I choose for the background... I've done a little research and found it might be a bug with montage.exe. Idk.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [Guide] Making spritesheets with Blender

Post by darkfrei »

JesseDGamer wrote:My problem now is that it's removing transparency from all the output images no matter what color I choose for the background... I've done a little research and found it might be a bug with montage.exe. Idk.
Don't forget this part:

Code: Select all

-background none
User avatar
Oceanel
Burner Inserter
Burner Inserter
Posts: 12
Joined: Tue Aug 12, 2014 9:58 am
Contact:

Re: [Guide] Making spritesheets with Blender

Post by Oceanel »

darkfrei wrote: Wed Jan 17, 2018 9:45 pm If your sprites have too big alpha border, it can be cropped with this script:

Code: Select all

magick "Input/*.png" -background none ^
   ( -clone 0--1 -layers merge ^
   -set option:cropper "%%[@]" +delete ) ^
   -crop %%[cropper] +repage ^
   MIFF:- | magick montage MIFF:- -background none ^
   -tile 2x2 -geometry +0+0 Output\best_spritesheet_2x2.png
How to use: place your sprites to Input folder and start .bat-file.
Factorio_IMagick_best_spritesheet.7z
...

Thanks, very helpful!

Add more:
If you want like this
fi-basic-farmland_07_4x.jpg
fi-basic-farmland_07_4x.jpg (209.37 KiB) Viewed 9177 times
Use such code:

Code: Select all

magick "Input/*.png" -background none ^
   ( -clone 0--1 -layers merge ^
   -set option:cropper "481x337+328+315" +delete ) ^
   -crop %%[cropper] +repage ^
   MIFF:- | magick montage MIFF:- -background none ^
   -tile 2x2 -geometry +0+0 Output\best_spritesheet_2x2.png
pause

And, for making icon 128x128 use this:

Code: Select all

magick "Input/*.png" -background none ^
   ( -clone 0--1 -layers merge ^
   -set option:cropper "%%[@]" +delete ) ^
   -crop %%[cropper] +repage ^
   MIFF:- | magick convert MIFF:- -background none ^
   -adaptive-resize 128x128 -gravity center -extent 128x128 best_icon_128b.png
pause
transparent background supported.
best_icon_128b.png
best_icon_128b.png (22.44 KiB) Viewed 9171 times
Kalshion
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Mar 22, 2018 12:05 am
Contact:

Re: [Guide] Making spritesheets with Blender

Post by Kalshion »

I hate bumping up very old threads, but my search through the forums hasn't been very good.

Blender recently had a major update to their UI, and I'm wondering if anything in this thread no longer applies (I noticed in the images it uses Blender Internal which doesn't exist anymore)
gabberworld
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat Aug 17, 2019 11:06 pm
Contact:

Re: [Guide] Making spritesheets with Blender

Post by gabberworld »

seems way too complicated, and too much work

but i guess everyone sees this different as there different methods how todo this at blender
gabberworld
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat Aug 17, 2019 11:06 pm
Contact:

Re: [Guide] Making spritesheets with Blender

Post by gabberworld »

Kalshion wrote: Tue Oct 22, 2019 7:24 pm I hate bumping up very old threads, but my search through the forums hasn't been very good.

Blender recently had a major update to their UI, and I'm wondering if anything in this thread no longer applies (I noticed in the images it uses Blender Internal which doesn't exist anymore)
there is one thing, even if blender have new update, it not meas you must use that new one

im still using the 2.79 and not see why i should use the new one
aerd2
Manual Inserter
Manual Inserter
Posts: 1
Joined: Tue May 05, 2020 9:30 am
Contact:

Re: [Guide] Making spritesheets with Blender

Post by aerd2 »

Great! here goes my bookmark. I'm a newbie at 3d modelling, but I will try my best and maybe create something worthwhile.
jmattspartacus
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sat Jul 09, 2016 2:59 am
Contact:

Re: [Guide] Making spritesheets with Blender

Post by jmattspartacus »

So, Blender has a number of things that are different/not working from this tutorial, but they're easy enough to get around.
Firstly, changing background to transparent in 2.8 has to be done something like
https://blender.stackexchange.com/quest ... d-in-eevee

Secondly, the shadow receiver plane doesn't work with the new default render engine, and I haven't figured that out yet.

Lastly, the spritify tool wasn't working for 2.8, so I updated it
https://github.com/jmattspartacus/blender_spritify

I'll make a separate forum post about updating it.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [Guide] Making spritesheets with Blender

Post by darkfrei »

jmattspartacus wrote: Sat May 09, 2020 6:36 am Lastly, the spritify tool wasn't working for 2.8, so I updated it
https://github.com/jmattspartacus/blender_spritify

I'll make a separate forum post about updating it.
Can you adjust it to use this code? Here is a special cropping before the spritesheet.

Code: Select all

magick "Input/*.png" -background none ^
   ( -clone 0--1 -layers merge ^
   -set option:cropper "%%[@]" +delete ) ^
   -crop %%[cropper] +repage ^
   MIFF:- | magick montage MIFF:- -background none ^
   -tile 2x2 -geometry +0+0 Output\best_spritesheet_2x2.png
jmattspartacus
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sat Jul 09, 2016 2:59 am
Contact:

Re: [Guide] Making spritesheets with Blender

Post by jmattspartacus »

I'll look into this in a bit, currently working on finishing up texturing some models to render.
User avatar
DeathApocalypse
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sun Jun 21, 2020 2:50 am
Contact:

Re: [Guide] Making spritesheets with Blender

Post by DeathApocalypse »

SkaceKachna wrote: Tue Aug 12, 2014 9:21 pm This guide was created for Blender 2.66a, but should apply to any other version (UI might hav....
Thank you so much, SkaceKachna! that was extremely useful guide.
in blender 2.8 with Eevee renderer it was a bit different, but still easy.
btw I've updated the script to work with blender 2.8

Download the updated script here.
Watch this video of how to make shadow-catcher
and now... let's make some explosives.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [Guide] Making spritesheets with Blender

Post by darkfrei »

DeathApocalypse wrote: Sun Jun 21, 2020 3:54 am Thank you so much, SkaceKachna! that was extremely useful guide.
in blender 2.8 with Eevee renderer it was a bit different, but still easy.
btw I've updated the script to work with blender 2.8

Download the updated script here.
Watch this video of how to make shadow-catcher
Thanks, it was to easy to make the proper shadowcatcher. I've made very easy model for example.
Blender 2.82a
vehicle_eevee_01_02.blend.7z
(139.43 KiB) Downloaded 177 times
blender_2.82a.png
blender_2.82a.png (244.13 KiB) Viewed 7667 times
pictures
User avatar
Phantom329
Inserter
Inserter
Posts: 29
Joined: Sun Aug 21, 2016 11:44 pm
Contact:

Re: [Guide] Making spritesheets with Blender

Post by Phantom329 »

What is the scale in Blender compared to the game? I will be importing models from SolidWorks using mm scale.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [Guide] Making spritesheets with Blender

Post by darkfrei »

Phantom329 wrote: Tue Sep 08, 2020 8:10 am What is the scale in Blender compared to the game? I will be importing models from SolidWorks using mm scale.
1 meter (or 1 unit) is 32 and 64 pixels for low and high resolutions. The tile size.

Set the camera to orthogonal mode, set the output resolution to 512x512 pixels, it will be the area size of 8x8 tiles for hr graphics.
Post Reply

Return to “Modding discussion”