Author Topic: [FF7] Dramatically improved pre-rendered backgrounds - FacePalmer (v3.0)  (Read 129282 times)

Omzy

  • *
  • Posts: 205
    • View Profile
Updated 7/16/12, fixed lighting textures issue, Thanks to Aali on getting missing files imported = PROJECT COMPLETE
*This is the thread for the Photoshop script, not for the mod pack release. I've updated that with the new downloadable backgrounds. See Omzy's FFVII Field Pack for that.

FacePalmer v3.0
A Final Fantasy VII Texture Resizing Batch Script for Photoshop CS5.1

Examples of what this script can do (click pictures to enlarge):




Bowl on Don's desk:


Requirements
Requires Aali's Palmer 0.7b for input and conversion
Rheikon's Frontend helps a lot with Palmer's batch functions
Requires Adobe Photoshop CS5.1 (untested on other versions)
Recommended ExtendScript Toolkit for script editing
Requires Perfect Resize 7.0 Professional Edition (PS Plug-in)
Requires Perfectum Filter v1.4 (PS Plug-in)
Requires Aali's OpenGL Driver to play in-game
Tested under Windows 7 32-bit

Script Instructions
1) Extract flevel.lgp using UnLGP
2) Copy and paste the script into a text editor and save as a .jsx
3) This script must be placed into %Photoshop%\Presets\Scripts
4) Batch export layers to PNGs in Palmer
5) Place all of these folders inside %Photoshop%\ff7TexturesIN\
6) Open Photoshop, run File->Scripts->FacePalmer
7) Open Palmer again and batch import the folders in %Photoshop%\ff7TexturesOUT\
8 ) Place all new folders in Palmer's output folder into %FFVII%\mods\%modpath%\field\
9) Play the game!

Special Cases
The following files still need to be hand-finished after running the script:
blin69_1, chorace, chorace2, hyou5_2, itown1a, itown2, itown12, junair, junonl2, junonr2, las1_1, las4_2 (missing block bug in original game), las4_3 (missing block bug in original game), losin1, onna_5, sango2, ship_2, sininb41, trnad_1, trnad_3, uttmpin4, whitein, zcoal_1, zcoal_3

Script
FacePalmer_v3.0.jsx
« Last Edit: 2014-07-17 17:50:59 by Covarr »

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: [REL] FacePalmer 1.0
« Reply #1 on: 2011-06-05 12:18:30 »
facepalmer hahaha  love it.

If this works like I think it does, it will be a huge help to people! 
« Last Edit: 2011-06-05 12:21:27 by DLPB »

Omzy

  • *
  • Posts: 205
    • View Profile
Re: [REL] FacePalmer 1.0
« Reply #2 on: 2011-06-06 21:43:45 »
I've been trying to research how to take my layered images and convert them into textures used by the game and Aali's driver (texture folder), but I just don't understand it. Can someone tell me what kind of conversion takes place to make a file go from this:
http://imageshack.us/photo/my-images/219/nmkin000000000.png
to this:
http://imageshack.us/photo/my-images/651/nmkin0000.png
?

If I can figure the algorithm out (is it LZS somehow?), then I can make this program independent of Palmer following the extraction process so anyone can easily increase the resolution of their game.

Edit: Nevermind, I found the info I needed in http://wiki.qhimm.com/FF7/Field/Background. Does anyone know if that information is up-to-date or if some of the unknowns have been found? Thanks.
« Last Edit: 2011-06-06 23:02:30 by Omzy »

yarLson

  • *
  • Posts: 708
  • spr nrd
    • View Profile
Re: [REL] FacePalmer 1.0
« Reply #3 on: 2011-06-08 21:04:23 »
sounds interesting but what I want to know it is: do you actually got any of these working in game. if so bravo I'll take a look at it as soon as I can. although I wanna point out for the most part I am actually not doing anything by hand. there are a few places where the images must be edited by hand yes but thanks to some very complex photoshop actions I actually automated most of the process. I can say with confidence that I would already be over 50 percent done with the entire game however my computer was destroyed and I need some time to get another machine. that's not to say that I'm not interested in what your doing. I'll look into it as soon as I can and until then I want to wish you the best of luck. if you succeed I would be more than happy to show you the methods I'm using to get the image quality that I have.

Omzy

  • *
  • Posts: 205
    • View Profile
Re: [REL] FacePalmer 1.0
« Reply #4 on: 2011-06-08 22:31:04 »
Thanks for your reply yarLson, I'd like to work with you guys to get this thing ready and usable. I've only got until mid July to work on this, so I'd appreciate any developer support and help I can get. I'd also like to give you guys props for figuring out the fractal method and putting effort into this aspect of the game.

Of the 6 image sets I've tried it on so far, they have worked in game 100% on 5 and 99% on the other (chorace). I know exactly why it makes a mistake on that one file and I've adjusted the algorithm to make this mistake as minor as possible, but I'd like it tested on more image sets so I can see what else I'm up against. With more understanding of the way that the field background files work, I'm sure I can make it work 100% across the board.

I think I should've explained how the script works instead of just posting the code. Let me try that now, so you can see why it should produce working image sets. I've added a section above describing the process. Please read that and let me know what you think.

Update: I'm working on extracting the images from flevel.lgp myself so I have more control over the batch processing of the images. This should hopefully result in a new little c++ tool. I'm looking into the LZS decompressor from Q-Gears as a start. After I can decompress the LZS's, I should be able to parse each field background file for its image data, utilizing the information from http://wiki.qhimm.com/FF7/Field/Background. This data can then be batch extracted into PNGs, which the photoshop script can resize. Then, using the same c++ program, the resulting files can be batch converted to ff7 textures using the same idea. This should allow for wholesale modification of any sort on all background images. (This really isn't any different from Palmer--it will just allow us to batch process images easily.) If anyone with experience would like to help, please let me know. I could use some collaboration.
« Last Edit: 2011-06-11 21:04:35 by Omzy »

Borde

  • *
  • Posts: 891
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #5 on: 2011-06-23 17:38:32 »
I recall there was a command-line LGP unpacker/packer (Highwind, created by Aali, if I remember correctly) and also a command-line LZS decompressor/compressor made by Qhimm ages ago. I'd suggest you using those. As for decoding tha background data, I must warn you I used that format desription long ago (I think it hasn't changed, but I could be wrong) and I didn't get too far. The resulting images had several artifacts and for some of them I couldn't even get anything recognizable. Palmer must use some way more complete format description. Maybe Aali decoded it himself? I wouldn't be surprised.

Anyway, whish you a lot of luck, because I think this could be quiet useful. I thought about doing something like this long ago. But so many things got in my way I never even started :-P
« Last Edit: 2011-06-23 17:46:47 by Borde »

sl1982

  • Administrator
  • *
  • Posts: 3764
  • GUI Master :P
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #6 on: 2011-06-23 18:20:30 »
Holy shit its borde, glad to see you back.

Borde

  • *
  • Posts: 891
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #7 on: 2011-06-23 18:38:01 »
Jejeje! Glad to see you still around too sl1982. Sure I've been away for a while...
But I see you guys have been working though all this time. Looks like I've got a lot to catch up with.

Omzy

  • *
  • Posts: 205
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #8 on: 2011-06-24 03:02:29 »
I actually figured all that stuff out. Snagged Q-gears' filesystem code for UnLZSing and it worked like a charm. I used the reference on the wiki to decode the field backgrounds, but found that it was far from complete, as you said. Firstly, for animations (Sfx!=0), you need to use ZZ3[0] and ZZ3[1] instead of SrcX and SrcY. Apparently there are more than BG1 and BG2 sprites in some field files (think BG3 and BG4) and they have similar structures (length followed by 12 bytes of unknown data followed by sprite data). This explained most of the misaligned/messed up textures like anfrst1. These extra sprite groups include the parallax layers. After that, there are little black spots that appear on many textures which have a masking bit of 1 (1 00000 00000 00000), which simply means to use the first color in the palette (got this tidbit from asking Aali). While I wrote an entire viewer for it, it is not nearly as complete and robust as Palmer. Since Aali's new release I have little use for my program so I'm working on getting this script to full working order now.
« Last Edit: 2011-06-24 03:05:44 by Omzy »

Borde

  • *
  • Posts: 891
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #9 on: 2011-06-24 22:18:17 »
Excelent Omzy. It's nice to see you found out the missing pieces of the format description. Good luck with the project.

Template

  • *
  • Posts: 862
  • Life is a series of cats.
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #10 on: 2011-06-24 22:26:46 »
I just wonder what kind of file size we will end up with after fractal resizing the entire games backgrounds?

Omzy

  • *
  • Posts: 205
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #11 on: 2011-06-25 02:24:22 »
One would guess for doubly resized, you're looking at 4x the texture size and for quadruply resized, you're looking at 16x. However, since PNG compression isn't simply a bitmap of pixels, the file sizes differ from those estimates depending on the number of colors in the image. For an example reference:

md1stin (first scene in the game):
512x512 (original): 0.31mb
1024x1024: 2.08mb
2048x2048: 5.89mb

As a REALLY rough estimate, we can multiply these by the number of background files (689) to get:
512x512 (original): 0.21gb
1024x1024: 1.43gb
2048x2048: 4.06gb

The huge difference between the original and the doubly resized is probably the result of the fractal algorithm adding a lot of different colors while the relatively small difference between the doubly resized and quadruply resized is probably due to the fact that PNG compression becomes more efficient as the number of pixels increases and the number of colors remains the same.
« Last Edit: 2011-06-25 02:32:02 by Omzy »

jeffdamann

  • *
  • Posts: 732
  • The ORIGINAL!
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #12 on: 2011-06-25 05:02:51 »
I dont care if this game takes 100gb of space as long as it blows my mind away.

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #13 on: 2011-06-26 00:03:06 »
I just wonder what kind of file size we will end up with after fractal resizing the entire games backgrounds?
Very large which is why I asked that people use jpeg which at higher encoding rates would not be really all that different to png but would be significantly smaller.

I was not taken seriously :P  But I think this mod suffers with this problem and I think jpeg support would solve it.  Unless I am playing this ona  bluray I dont want 1 mod taking tons of space.

Marc

  • *
  • Posts: 445
  • I hear Voices ... in my head
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #14 on: 2011-06-30 03:15:00 »
I'd like to use this tool to repack the backgrounds since I'll soon be starting a video recording process for the ff7voice project and I'd like to have the best possible backgrounds.

However I wanted to know if the algorithm was fine tuned to give the best possible results and if any artifacts would remain after palmer's latest update ?

Omzy

  • *
  • Posts: 205
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #15 on: 2011-07-01 05:40:18 »
@DLPB - support for jpg would depend on Aali's OpenGL driver support and atm it uses png's. Considering the difficulty of writing an algorithm that accounts for more than a hundred special cases, I'm not too worried about optimization right now. Can always improve speed and size later.

@Marc - thanks for your interest in this mod. The new script I'm writing depends on Palmer (0.6b). I am working diligently to put out a 2.0 version and I anticipate being finished in the next couple of weeks. The current script only works on standard backgrounds with a background, foreground, and alpha animations without any special case requirements. When 2.0 is finished, it should be capable of batch resizing every single field background without artifacts (assuming Palmer is perfect at importing its own exports at this point), so hang tight  :-D

Also, I welcome any info on the actual filters and resizing parameters in photoshop to get the best quality images at 2x and 4x, if anyone has some numbers for me. That's the one part I haven't spent much time on that others have.

Marc

  • *
  • Posts: 445
  • I hear Voices ... in my head
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #16 on: 2011-07-02 17:37:37 »
yarlson and sl1982 had defined nice settings for their perfect resize methods.  They should be able to provide you with their ideal settings.

I think yarlson investigated these a bit further than sl did.

yarLson

  • *
  • Posts: 708
  • spr nrd
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #17 on: 2011-07-13 19:15:41 »
I apologize everyone, I have been really busy lately and I haven't even been on in a while. I have in my possession a MacBook Pro that a friend has lent to me to help with my new business. If I can get everything set up the way I had it, I will continue work on my project once again and I will also help Omzy out with this project. Should only be a few days, I will post in my thread when I begin work again. Only thing that I am worried about is that there is no mac version for some of the plugins I was using then again, I have never used photoshop on a Mac so this may be totally incorrect. I still have all my settings saved and I will try to get them to you soon.

Template

  • *
  • Posts: 862
  • Life is a series of cats.
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #18 on: 2011-07-13 19:41:54 »
gogogogogogogo! so looking forward to testing some new field bgs. Really wish I could get into doing some of this work myself, but I'm fairly sure my old P4 3.2 couldnt hack it

Omzy

  • *
  • Posts: 205
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #19 on: 2011-07-17 04:03:50 »
gogogogogogogo! so looking forward to testing some new field bgs. Really wish I could get into doing some of this work myself, but I'm fairly sure my old P4 3.2 couldnt hack it
That's sure a motivator  :-P
I just moved into a new apartment and I'll do my best to work on it over the next week. I may end up posting the finalized photoshop script without proper resizing parameters, but that can be filled in by others like yarlson and sl1982 when they get a chance. At this point I'm ironing out the special cases, which is tedious work.

yarLson

  • *
  • Posts: 708
  • spr nrd
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #20 on: 2011-07-19 17:46:35 »
for texture enhancement in perfect resize just put all 3 sliders as low as possible, then use unsharp mask with the standard settings. Do it x4, because x2 isn't good enough. I would then run a "reduce noise filter" (to remove color distortion) with settings of

strength: 2
preserve detail: 100%
remove color noise:50%
sharpen detail: 25%

at this point I would then apply a film grain of 15% with contrast unchanged, then I would run the Perfectum filter at 40% smoothing
http://www.redfieldplugins.com/filterPerfectum.htm

this added a very nice "add detail" effect without adding any visible or undesirable grain

that's the best I've come up with so far besides manual edits, hope it helps

Omzy

  • *
  • Posts: 205
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #21 on: 2011-07-20 05:53:08 »
Thanks a lot yarLson! I'll try to design that part modularly so it can all be plugged into one function. That should make the products of this script look perfect. The one thing I am concerned about is the time it will take to run, but if I can run it on my machine with those parameters and then distribute the content in another way, let me know. I'm not sure what the rules on that are here. Perhaps that is better than simply posting the script since it requires some specific software and hardware to work.
« Last Edit: 2011-07-20 05:56:21 by Omzy »

Marc

  • *
  • Posts: 445
  • I hear Voices ... in my head
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #22 on: 2011-07-20 13:26:37 »
I'd personally think both alternatives would work great.  A script for those that want to do it themselves and a finished pack for those that don't.

Does perfect fractals have a demo version per chance ?  If so, any limitations or is it time based ?

sl1982

  • Administrator
  • *
  • Posts: 3764
  • GUI Master :P
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #23 on: 2011-07-20 14:18:56 »
Watermarked I believe.

Omzy

  • *
  • Posts: 205
    • View Profile
Re: [WIP] Keystone v1.1
« Reply #24 on: 2011-07-20 16:36:57 »
Does it? I've got the full version  ::), but I thought their full image-editing software suite has the watermark and perfect resize alone is a fully-featured trial.