Dumping Assets - Textures

To preface, I’m an artist in the gaming industry with years of experience, and I’ve always wanted to create a texture/model upres pack for some of my favorite games. My first goal is to bring the color pallet of OoT closer to the original, as the 3DS version is super saturated compared to the original.

I’ve managed to get OoT3D working on Citra, and I’d like to dump the textures of various games in order to create texture packs. I have tried the “texturipper_1.1/1/2” application, but it immediately fails to dump anything at all. Other than that, I have been unable to find solutions to dumping files.

Are there any current solutions to dumping textures, and then loading them via Citra? Same goes for models, is it possible to dump the models in a standard format (.fbx, .obj, etc) and then load them back into the engine after modifying them? OoT/MM 3D are kinda blocky in some areas, I want to fix some of those rough edges and embellish the environments.

This is not really a Citra related question unless you wanted a Citra exclusive solution (i.e. game won’t work in other [future] 3DS emulators / real 3DS).

Before I get into the details a bit more, I’d like to warn you that the 3DS has 4 texture units and a programmable pipeline (shaders) which complicates some things.

You can already view the textures which are supplied to a draw call using the “Pica Surface Viewer” in the debug options. You can also export individual textures from that window.
However, there is no standardized way of replacing textures on the fly (yet).

If you know how to code you can easily generate a hash of each texture, save it to disk, and if one already existed, load the version from disk instead [which could be loaded with arbitrary resolution into the GPU surface cache].
Similar about shaders.

However, especially for meshes this will be tricky as there is no proper caching mechanism and interpretation of the mesh data is very flexible (so you’d need a very flexible file format + shaders).
If you can code, this is still possible but not exactly easy.

I’ve done similar things (= export all textures (.bin and .png) / meshes (.obj) / shaders (.shbin)) to debug graphics issues in Citra in the past and I still intend to write articles or make videos about this (but mostly explaining the concepts on how to debug issues, not how to add these exporters). However, this won’t happen anytime soon I believe.
I’ve just tried looking for the code (which would be about a year old) and unfortunately I couldn’t find it anymore. I might try again in a couple of days - remind me please if necessary.

Furthermore I was working on an external GL hook at some point which would replace meshes, shaders and textures of any GL application by hashing the data and reorganizing the draw calls. This kind of approach might also work here? (You’d probably still want to annotate the GL data from within Citra due upscaled rendering messing with the texture data and to save some performance etc.)

I’ve also tried to help Romsstar with similar things in the past to translate Digimon, however, he decided to crack / patch the games files instead (which I do not recommend if you want to change texture or mesh data sizes).

Aside from that, I’m really interested in seeing this :slight_smile:


Awesome, thank you for writing all of that out, that’s really helpful. Unfortunately I’m not a programmer at all, (which is why I prefaced that I’m an artist :P), so I’m going to have to rely on solutions from the community.

Ideally there would be a method build into Citra for dumping textures, and then having Citra read them off of a disk once I’ve modified them, which is why I thought to ask the Citra community. I don’t really want to repack the game for the 3DS, because if I upscale any textures or eventually replace meshes, I will in all likelihood run into performance issues right out of the gate. Also, I don’t know of any other emulator that is as far ahead as Cirta, Tron is still very basic.

I managed to dump a couple of textures, but they were just from the bottom screen. (the item menu/map, some icons, and some tiling environment textures, the waterfall and Kokiri forest sky) I was unable to figure out how to dump other textures such as inside the tree house, Link, text, the map, environment textures, etc.

It seems to me I might have to wait for someone to implement this feature, which is a shame because now that I’ve got it running I really want to start on this. If you do manage to find that code, please let me know! Your code to inject meshes/shaders/textures would probably work perfectly for this purpose.

Use the Pica breakpoint window and set a breakpoint on incoming batches, open a 4 surface viewers [one for each texture unit] and then step through the draw calls by stepping in the Pica breakpoints window.

Also repacking games is more problematic than you seem to grasp yet: texture sizes or mesh sizes might be hardcoded. So changing their size (or format) would not necessarily work as the new data would overwrite other data at fixed memory addresses. You’d also require an in-depth understanding of the games file format so you can update all pointers to other data which was moved by your resize.

When changing the textures in the internal Citra cache you can change size and format as you’d like because what’s uploaded to the host PC GPU (which runs Citra) does not necessarily have to be present in the emulated 3DS games address space. It doesn’t even have to be understood by the 3DS (Meaning you could add tone mapping operators to shaders and replace texture formats by HDR float textures OR add a tessellation stage somewhere - not necessarily easy though, but certainly possible).

Your conclusion about what Citra should provide for these kind of mods is correct.
However, I personally think those changes should live inside a fork, not the main project.

Keep in mind that my code was mostly for debugging anyway. So for each draw type (different shaders) you’d want to export you’d still have to make changes in the source code probably (so the exporter treats the incoming mesh data like the shader would and adds useful semantics to the data).

Looking at other emulators, notably Dolphin, injecting textures is part of the main branch, which I think many users would find useful (provided there are enough texture packs to justify it). Of course, that emulator has been in the works for a long time compared to Citra.

Also repacking games is more problematic than you seem to grasp yet

Yep, I can say with certainty that it is beyond my grasp currently lol I have never done a texture pack for a game through an emulator (just professional work).

You’d also require an in-depth understanding of the games file format so you can update all pointers to other data which was moved by your resize.

Yeah, unfortunately I wouldn’t even know where to start. I guess I have to wait to create texture packs :frowning: unless if someone is willing to spend the time to develop this feature in a fork for the time being… All of the programming stuff is way beyond me, I’m just an artist after all, so that’s about as far as I can go really, just modifying verts and textures in Maya/Photoshop.

Again, thanks for taking the time to respond to my questions, I appreciate the effort!

Hello. I have a question. I try to extract the textures from the game Yo-kai watch. I’ve read your comments a little, but being a Frenchman, I’m having a hard time understanding your whole conversation. I would like to know if you managed to extract textures from your game via Citra?

Gbatemp is more appropriate place for your question: https://gbatemp.net/forums/3ds-rom-hacking-translations-and-utilities.276/

I think these are what you are looking for: