Rogueadyn / SaintCoinach

A .NET library written in C# for extracting game assets and reading game assets from Final Fantasy XIV: A Realm Reborn.
Do What The F*ck You Want To Public License
70 stars 99 forks source link

Add properties for map image extraction of both sizes found in the game. #22

Closed ufx closed 9 years ago

ufx commented 9 years ago

Great work on Godbert btw. I'd like to automate extracts of monster, item, and NPC renders with your graphics work.

Rogueadyn commented 9 years ago

Nice work on the maps. I changed the image processing to work directly on the buffers, no need to go through Image, but other than that it's still doing the same.

As for the renders, the way it's set up it should be relatively simple to subclass the engine so it renders to images. All (or at least most) models supply their bounding boxes too, so setting up the viewport is just a matter of a bit of simple math. I could probably make something for you to use as a base pretty quickly, unless you want to try your hand at it yourself, just let me know. Of course the render quality is at times a long way off from the game.

Humanoid NPCs probably won't be supported anytime in the near future, that would require the deforming for different races, all character customization, and how attaching of equipment works to be known. Demi-humanoid NPCs should be more workable, can only think of 11 customization options for them, and apart from finding those they're simple ones (scaling, five equipment slots, as well as skin, eye, and hair colours.)

ufx commented 9 years ago

Thanks, those changes look much better. I'm pretty new to image processing and 3d stuff, so the simpler the better on APIs for setting up renders =). I can probably figure it out given some time though. Your code has been quite easy to follow.

That's understandable about the humanoids. The biggest request I see is item renders, especially furniture and armor for glamour.

Rogueadyn commented 9 years ago

All right, made a simple image renderer, and a class that makes it render equipment. Basic usage if you want to render all items in all colours at 1024x1024 is:

var items = GameData.GetSheet<Item>();
var stains = GameData.GetSheet<Stain>();
var renderSource = new EquipmentImageRendererSource(items, stains);
using (var renderer = new ImageRenderer(renderSource, 1024, 1024)) {
    renderer.Run();
}

The stains argument is optional, can be removed to have it only render undyed versions. It'll write to Console.Error if a model failed to load/render, other than that the only output is images. Spinning and grinding wheels fail to load at the moment, I'll look into that later.

It only uses the male Hyur Midlander models, unless there is a race/gender restriction on it. For female models the source will have to be modified. RaceCharacterTypes all increased by 100 and MoveNext() modified to make sure the item can actually be equipped by female characters.

Furniture models haven't been added yet, but I've already found where it stores their unique model numbers, just a matter of figuring out path formats for the different furniture categories and adding it in code now, so shouldn't be long.

Note: If you do decide to run the above code as-is make sure there is plenty of free space on your storage device (and time to have it run.) I had it running, and up to item # 3299 it had already generated ~55000 files at 14.5GB total. May want to consider ignoring dyed versions (colours aren't accurate to the game anyway), reducing the resolution, or use the alternative constructor of ImageRenderer which lets you specify the output format and background color.

Edit: Noticed that the tips of some boots are cut off, will adjust that later. Adjusted for that, but noticed that rings don't show at all and bracelets are rendered from below.

Rogueadyn commented 9 years ago

Furniture models can now be loaded through HousingFurniture (for indoors) and HousingYardObject (for outdoors), but will have to make a new shader for all the dyeable ones, they won't render yet.

ufx commented 9 years ago

That's awesome, thanks a bunch! I plan to get renders rolling as soon as FATEs, maps and a few more search filters are in place. This'll help a ton.