stormwyrm Posted August 19, 2015 Share Posted August 19, 2015 And so I found an extractor that worked with Ciel's Arcana, and had a look at the files inside. Most of the stuff is more or less straightforward, except that I noticed something strange about the character sprite images. All of them seem to be tinged somewhat blue. I take it that this is a special way of encoding alpha transparency without an explicit mask or alpha channel, but I can't for the life of me figure it out. Here's an example of what I'm talking about: For comparison, here's the same character as she appears in the game itself: Notice how her wings show alpha compositing effects. Is anyone familiar with this technique and can give me a hint as to how to extract the true colours of the image and the alpha channel from it? Quote Link to comment Share on other sites More sharing options...
CryingWestern Posted August 19, 2015 Share Posted August 19, 2015 It might be something to do with the extractor? Quote Link to comment Share on other sites More sharing options...
binaryfail Posted August 19, 2015 Share Posted August 19, 2015 Something isn't quite right with the extractor/converter. In your extracted image, I see that the color channels aren't in the correct order... -the blue channel -> alpha! -the green channel -> blue channel -the red channel -> green channel -the actual red channel is missing! but if you followed the pattern, the alpha channel -> red channel Whatever method you used to convert the original BMP to PNG did not preserve the alpha channel. Here is the converted sprite with the alpha channel: and then here is the corrected sprite with the channels swapped: stormwyrm and Darbury 2 Quote Link to comment Share on other sites More sharing options...
stormwyrm Posted August 20, 2015 Author Share Posted August 20, 2015 Hmm, the extractor produced .BMP files, and it might be that either the extractor failed to decode alpha channel information properly or the Gimp, which I used to convert the original .BMP into the .PNG that I uploaded, didn't read it correctly for some reason. It worked properly for all of the other graphics assets in the game though, except the character sprites, which is odd. Looks like it might be time to be digging into the extractor code... Thanks for the hint! Quote Link to comment Share on other sites More sharing options...
binaryfail Posted August 20, 2015 Share Posted August 20, 2015 The extractor should be working okay. It's the image converter... Many graphics editing tools like to ignore the alpha channel in BMP images, that includes Gimp. Although I actually used Gimp to do the channel swapping after I converted them to PNG. Quote Link to comment Share on other sites More sharing options...
stormwyrm Posted August 20, 2015 Author Share Posted August 20, 2015 Thanks to these hints I managed to get the .BMP files converted properly to .PNGs with the help of this quick and dirty Ruby script: #!/usr/bin/env ruby require 'tempfile' name = ARGV[0] basename = File.basename(name, ".bmp") puts name File.open(ARGV[0]) do |fp| fp.seek(0x12) width = fp.read(4).unpack("v").first fp.seek(0x16) height = fp.read(4).unpack("v").first fp.seek(0x0a) offset = fp.read(4).unpack("v").first fp.seek(offset) puts "#{width}x#{height} offset #{offset}" data = fp.read(width*height*4) tf = Tempfile.new([ARGV[0], ".rgba"]) tf.write(data) tf.close system("/usr/bin/convert -size #{width}x#{height} -depth 8 -flip -recolor '0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0' #{tf.path} #{basename}.png") tf.unlink end The key portion is the ImageMagick convert call down near the bottom and that recolor matrix. It seems there's hardly any software out there that can handle BMP files with alpha channels correctly, so we have to do this kind of hack. Quote Link to comment Share on other sites More sharing options...
Kelebek1 Posted August 20, 2015 Share Posted August 20, 2015 Most can, but alpha is only supported in 32-bit BMPs, which aren't standard (24-bit is the standard as far as I've seen, which is missing the alpha channel). I don't know how GIMP works, but with Photoshop you only specify the format to save or lose the alpha when saving, where you need to select 32-bit and you can then choose to save alpha. GIMP should have something similar, there's no way it won't handle alpha. Quote Link to comment Share on other sites More sharing options...
astro Posted August 20, 2015 Share Posted August 20, 2015 The extractor should be working okay. It's the image converter... Many graphics editing tools like to ignore the alpha channel in BMP images, that includes Gimp. Although I actually used Gimp to do the channel swapping after I converted them to PNG. BINARY FAIL LIVES ON Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.