Jump to content
The Dark Mod Forums

Texture reorg support


Recommended Posts

I was just thinking of this approach, maybe somebody of you can help there.

 

I'm currently writing a script that commits the textures to their new structures and also should update the material files. I guess this should be rather easy to do, as this is mostly a search and replace function. Could be a bit more complicated because new material entries have also to be created according to our decision of the new namespace.

 

The issue is that of course basically all the maps will break because of this, because a lot of the textures will get new names. So I considered writing a converter that should take a file as input listing the old name and the new name of a texture, and then replaces all the texture references in a map. Maybe it's not really worth the effort, because you should be able to do this with a search and replace function in a text editor. But then, we have a lot of maps, and since all of them are effected it might be still worth to do this.

 

Obviously for this I will have to write a small parser to find the names and replace them, and it occured to me that the DR code basically can already do this. I don't know how entangled that code is though, but maybe it's worth to take that code and use it as a foundation for such an utillity. Or maybe it could be added to DR, as it should be rather easy to do this from DR itself, then writing a full new app.

Gerhard

Link to comment
Share on other sites

Ugh, that texture reorg is having some major impact it seems. <_>

 

However, do we have a mapping between the old names and the new names? If yes, I could write such a plugin that processes the map based on that list.

Link to comment
Share on other sites

Ok, I probably can't start on this till tomorrow or the day after (got an exam tomorrow). I'm assuming something like this (whitespace-separated texture pairs):

texture/darkmod/city/oldname   texture/darkmod/newname

I should be able to write that plugin in a day or so, maybe faster.

Link to comment
Share on other sites

A python script will of course do the trick too. I can't do it of course because I have no Python skills and I don't want to learn it right now. :)

 

I thought the plugin would come in handy for future application, but that holds true for the python script too.

Link to comment
Share on other sites

I was planning to do this in Python anyway, but then I would have to convert all maps myself. That's why I thought that it might be good to have this feature in DR directly, as it would be the simplest place to do, and also all mappers already have it. I think it's not realistic to ask mappers to instally Python just for that.

 

And of course the point was also that I still would have to write the code to handle the map files properly. Maybe a search and replace is enough, though.

Gerhard

Link to comment
Share on other sites

I kept thinking about this bcause I forgot some detail. Now I remembered it. :) Th reason why we need to parse the material files is, because we not only replace the textures with new directory and names. We also want to change the material name itself, which means that I must parse the material file, because I need to create a new name for the entry as well.

 

For example:

arch_brick01
{
 stone
 qer_editorimage  textures/darkmod/mansion/wall/manwbrick01.tga
 diffusemap	   textures/darkmod/mansion/wall/manwbrick01.tga
//specularmap	 textures/darkmod/mansion/wall/manwbrick01_s.tga
 bumpmap		  textures/darkmod/mansion/wall/manwbrick01_local.tga

{
	if ( parm11 > 0 )
	blend	   gl_dst_color, gl_one
	map		 _white.tga
	rgb		 0.40 * parm11
}
{
	if ( parm11 > 0 )
	blend	   add
	map		 textures/darkmod/mansion/wall/manwbrick01.tga
	rgb		 0.15 * parm11
}
}

 

will become something like this:

textures/darkmod/stone/tiling/stone_brick_001
{
 stone
 qer_editorimage  textures/darkmod/stone/tiling/stone_brick_001.tga
 diffusemap	   textures/darkmod/stone/tiling/stone_brick_001.tga
//specularmap	 textures/darkmod/stone/tiling/stone_brick_001_s.tga
 bumpmap		  textures/darkmod/stone/tiling/stone_brick_001_local.tga

{
	if ( parm11 > 0 )
	blend	   gl_dst_color, gl_one
	map		 _white.tga
	rgb		 0.40 * parm11
}
{
	if ( parm11 > 0 )
	blend	   add
	map		 textures/darkmod/mansion/wall/manwbrick01.tga
	rgb		 0.15 * parm11
}
}

 

 

Which means that not only the filepath is replaced, but also the materialname. So I have to write a parser that can parse such an entry and copy over all the lines from within a single definition (which is the problematic part) and replace the filename (which is the easy part), because only the affected materials should be replaced in the mtr file.

Gerhard

Link to comment
Share on other sites

"Better to bring it up before it's too late..."

 

In the definition above, is "/tiling" just an example, or is that to be the actual folder? Shouldn't it clarify the type of tiling (e.g., 2d or 1d)? I realize it says "will become something like this", but I'm asking because the definition was probably copy/pasted, so maybe it's the actual final result.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • nbohr1more

      The Lieutenant 3 is out! Congrats Frost_Salamander! ( raising awareness )
      · 2 replies
    • OrbWeaver

      Has anyone had any luck with textures from Polyhaven? Their OpenEXR normal maps seem too washed out and give incorrect shading in the engine.
      · 5 replies
    • datiswous

      I tried to upscale the TDM logo video. First try:

      briefing_video.mp4 You can test it ingame by making a copy of the core tdm_gui.mtr and place it in your-tdm-root/materials/ , then edit line 249 of that file into the location where you placed the new briefing.mp4 file.
      What I did was I extracted all the image files, then used Upscayl to upscale the images using General photo (Real-Esrgan) upscale setting and then turn it back into a video.
      I might have to crop it a bit, the logo looks smaller on screen (or maybe it's actually better this way?). My video editor turned it into a 16:9 video, which I think overal looks better than 1:1 video of original.
      · 1 reply
    • nbohr1more

      Trying to be productive on my down-time before Capcom releases Akuma and my son is constantly on my PC playing Street Fighter...
      · 1 reply
    • OrbWeaver

      Finally got round to publishing a tutorial on baking normal maps in Blender, since most of the ones we have are inaccessible or years out of date.
      · 4 replies
×
×
  • Create New...