Support for external/HD textures
Summary of changes:
- Removed alignment from the original textures data, which caused some extra junk (padding bytes) to be uploaded
- Removed the UV adjustments in the fast3d shader that deals with the junk data
- Added new GDL command to identify textures in the renderer (tex number/font/embedded in model)
- Added new GDL TLUT command to set a pointer directly to palette colors
- Preprocessing now inserts the texture-identification command for embedded model textures
- Renderer updated to load and cache external textures when available and enabled
- On init the texture manager will iterate the external tex files and build lookup arrays
How to use:
External textures live in a new folder: ext_tex inside the game’s data folder.
General textures
- Place files directly in
ext_tex, named with a 4-digit lowercase hex (e.g.005a.png,0c18.jpg) ~Note that the extension should be exactly 3 characters, sojpginstead ofjpeg~ - Supported formats: PNG, JPG, TGA, BMP, PSD, GIF, HDR, PIC, PNM (via stb_image)
- Currently only PNG is tested
Font textures
- There are 5 fonts in the game:
fonthandelgothicsmfonthandelgothicmdfonthandelgothicxsfonthandelgothiclgandfontnumeric - Each character goes in
ext_tex/<fontname>/named as(ascii_code - 0x21).png- Example: 'A' (0x41) → 20.png
- Outlines go in
ext_tex/<fontname>/outlines/with the same filenames - Japanese fonts are not yet supported but will be soon
Here's a table for reference:
00 ! 0f 0 1e ? 2d N 3c ] 4b l
01 " 10 1 1f @ 2e O 3d ^ 4c m
02 # 11 2 20 A 2f P 3e _ 4d n
03 $ 12 3 21 B 30 Q 3f ` 4e o
04 % 13 4 22 C 31 R 40 a 4f p
05 & 14 5 23 D 32 S 41 b 50 q
06 ' 15 6 24 E 33 T 42 c 51 r
07 ( 16 7 25 F 34 U 43 d 52 s
08 ) 17 8 26 G 35 V 44 e 53 t
09 * 18 9 27 H 36 W 45 f 54 u
0a + 19 : 28 I 37 X 46 g 55 v
0b , 1a ; 29 J 38 Y 47 h 56 w
0c - 1b < 2a K 39 Z 48 i 57 x
0d . 1c = 2b L 3a [ 49 j 58 y
0e / 1d > 2c M 3b \ 4a k 59 z
Model embedded textures
- Place inside a subfolder named after the model
- Filenames should be the lower 4–5 hex digits of the texture ID
Example:
PinstfrontdoorZ
0b40.png
0088.png
...
Ca51guardZ
005E0.png
1AF40.png
...
Hello, I would like to know if there is any way to extract the textures from the game's ROM to see the name of each one and, in that way, rename an HD texture pack and perform tests.
If you really need I can provide you a script to extract the textures. However there is currently an existing HD texture pack whose author is working on renaming them. There are also 2 other ways of identifying/extracting textures:
- via the "Perfect Gold Editor" or PGE or
- via my Blender Addon (pd_blendtools under my repos)
If you really need I can provide you a script to extract the textures. However there is currently an existing HD texture pack whose author is working on renaming them. There are also 2 other ways of identifying/extracting textures:
- via the "Perfect Gold Editor" or PGE or
- via my Blender Addon (pd_blendtools under my repos)
If you could provide a script to extract them in the right name/format/structure, that would be really useful! ~~Just going through PGE and trying to figure it all out, I'm having a hard time figuring out what filenames to use. Cheaddark_combatZ, for example, the face image is at Address 1DF28E9, Preset is 0320 (which is what the save file defaults to, 0320.bmp), I'm not sure if it should be named F28E9, 28E9, 0320, or something else. Sufficed to say, I wasn't able to get it working with any of these names. I believe my placement is correct.. ext_tex\Cheaddark_combatZ\f28e9.png Note that I tried it in both data\ext_tex, as well as the root\ext_tex~~
Update: Turns out the Preset is the filename, although I wasn't able to get it working using individual model folders, but if I stick all of the textures in data\ext_tex they work. Would still be very useful to have a tool that dumps them with correct filenames, and organizes them if necessary
Here it is. You will need python to use it.
To run it, simply extract the files to a folder, put your ROM inside it then run python extract_tex.py
There's a readme inside with a bit more detailed instructions.
PD_extract_tex.zip
I would love to help with the texture upgrades, anyway I can do that? Do we have the ability to rip the XBLA textures and use them as a starting point?
Here it is. You will need python to use it. To run it, simply extract the files to a folder, put your ROM inside it then run
python extract_tex.pyThere's a readme inside with a bit more detailed instructions. PD_extract_tex.zip
Thanks for this! ~~Does the current build work with custom textures? If not, how can I test textures I work on? Or do we have to wait until the latest build supports them? Thanks again!~~
Never mind, figured it out, building your branch as we speak so I can start working on and testing textures. Thanks
We are currently working on renaming all textures from Xii Nyth's pack into this new format. If you want to help with that, join the N64 Vault Discord server. As for the XBLA textures we're not working on it for various reasons, one of them being the legality of it, it's probably not legal to distribute it.
We are currently working on renaming all textures from Xii Nyth's pack into this new format. If you want to help with that, join the N64 Vault Discord server. As for the XBLA textures we're not working on it for various reasons, one of them being the legality of it, it's probably not legal to distribute it.
Yeah I would love to help with that. How are you guys dividing the duties? Took a look myself to see if there was an easy way and it seems dividing all the images by size would be the best way to identify them against the images your tool pulls. I was already able to do some faces. I'll jump on there.
I did Joanna but the N64 HD textures had some overlap issues so I started working on my own version closer to the XBLA style rather than fix someone else's work (seemed rude). I already have a HD texture pack working by using Topaz Gigapixel to upscale all the ripped textures. But obviously the had done ones will be better in the long run.
Good point on the XBLA textures, I had not considered that. I am sure no one at MS or 4J really care about us using the textures after 15 years. BUT considering the work it will take to rip, sort and label them. Yeah it's probably not worth the time with the fact there is a real risk they may just have us take them down anyway.
Is there anyway to add a line to the pd.ini to have the external textures on by default? It doesn't seem to save that setting.
oh I actually forgot to save it into the .ini I'm working on new features related to HD textures such as mipmap generation/anisotropic filtering etc, I'll include it in there.
oh I actually forgot to save it into the .ini I'm working on new features related to HD textures such as mipmap generation/anisotropic filtering etc, I'll include it in there.
That sounds awesome! No worries, I took a look at the source code and figured out Shift+F2 enables/disables them, so that's easy enough. Just mapped it to the select button for easy switching and testing. I have a full x6 HD pack ready in beta right now (mainly using Topaz Gigapixel to upscale). Just going through and tweaking many textures that need a human touch, or look off. And have hand redone Joanna's face textures.
Couple of notes from my testing:
-
There is some textures that didn't get ripped (So I can't upscale them), most noticeably the brown doors in the Carrington Institute, and some surfaces.
-
Any changes at all made to the light blooms just results in them being pure white squares? Had to delete those textures.
I'll release my pack for testing once I have ironed out any major issues I find, polish most of the odd looking upscaled textures, and manually improve all the menu images (those tiny thumbnails upscale very poorly).
Thanks for the awesome work!