[tool] Sprite Sheet Generator Current:0900 (64bit support!)

Freeform discussion about anything related to modding Transcendence.
steelwing
Militia Lieutenant
Militia Lieutenant
Posts: 100
Joined: Sun Aug 01, 2010 4:33 pm

Re: [tool] Sprite Sheet Generator

Post by steelwing » Sun Sep 11, 2011 3:28 am

Bobby wrote:
steelwing wrote:If that's so, then isn't the process I outlined with gimp perfectly good, once the facings are generated?
It will definitely work, I do something similar with all my ships as well. 1. assemble the images manually in gimp as they are rendered, using snap to grid. 2. copy the background by color, paste onto a new white layer.

Problems can arise if your source images are jpeg, or some other lossy compression, and the background isn't perfectly black, or if you leave on anti-aliasing and keep threshold greater than 0 on the color select tool, the process will leave slightly jagged dark edges which transparency would prevent. Also: I can't seem to get gimp to save in a monochrome bitmap, so I use paint to save the final mask image over itself and cut the file size.
digdug wrote:exactly, what i do is render or make all my graphics in BMP or another lossless format, and only at the end compress it to JPG (at various rates of compression to check the maximum compression you can do without too many jpeg artefacts)
Ah. PNG is supposed to be lossless, so I should be OK using that and then converting everything to JPG. Thankfully, ImageMagick makes that easy...

User avatar
Wolfy
Fleet Admiral
Fleet Admiral
Posts: 5345
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

Re: [tool] Sprite Sheet Generator

Post by Wolfy » Fri Sep 23, 2011 10:20 pm

steelwing wrote:
Wolfy wrote:The problem with photoscape is that it does not preserve transparency, which is why I went to the other sprite sheet generator, which had its own problems, which is why I made my own.
Does transparency matter? All graphics for Transcendence (except masks) are done on black backgrounds, anyway.
It does if you want higher quality transparency handling:
George (and generally most modders currently) use 1-bit bitmap, which result in black borders around ship sprites when they pass over a non-black region (or if you trim too close, a harsh anti-aliased edge to the sprite against the backdrop)
By preserving transparency, the alpha channel can be exported to an 8-bit bitmap, allowing for a proper blending of ship and backdrop, without having an unsightly border. This does however use more memory however.
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'hycrotan 'nonBinary))
Image

steelwing
Militia Lieutenant
Militia Lieutenant
Posts: 100
Joined: Sun Aug 01, 2010 4:33 pm

Re: [tool] Sprite Sheet Generator

Post by steelwing » Sun Sep 25, 2011 2:02 am

Wolfy wrote:George (and generally most modders currently) use 1-bit bitmap, which result in black borders around ship sprites when they pass over a non-black region (or if you trim too close, a harsh anti-aliased edge to the sprite against the backdrop)
By preserving transparency, the alpha channel can be exported to an 8-bit bitmap, allowing for a proper blending of ship and backdrop, without having an unsightly border. This does however use more memory however.
Ah. I'll have to see what it looks like in the game to see whether that matters for my mod or not...

User avatar
PKodon
Militia Lieutenant
Militia Lieutenant
Posts: 125
Joined: Sat Apr 18, 2009 6:03 pm
Location: "Minocs. I've got a baaad feeling about this.... This is no cave!"

Re: [tool] Sprite Sheet Generator

Post by PKodon » Wed Oct 12, 2011 11:33 am

I've been using IrfanView's panoramic stitching to make my sprite sheets, especially for animated ships.

First I make the vertical strips, then stitch those together horizontally to get the animation frames. You can also use it to convert from one file format to another (png/jpg/bmp/etc.), and to reduce the number of colors to get either a 256-color gray scale mask (which I did for the FalconCV's custom "nozzle" image) or one-bit mask (where you only need to mask off what's not the image).

It also does a good job of resizing, can use filters, do cropping, change the "canvas" size (I used this to move the frames of the "nozzle" image around, a pixel at a time to get them to line up with the ship), even change colors on various things.

It's also great for going through reams of images, as you can either flip through them one by one, or pick them from a browser window that shows them as a grid of thumbnails.
"Don't ask ..., I don't wanna know, and I don't wanna care!" - PK
Meet us on IRC --> Image
"... the hornet battlepod is the closest we have ingame to flying into battle in a wheelbarrow
with a bathtub nailed upside down to the top of it to provide armor."
- The Shrike

User avatar
Wolfy
Fleet Admiral
Fleet Admiral
Posts: 5345
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

Re: [tool] Sprite Sheet Generator Current:0813

Post by Wolfy » Sat Mar 17, 2012 3:32 am

Ok, I FINALLY got around to remembering to post an updated version of this. 0813 is out with stability improvements, and some other minor changes.

I hope to push out 0820 with a fix for that ever annoying issue of not being able to use images that are taller than they are wide.
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'hycrotan 'nonBinary))
Image

User avatar
Wolfy
Fleet Admiral
Fleet Admiral
Posts: 5345
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

Re: [tool] Sprite Sheet Generator Current:0813

Post by Wolfy » Sat Mar 17, 2012 3:48 am

And its done, 0820 is out. Turns out it was just a single word I needed to change (Width to Height >.<)
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'hycrotan 'nonBinary))
Image

User avatar
RPC
Fleet Admiral
Fleet Admiral
Posts: 2839
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Re: [tool] Sprite Sheet Generator Current:0820

Post by RPC » Thu Apr 26, 2012 11:24 am

I was just reviewing this thread and I'm stuck on this part by steelwing:
steelwing wrote:To render the facings themselves, I used Blender. Once I had my model worked out and my camera and light positioned, I wrote the script below to render all 40 facings automatically. This uses Blender 2.5 APIs, so don't try it in 2.4x or earlier. Paste it in a text viewer pane and hit alt+p to run.
How am I supposed to get to this part on Blender?
Tutorial List on the Wiki and Installing Mods
Image<----- click to get to #Transcendence IRC on Freenode
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.

User avatar
sdw195
Militia Captain
Militia Captain
Posts: 779
Joined: Wed Nov 18, 2009 1:01 am
Location: Still looking for the csc Antarctica
Contact:

Re: [tool] Sprite Sheet Generator Current:0820

Post by sdw195 » Thu Apr 26, 2012 9:29 pm

ask starweaver, he has some blender script to render then turn then render etc :D
Image
Image
Image
Image
"Dash_Merc - George is a genius, in that he created this game engine that is infinitely extendable"
"<@sheepluva>Good night everybody, may the source be with you." <-- FOSG dev
"You only need THREE tools in life - WD-40 to make things go, Duct Tape to make things stop And C-4 to make things go away"

steelwing
Militia Lieutenant
Militia Lieutenant
Posts: 100
Joined: Sun Aug 01, 2010 4:33 pm

Re: [tool] Sprite Sheet Generator Current:0820

Post by steelwing » Fri Apr 27, 2012 1:11 pm

RPC wrote:How am I supposed to get to this part on Blender?
You need a text viewer window in Blender. Paste the code from my post into that, then press alt+p.
Have your model, lights, and camera already positioned, with your model facing "north". The script will then do the render+turn+render thing from there.

User avatar
Wolfy
Fleet Admiral
Fleet Admiral
Posts: 5345
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

Re: [tool] Sprite Sheet Generator Current:0850

Post by Wolfy » Fri Jul 20, 2012 6:28 pm

0.8.5.0 is now up

It has an alphabetic sort feature and runs on a lower framework than before (3.5 instead of 4.0). Also minor perf improvements for large images from threading some stuff.
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'hycrotan 'nonBinary))
Image

User avatar
Wolfy
Fleet Admiral
Fleet Admiral
Posts: 5345
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

Re: [tool] Sprite Sheet Generator Current:0900 (64bit suppor

Post by Wolfy » Tue Oct 01, 2013 8:36 am

0.9.0.0 is up - Its a 64bit version, so you can make even bigger spritesheets! (Assuming you have the ram to do so)

A large address aware 32bit version will come soon too.

Both branches will be maintained, and there will be a new numbering system to designate which version is for what platform.
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'hycrotan 'nonBinary))
Image

User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

Re: [tool] Sprite Sheet Generator Current:0900 (64bit suppor

Post by pixelfck » Sun May 25, 2014 11:57 am

I thought I would just share my PHP spritesheet stitcher script here:

Code: Select all

<html><head><title>Transcendence Frame Stitcher</title></head><body><pre>
<?php
define('SOURCE_PATH', 'frames');
define('SOURCE_FILENAME_BASE', 'enter_file_name_here'); // expects file names written as: ship0000.png

define('OUTPUT_PATH', '.');
define('OUTPUT_FILENAME', SOURCE_FILENAME_BASE);

$imgSources = array();
if ($dh = opendir(SOURCE_PATH)) {
	while (false !== ($node = readdir($dh))) {
		if (substr($node, 0, strlen(SOURCE_FILENAME_BASE)) <> SOURCE_FILENAME_BASE) {
			continue;
		}
		$imgSources[] = $node;
	}
}
$frameCount = count($imgSources);

echo "Stitching  $frameCount frame(s)...";
		
$imgOut = null;
$imgOutMask = null;
foreach ($imgSources as $frame) {
	$imgSource = imagecreatefrompng(SOURCE_PATH.'/'.$frame);
	
	if (null === $imgOut) {
		$width = imagesx($imgSource);
		$height = imagesy($imgSource);
		$imgOut = imagecreatetruecolor($width, $height * $frameCount);
		$imgOutMask = imagecreatetruecolor($width, $height * $frameCount);
		imagefill($imgOutMask, 0, 0, imagecolorallocate($imgOutMask, 0, 0, 0));
		$offset = 0;
	} else {
		$offset += $height;
	}
	flush();
	
	for ($x = 0; $x < $width; $x++) {
		for ($y = 0; $y < $height; $y++) {
			$pixel = imagecolorsforindex($imgSource, imagecolorat($imgSource, $x, $y));
			$alpha = 255 - $pixel['alpha'] * 2;
			imagesetpixel($imgOutMask, $x, $offset + $y, imagecolorallocate($imgOutMask, $alpha, $alpha, $alpha));
		}
	}
	imagecopy($imgOut, $imgSource, 0, $offset, 0, 0, $width, $height);
	imagedestroy($imgSource);
}
echo " done\n";
imagejpeg($imgOut, OUTPUT_PATH.'/'.OUTPUT_FILENAME.'.jpg', 95);
imagepng($imgOutMask, OUTPUT_PATH.'/'.OUTPUT_FILENAME.'Mask.png', 0);
imagedestroy($imgOut);
imagedestroy($imgOutMask);

echo '<img src="'.OUTPUT_PATH.'/'.OUTPUT_FILENAME.'.jpg?cd='.time().'" width="'.$width.'" height="'.($height * $frameCount).'" alt="" style="padding:0 2px;"/>';
echo '<img src="'.OUTPUT_PATH.'/'.OUTPUT_FILENAME.'Mask.png?cd='.time().'" width="'.$width.'" height="'.($height * $frameCount).'" alt="" style="padding:0 2px;"/>';
?></pre><body></html>
It was never written with user-friendliness in mind, it only supports 32-bit (=rgb+alpha) png images, requires source frames to be numbered with 4-digits (starting from 0000) and outputs a JPEG and PNG image.

Feel free to use, expand, improve or ignore it as you wish.

Cheers,
Pixelfck
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest