Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Empyre

looking for a TEXTUREx converter

Recommended Posts

I want the custom textures in my PK3 to not step on the toes of the custom textures in any other wad or pk3 that is also loaded in ZDoom (more specifically, Zandronum). I have heard that can be accomplished by using the textures namespace (between TX_START and TX_END in a wad or in the textures folder in a pk3). The restriction is that the textures must not be composite. Unfortunately, the textures I am using, from cc4-tex include some composite textures.

 

I am looking for a tool that would convert each compound texture into a single png. Here is a pseudo-code algorithm for what the tool would need to do:

main code
{
  for each entry i in TEXTUREx (or TEXTURES, if you want to be really flexible)
    {
      if (texture not defined in iwad's TEXTUREx) then ProcessTexture (i)
      else if (the definition differs from the definition in the iwad's TEXTUREx) then ProcessTexture (i)
      else if (any patch used by the texture is in the wad or pk3 being processed) then ProcessTexture (i)
    }
}

void function ProcessTexture (IndexIntoTEXTURExLump)
  {
    if (texture is not composite) then copy texture to textures namespace //textures folder in a pk3 or between TX_START and TX_END in a wad
    else compose the texture into a new png and put it in the textures namespace
  }

When the tool has finished its job successfully, the (TEXTUREx lump or TEXTURES lump) and the PNAMES lump and either the patches folder or the PP_START - PP_END namespace and all be safely deleted. Obviously, it would be prudent to make a back-up copy of the wad or pk3 first. The result would be a textures namespace with all the custom textures and only the custom textures.

 

Maybe such a tool already exists, and if not, it would be awesome if somebody would make it happen. I surely would not be the only one to find it handy.

Share this post


Link to post

I read your post like 10 times now and I'm still not clear on what you want. Lemme see if I get this straight, you want a tool that can scan a wad and rebuild the TEXTUREx lump such that every single texture is only made from a single patch by combining the patches of multipatch textures into a single patch. Is that what you want?

 

I could probably write something like this but I really would prefer to stay away from pk3s. Not really in a mood to deal with that extra complexity. WADs are much easier to deal with.

Share this post


Link to post

That's close enough. You're proposing to rewrite the TEXTUREx lump. I was thinking of bypassing it with the TX_START and TX_END markers, but your idea would support more ports, and I could easily convert the output to fit my needs, by copying the patches from the wad into the textures folder (rather than the patches folder) in my pk3. Then, the pk3 would no longer need a TEXTUREx.

 

The tricky part would be including all of the custom textures, and none of the iwad textures. There are three ways I can think of to make a custom texture:

 1) Make a new entry in TEXTUREx

 2) Modify an entry in TEXTUREx

 3) Use an unmodified entry in TEXTUREx but replace one or more of the patches

Those are what my ifs and else ifs above were trying to catch.


A GUI would be icing on the cake, but command line would be good enough.

 

As I said before, I would surely not be the only one who would find it handy.

Share this post


Link to post
3 hours ago, Empyre said:

The tricky part would be including all of the custom textures, and none of the iwad textures.

I think I'm missing something here. Why would this be tricky? I was under the impression that all your custom textures would be in it's own container, ie a PWAD or as you suggested a PK3 which means there won't be any IWAD textures involved. The only thing that could make this tricky is if your PWAD has a TEXTUREx lump that uses some of the same texture names as ones in the IWAD. Is this the case?

 

[EDIT]

 

Ok, nevermind. I re-read your post a couple more times and I think I understand what you're saying now. Still not 100% sure. Tell me, do some of these new textures use IWAD patches with unique combinations not found in the IWAD TEXTUREx lump? If so, then yes, it would be tricky but not impossible.

 

Also, do you need to app to be able identify custom textures made with all 3 methods you suggested?

Edited by Niya

Share this post


Link to post

Ok after thinking about this for a few more minutes, I realized there is a very simple way to do this. All of I have to do is normalize all TEXTUREx textures in both the IWAD and the PWAD into single images and derive a hash value from these images. All hashes that have no matches to hashes from the IWAD images would identify only the new textures, regardless of what method was used to create these custom textures.

 

Yea I should be able to do something like this. It'll take a bit of work though. But definitely doable.

Share this post


Link to post

Seems to me that there's a very simple way to accomplish this:

  • Highlight all textures
  • Export as PNG
  • Import PNGs as textures

I use a tool I wrote many years ago for WAD manipulation. Unfortunately, it's not portable enough to share, as it does a lot of custom things for me. But, if you can find a WAD editor that can export textures as image files, you should be very close to getting what you want.

Share this post


Link to post
1 hour ago, kb1 said:

Seems to me that there's a very simple way to accomplish this:

  • Highlight all textures
  • Export as PNG
  • Import PNGs as textures

I use a tool I wrote many years ago for WAD manipulation. Unfortunately, it's not portable enough to share, as it does a lot of custom things for me. But, if you can find a WAD editor that can export textures as image files, you should be very close to getting what you want.

I hadn't thought of that. That would be easy, but it would include all the iwad textures, too, which I don't want to do. I could manually choose which textures to do, but that would be time consuming, and because I am only human, error-prone. I might accidentally include some iwad textures, and/or accidentally leave out some custom textures.

Share this post


Link to post

SLADE 3 does that. Select textures in the texture editor, right-click->export to->export textures.

Share this post


Link to post
6 hours ago, Gez said:

SLADE 3 does that. Select textures in the texture editor, right-click->export to->export textures.

That is the same thing that kbl suggested. The problem is that it would export all of the textures, even the iwad ones, which I do not want to do because it would be both an inefficient waste of file space and illegal to distribute. Also:

12 hours ago, Empyre said:

I could manually choose which textures to do, but that would be time consuming, and because I am only human, error-prone. I might accidentally include some iwad textures, and/or accidentally leave out some custom textures.

If Slade had a way to automatically select all custom textures, and only custom textures, the problem would be solved.

Share this post


Link to post
1 hour ago, Empyre said:

The problem is that it would export all of the textures, even the iwad ones

No, only the textures that you select.

 

CC4-TEX is structured quite simply. From AASHITTY to ZZZFACE9 you have the vanilla Doom II textures. Then you get the "new" textures.

Share this post


Link to post

Thank you, Gez. I'll give that a try. I just hate to invalidate the effort that Niya has already put into this by now. Thank you, Niya, and I apologize for the wasted time.

Share this post


Link to post

As a test, I made cc4-tex.pk3 from cc4-tex.wad using this technique, and then I converted all the custom textures in my pk3 to use the textures folder and then deleted the patches folder and PNAMES and TEXTURE1, and it works! I see the custom textures in my maps as if I hadn't changed anything today. Now, I should be able to load my maps along with other maps that also use custom textures. I am happy.  :)

 

Thanks again, everybody, for the help!

Share this post


Link to post
1 hour ago, Empyre said:

Thank you, Gez. I'll give that a try. I just hate to invalidate the effort that Niya has already put into this by now. Thank you, Niya, and I apologize for the wasted time.

Oh don't worry my friend. I'm a bit busy so I haven't quite started on this yet. I was gonna make some time later this week, perhaps do the entire thing over the weekend. If you don't need it anymore, it's quite fine. It'll free me up to continue working on other things which I was gonna temporarily put aside in order to do this.

 

Also, I love working on small tools like this. It's always interesting to breathe life into something completely new that others may find useful. But lemme know if you found success. I'm always ready to write stuff like this.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×