Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about texture filtering on real hardware
03-26-2023, 12:05 AM
Post: #1
Question about texture filtering on real hardware
So I'm making the jump from ps1 romhacking projects to psp, and some of the things I want to do are things like removing the linear filtering on textures. Dithering, too, but less important to me than the filtering. I really like the unfiltered pixelated textures in low-ish poly games.

So I'm wondering, while looking through the GE Debugger that I'm trying to learn; is texture filtering enabled on a texture by texture basis? Are there any sce-functions that can affect the entire frame's texture's filtering that I could hack? It'd be a lot more work to try to hack each texture individually... ^^;

I mainly play my PSP games on a vita so I really want this linear filtering on textures gone so I can get that PS1/DS feel I like. Any tips?
Find all posts by this user
Quote this message in a reply
03-26-2023, 01:18 PM
Post: #2
RE: Question about texture filtering on real hardware
If your goal is to patch a game to play outside of emulator, you should not be changing anything you see in GE debugger directly, but instead check what code on the cpu side is writing it using disassembly then depending on how deep you search and what you find either change the filtering flag directly or if you only find a function that loads all gpu commands create a custom function to hook into it which will detect command for linear filtering C6000101(passed as some register value) and replace it with C6000000 before writing it then patch game executable with your custom code.

"Sce-functions" are syscalls, I don't think tracing any of those would avoid tracing GE commands or could be in any way easier or faster, things like filtering flags can be written by simple commands that write value to register or came from some math that's based on some other parameters.

The only proper way to find what to change will be tracing the code back from the function that writes the gpu commands to their destination in memory, through with some luck you can try looking blindly for all commands that sets or adds 0x101(assuming that's what game is setting, but it could as well be 0x100 or 0x1 for just min/mag separately to a register and either use your experience or try changing randomly if you're really lucky, just remember that those flags might be set only during boot and never used again so changing them in-game will most likely not create any change in-game, loading savestates will also not work. Also things like flags can be reused since compilers optimize the code and even if you find the place where a flag is set, changing it directly might be potentially changing other flags that were set to same value so you might end up having to write your own function to filter out what you want to change anyway.

In the end whenever you find it easy or have a very hard time doing anything will depend on how the game itself works and your own experience with the first being random and the latter potentially starting from 0, so it might be impossible at first, but technically changing something like texture filtering should be on the easier side, just don't expect to be able to patch every game in exactly same way.
Another thing is - while it might be true that linear filtering was abused in many things without much sense, in many other cases linear filtering was used to avoid artifacts of stretching the pixels, this is completely different from forcing nearest in emulator that can easily run the game at xx times the original resolution and will look objectively bad on a hardware running 1:1 res.

http://forums.ppsspp.org/showthread.php?tid=6594 - Custom PPSSPP Shaders!
http://forums.ppsspp.org/showthread.php?tid=3590&pid=117172#pid117172 - simple CE scripts to help creating CWCheats,
https://github.com/LunaMoo/PPSSPP_workarounds - CWCheat workarounds.
Find all posts by this user
Quote this message in a reply
03-26-2023, 03:29 PM
Post: #3
RE: Question about texture filtering on real hardware
Great info!

Also yeah I'm definitely familiar with the artifacts for elements when the linear filtering is off, which was one of my worries for certain games that don't have certain UI textures scaled at 1:1, but it'd only be UI elements I'd be concerned about with that, and assumed that I could probably hack the scaling of each texture to fix those (hopefully). Once the filtering is off in a game I plan on fixing up parts of it and using my own pixel art.

Going the custom function route is probably what I'll do after digging through the code in the debugger (depending what I find, like you said). I just needed to ask PSP-gurus if there was some sort of standard that'd make the project simpler since I'm new to PSP hacking. Smile

Thank you, LunaMoo! ~/o/
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: