-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Add custom texture dumping/injection support to Beetle PSX core. #492
Comments
I just had a vision of medievil with remade textures ❤️️ |
Ohhhhh! please, i need this! I will use waifu2x in my all games hahahahah |
@gamaghostmagus Thank you for showing me this nice piece of software :) |
And this is not even the better |
Just found these, are you talking about that @gamaghostmagus ? SFTGAN, DSFTGAN (Deep SFTGAN) SRGAN, ESRGAN (Enhanced SRGAN) |
Is any one working on this? |
yes it's! i use ESRGAN, and it is... AWESOME |
Would anyone mind if I gave this a go? |
@autun12 If you have some ideas on how it could be done, go for it. No one else is working on it, AFAIK. |
@autun12 do it, and you'll be an hero for people of this lands: we will sing songs to celebrate your genius and bravery... Please, just do it XD |
Wow this would be great, |
Does anybody working on it? I can have a try. |
I just saw this issue, for anybody working on this I made a very quick and dirty texture dumping PoC a few years ago in beetle: https://github.com/simias/beetle-psx-libretro/tree/texture_dump I implemented 2 solutions (exposed through core options), each having its problems. The most straightforward solution is to dump the textures one polygon at a time. The obvious inconvenient of this solution is that you end up with many small files with tiny texture chunks. For instance, running the dump on Medievil I end up with tiny texture chunks like: Note that there appears to be a bug in my texture dumping code because I end up with many mangled textures, I must've forgotten to handle a special case (maybe the texture mask bits?). The other possibility is to dump one texture page (256x256 pixels) at a time. The inconvenient of this solution is that you end up with a lot of extraneous data (and each page is dumped multiple times because of the many palettes), for instance: I'm not really sure what's the best way to deal with this. I assume that many other consoles have this type of issues though, so maybe it's worth looking into what other emulators that support texture replacement do? Dolphin in particular might be interesting to look at, because AFAIK GameCube games also often use palettes. So that's just for the dumping part, for the loading it's a whole other can of worms, especially if you want to make it work with the GL/Vulcan code. I've actually started thinking about how to do that for Rustation, so I have a few ideas on how to do that if anybody wants to brainstorm it. |
Oh and as a side-note, a potential difficulty with paletted texture replacement is that sometimes the same base texture will be used with multiple palettes. For instance in Crash Bandicoot you have red and purple carnivorous plants, they share the exact same texture but use a different palette. Handling these situations when implementing texture replacements might be tricky. Palettes can sometimes be used to simulate shading, using a darker palette when you get in the shadow and a lighter one when illuminated (this is probably less common on the PSX because the hardware has other, more flexible way of doing that sort of shading). |
@simias looks promising, I've never coded for psx, but coded for openGL, so I came with another solution, palette lookup is not easy for me cause I got really bored with this specifications. Thanks for your code, will try to use your palette lookup Btw I can miss something due to lack of knowledge, but is there a way to dump textures just from TIMs? |
Actually I amend my previous comment regarding Crash's plant, it's even more devious than that: the texture and palette are purely black and white. Instead they use texture blending in the draw commands. Basically the way it works is that you can tell to render a texture (paletted or not) by blending it with a solid color. So it's an other layer of potential texture shenanigans on top of the texture+palette. Aku-Aku's feather in the same game are the same thing: black and white textures with 4 different colors blended. Here's the relevant code in the GL fragment shader: beetle-psx-libretro/rsx/shaders_gl/command_fragment.glsl.h Lines 851 to 862 in 18a9de1
That being said these complicated situations might be left for later. Unfortunately I expect that they're fairly common on the PSX... @Meetem what is a TIM? |
@simias TIMs are Typical Image Format, PSX textures |
@Meetem I'm not sure I understand what you have in mind exactly. Do you mean the texture format as stored in the CD-ROM instead of dumping it straight from the GPU? |
Yes, I think this would help. Dumping from play is ok, but you cant replace
all the textures then
…On Fri, Jan 17, 2020, 18:57 Lionel Flandrin ***@***.***> wrote:
@Meetem <https://github.com/Meetem> I'm not sure I understand what you
have in mind exactly. Do you mean the texture format as stored in the
CD-ROM instead of dumping it straight from the GPU?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#492?email_source=notifications&email_token=AB2AF4TYGBSRFU3XODANT33Q6HIOJA5CNFSM4G3JOUMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJID2EY#issuecomment-575683859>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB2AF4XDSQT6UT73KFNI37LQ6HIOJANCNFSM4G3JOUMA>
.
|
Ah that I've never looked into that so I can't really tell. Replacing the textures as stored in game files would obviously be the simplest approach, although then you won't be able to easily overcome palette limitations or change the texture size. Beyond that I don't know how standard the texture formats are. |
@simias actually I find more convenient way to dump textures, than taking them from polygon draw commands, but CDs TIMs would even better Actually I want to dump from TIMs but replace textures not in CD, cause psx tims cant be large than 256x256 |
Well you can always compromise and dump PSX texture uploads, but then I'm not sure how you're going to match with palette data (except if you want to just replace the texture and not the palette I suppose). In mednafen code texture upload starts with this command: beetle-psx-libretro/mednafen/psx/gpu.cpp Lines 252 to 275 in 18a9de1
You can see that you have the X/Y coordinates in VRAM as well as the dimensions in W and H (the VRAM always assumes 16 bits per pixel). Then the actual data is received here, 32bits at a time: beetle-psx-libretro/mednafen/psx/gpu.cpp Lines 985 to 1019 in 18a9de1
|
Thanks, I've figured that out, now I need some time to make naive
implementation, also have some ideas to optimize hash calculations
|
If you have questions about how the PSX GPU operates don't hesitate, I have a fairly in-depth knowledge about it. For texture dumping in general I'm sure you could get better inspiration looking at other project's implementation. Does any PSX emulator out there implements texture dumping and replacement? I seem to recall that gpuBladeSoft had something like that, but I don't really know how thorough it is. |
@simias thanks. Given nor poly vram dumping, nor texture page dumping is optimal, I'am trying to figure now how to catch texture upload. There is a way to catch texture part upload during one transaction (or how does it called), when game code calls FB_WRITE. I'am testing on Metal Gear Solid, and Konami logo seems to be splitted across multiple transactions. I'am going to stick with way C, cause I don't have enough knowledge to go with A (cause there multiple TIM viewing software), and way B is really PITA as much as I can say for MGS. Here's my question, does really game can upload software generated clut, or its locked to tims on disk? I think there is a way to change cluts in vram as you want, creating cool effects, don't know if any games using it. UPD: I found some opensource tim viewer, but in C#, it's not hard to me to rewrite it in C. So I might go for path A. Questions still applicable, answers needed to choose which path I'll finally go |
@gamaghostmagus for now I made texture exporting from my editor, that's the only done thing, you can contact me in discord if interested (contact seen above) |
I'm interested in testing as well if you need additional help. I've got a windows machine, as well as a Linux machine for cross platform. |
I'm here because I've been searching for a way to replace textures, no luck with gpubladesoft as he seems to have abandoned the plugin, will eagerly be waiting for hopefully when beetle has texture replacement ;) |
I'd love for this bounty to have more attention, more so for the PSX gaming/modding community. Check out the bounty and donate if you're able to. I'm sure this would help any developer's motivation to work on this. |
So just as a headsup - this bounty should be safe from BountySource's recent decision to pocket the money if a bounty is exactly two years old and has no solutions yet. That being said, in the short term this sudden and swift change in policy probably suggests we probably want to start protecting ourselves here and maybe finding some alternatives (and protecting the money along the way so that it doesn't go 'poof'). I'd like to hear some ideas on moving forward. Second - @stoofin's current WIP is currently in master, so people can test the Chrono Cross pack already that is circulating. Now it's important to know where to go from here. Can somebody write a tutorial explaining how the current system works and how one would go about making a pack like this? Does the current method only support a few games? How do we expand things from here, and can we come up with more PoCs for other games? I have absolutely no qualms about the texture replacement code design changing later on as we realise certain things need to change, as long as we get some momentum going and other people participating in the custom asset creation process, as @InfiniteT8 suggests. Let's try to pick a couple of tentpole games like Resident Evil, FF7, MGS and so on and then figure out if the current system is sufficient for texture replacement in those games, or whether we need extensions. But most importantly - people that might want to get involved in doing these packs themselves need to know how it all works. Preferably in whatever tutorial gets written, it gets explained too how to do this by hand without external looks like custom editors if at all possible. But of course, the tutorial can also explain how to do things with the editors that people wrote in this thread. |
i've done a ton of tests on this @twinaphex and i'm actually surprised how well it does work, 2D games is off the table (so far all the tests i've done is crash), and it has all the original issues with vram dumping so some corrupt textures, or multiple images with different palettes etc, which makes it tricky (so possibly possible?) some games are easier than others and dump without issues (resident evil directors cut actually does dump usable textures). i can see why @Meetem went the direction he went with his method of texture injecting and dumping for more control. you can catch me on discord LyonHrt#1856 if i have any extra findings, or methods that would work for general use |
I'm currently testing out @stoofin 's wip but have found that there's no option to turn on replace textures at the quick menu. I also noticed that outside of Chrono Cross, it's all left to be figured out how we could replicate @stoofin methods with upscaling rather than giving an idea of how to accomplish this with other games. So I 2nd @twinaphex's call for a tutorial haha. @twinaphex Perhaps if a stable enough project that meets the requirements for a good number of games (3d and 2d) I could see the bounty being safe enough. Perhaps there could be a discord room for testing, bug reports, updates, etc where the developers, testers, and contributors could correspond in real-time. I was also able to test @Meetem early WIP of his tool. I like the concept of being able to see the textures populate real-time in the tool but I believe that being able to turn the feature on and off while the tool is still open in the background would allow users to focus on the exact textures they're looking to extract at any given moment. What I liked about @Meetem tool was the easy setup. Though it's not quite fully functional I feel like it has a lot of potentials. |
I have setup a Discord room on RetroArch's Discord - it's called #texture-replacements. @lyonhrt is already in there so we could use it for further discussion and research/development. |
Hi folks , https://forums.libretro.com/t/beetle-psx-hw-texture-replacement-testing-feedback/28954 According to the Chrono Cross pack creator Tiriosaurus reddit , he used external tools to dump the textures which probably give better & bigger texture chunks of background games instead of the tiny ones dumped by the core |
@twinaphex They're aiming to restore the first 3 original resident evil games with AI upscaled textures. From their discord channel, they appear to be looking for a resident evil 1 engine\emulator that allows for texture replacement. You're looking for a game to showcase beetle's texture replacement capabilities, they're looking for an emulator\engine that allows to replace RES1 textures, if both your teams could work together to accomplish this, it would be great. |
Sure they can stop by in the Discord chat and talk with the real guys that are doing all this texture replacement work like @Meetem, @lyonhrt and @stoofin . I think it's important to emphasize that Libretro as a team is not necessarily doing the coding on this project. Anyway, sounds great. I quite like the Seamless HD projects myself, would be great if they did packs like that for the PS1 games too. |
Thanks for pinging me! We heard about that feature. It's a great news for us and we will definitely look into it as soon as possible. |
It's really not. This is an open issue created requesting a feature, nothing to do with texture replacement bugs. It's in your best interest to please make your own issue instead of trying to hijack someone else's. |
theflyingzamboni, Kupo and @lyonhrt, and anyone else that are working on projects or have tested this extensively, could you possibly list the current issues that would need to be fixed to get the ball rolling? Thanks! |
Hi guys, I'm finding with the current implementation of Beetle PSX HW's texture replacement feature, I experience crashes when tracking is activated before the game starts. It doesn't exactly get pass the Now Loading screen and it fails to grab some background textures, and loading screens (duckstation's latest unofficial release covers those bases). I expereince these crashes with Smackdown 2 specificially. I can't be sure if this happens to other games. |
Here are a few issues opened by theflyingzamboni and Zychronix: [Feature Request] Dump paletted textures as a single image #772 theflyingzamboni also mentioned the following in the libretro discord:
Edit: I also found the following issues: Texture dump issue if palette is not 4bpp nor 8bpp #715 |
based on my experience... RE3 just crashes on dumping textures . also noticed that the textures it dumps actually has and alpha channel nope more like semi transparency on them. apologies if i dont know the technical terms for it. but for 2d games the texture dumping feature is fine. it does not have problem full on 3d games such as 40winks and crash bandicoot |
Kupo in the libretro discord mentioned the following:
Raykusen mentioned this as well:
|
Two more reports on the discord: theflyingzamboni:
Kupo:
|
I think we described the same issue. Duckstation handles it different but also not perfect. So here is a short scene of a battle without texture replacement. The video shows animations in ui. Look at the hp and the battle bar. It also shows what I meant with fade in/fade out. If it's your turn the battle background gets a bit darker. If she casts her spell the background is turning red. This is now how beetle would dump this scene: Several textures for each state. Now about how Duckstation handles it: It only dumps each texture one time. On the one hand it's good, because this way I could actually replace the battle background without being worried about the final texture pack size. Note that Duckstation is WIP. The video only shows what it looks like atm. This could change in the future |
@Kupo91 do you by chance have bilinear filtering enabled in the Video options of RetroArch itself? |
No, I already checked this, it's disabled. Must be something else :/ |
@Kupo91 sorry to ping for a long dead topic; But i've noticed in Digimon World 3 sometimes the textures have random filtering applied depending on the angle of the sprites.. so i don't think this issue is related to only replaced textures. |
you're all good. it's a shame that it became so quiet here. i really wish that this feature gets some more attention so i can finish my texture packs one day. this is the result if you just move a texture from your dumps folder into your replacements folder. it's 1:1 the same texture, i didn't touch it, so it should look the same but it's blurry af |
@Kupo91 Hi, sorry, my fork used hardcoded trilinear filtering, so that's what you're seeing there. There isn't any pixel art in chrono cross so I never bothered with any additional filtering options. Not terribly helpful for your use case, but, the more you know! |
Oh, hi. Yea I noticed that I can reduce the blur if I just increase the resolution of my upscale, even if it's just Nearest Neighbor. And this way I can also smooth out the conturs, which was always a bit difficult without having different grades of transparency. |
Bounty Requirements:
https://www.bountysource.com/issues/70820889-feature-request-add-custom-texture-dumping-injection-support-to-beetle-psx-core
The text was updated successfully, but these errors were encountered: