Mixing textures fix methods?

Discussing, modding and troubleshooting the greatest unfinished sequel ever!
User avatar
HaveANiceDay
pedestrian
Posts: 16
Joined: Mon Oct 25, 2021 11:04 am

Mixing textures fix methods?

Post by HaveANiceDay »

Hello. I've got a problem of mixing namesake textures between cars in the modded game. What are the solutions?
Maybe packing cars in .twt?
User avatar
Toshiba-3
アルカリ (単3形)
Posts: 5345
Joined: Sun Jun 08, 2003 12:14 am
Location: Bleak City

Re: Mixing textures fix methods?

Post by Toshiba-3 »

You have to rename the textures..! No way around that. They all share the same "pool" so the latest texture loaded with a specific name will overwrite the previous one sharing that same name. Don't think materials work like that. If they do, they have to be renamed as well. Fun!
In C1 the problem also applied to models! Addon cars sharing wheels!
Image / carmageddon add-ons at road reaction
User avatar
HaveANiceDay
pedestrian
Posts: 16
Joined: Mon Oct 25, 2021 11:04 am

Re: Mixing textures fix methods?

Post by HaveANiceDay »

If it doesn't take time, could you describe how to rename someone's car textures? I haven't learned modelling yet
User avatar
Toshiba-3
アルカリ (単3形)
Posts: 5345
Joined: Sun Jun 08, 2003 12:14 am
Location: Bleak City

Re: Mixing textures fix methods?

Post by Toshiba-3 »

You change the texture filenames. Using unique prefixes is obviously the way to go: if the faulty car is named Twister2 for example, you could use "twist2_" as a prefix for all filenames, like twist2_wheel, twist2_frame, twist2_bumper, etc. Never exceed 14 characters though.
Then you hex-edit the MAT file to point to the renamed textures. It's always the second name entry for each material and you have to remember to edit the byte preceeding the filename to match its length+1 (in hexadecimal):
Screenshot 2022-06-20 233652.png
Though now that I think about it, you could also use PT2 to change the texture and re-save the car 🤔
You do not have the required permissions to view the files attached to this post.
Image / carmageddon add-ons at road reaction
User avatar
HaveANiceDay
pedestrian
Posts: 16
Joined: Mon Oct 25, 2021 11:04 am

Re: Mixing textures fix methods?

Post by HaveANiceDay »

Thanks a lot. I think Hex editing is for me. At least I don't have to learn new things
User avatar
HaveANiceDay
pedestrian
Posts: 16
Joined: Mon Oct 25, 2021 11:04 am

Re: Mixing textures fix methods?

Post by HaveANiceDay »

But the game stops working on the second renamed with HxD texture...
Here's an example car (v360bdR renamed ok, v360bdL crashes): https://drive.google.com/file/d/1tqemmJ ... sp=sharing
User avatar
Toshiba-3
アルカリ (単3形)
Posts: 5345
Joined: Sun Jun 08, 2003 12:14 am
Location: Bleak City

Re: Mixing textures fix methods?

Post by Toshiba-3 »

HaveANiceDay wrote: Wed Jun 22, 2022 12:58 pmBut the game stops working on the second renamed with HxD texture...
Not sure how you proceeded with your editing but null bytes are missing after the pixelmap filenames. 3 null bytes missing after v360bdR and 2 after v360bdL.
Make sure there's always one null byte (00) after the filename, that tells the game it reached the end of the filename and matches the length in front of the filename (filename length+1 as illustrated in my previous post). Then 8 null bytes (00 00 00 00 00 00 00 00), that is the end of that material block. Then 3 null bytes as part of the next material block start (00 00 00 3C).
A total of 12 null bytes between the filename and that 3C byte. See previous picture for illustration.
Compare with other untouched blocks to try and notice mishaps when the game crashes.
HaveANiceDay wrote:Thu Jun 23, 2022 8:26 pmHi again Tosh and everyone. I have a new problem on this topic: viewtopic.php?f=3&t=19611
I haven't recognized all the dependencies yet, but it seems like if the game doesn't crash, some textures are renamed succesfully, some of them aren't seen by the game an where the hell this roof come from? (I've seen this texture on at least two different car roofs when I tried to rename them)
What do you mean by "aren't seen by the game"? They appear white ingame?
For the roof texture, you have to find which material is set on the roof, then look through the whole C2 Cars directory to find which addon car(s) use(s) the same pixelmap as that material.
Image / carmageddon add-ons at road reaction
User avatar
HaveANiceDay
pedestrian
Posts: 16
Joined: Mon Oct 25, 2021 11:04 am

Re: Mixing textures fix methods?

Post by HaveANiceDay »

Thanks again, the game no longer crashes. But some textures cannot be renamed through TEX editing, such as smashable windows and lights and also that roof. I guess I just got to read tutorials about cars creating now.
User avatar
Toshiba-3
アルカリ (単3形)
Posts: 5345
Joined: Sun Jun 08, 2003 12:14 am
Location: Bleak City

Re: Mixing textures fix methods?

Post by Toshiba-3 »

Sure you can, rename the texture. If it's used in a material, hexedit the MAT file. Then go through the .txt and .wam files to change the texture filename every time it is referenced.
Image / carmageddon add-ons at road reaction
User avatar
HaveANiceDay
pedestrian
Posts: 16
Joined: Mon Oct 25, 2021 11:04 am

Re: Mixing textures fix methods?

Post by HaveANiceDay »

So if I want to solve the problem of mixing textures, I need to rename their files, then their every second reference in .mat file (9 null byte before it and 12 after), then for the breakables their references in .wam and in .txt for working lights, also simplemodel sometimes shares textures with main. I think after this the issue should be finally resolved.