Jump to content
The Dark Mod Forums

Need help with creating and assigning materials


vozka

Recommended Posts

I may be a bit dumb.

I found a few good CC0 models I'd like to convert to TDM. I should be able to make a low-poly version and bake materials, so everything else would be easy, right? Yeah, wrong. It's probably just some stupid mistake related to the way file paths are written in the material or model files, but I'm unable to find what it is. Thanks for any help.

I managed to export the object as .ase and make it show up in DarkRadiant. I managed to assign it a built-in tiling texture. It works in game. However I'm completely stuck at creating and assigning a new material. I think I was already there once, I managed somehow to assign it a material that loaded the _ed texture in DarkRadiant, but it rendered as fully black in game. However, I was using the 2.08 beta and it may have just been a bug (switched back to 2.07 for the purpose of testing models). And because I'm possibly a moron, I broke it even more when trying to fix it and did not save the original state. Now I get the blue & black no material.

DarkRadiant log says that it cannot find the material I guess: "[shaders] ShaderLibrary: definition not found: textures/darkmod/furniture/gothcab"

This is what my models and textures directory structure looks like:

dirstructure.png.eb0622f847b48e45d18be7c78c0e3f97.png

The testmission/models/darkmod/furniture/ directory only contains the file GothicCabinet_01.ase.

The testmission/textures/darkmod/furniture directory contains the material files and the textures:
gothcab.mtr, gothcab.dds, gothcab_local.dds, gothcab_s.dds and gothcab_ed.jpg

The *MATERIAL_LIST section of the GothicCabinet_01.ase file looks like this:

*MATERIAL_LIST {
	*MATERIAL_COUNT 1
	*MATERIAL 0 {
		*MATERIAL_NAME "textures\darkmod\furniture\gothcab"
		*MATERIAL_CLASS "Standard"
		*MATERIAL_AMBIENT 0.0000	0.0000	0.0000
		*MATERIAL_DIFFUSE 0.8000	0.8000	0.8000	1.0000
		*MATERIAL_SPECULAR 1.0000	1.0000	1.0000
		*MATERIAL_SHINE 1.8090
		*MATERIAL_SHINESTRENGTH 1.0000
		*MATERIAL_TRANSPARENCY 0.0000
		*MATERIAL_WIRESIZE 1.0000
		*MATERIAL_SHADING Blinn
		*MATERIAL_XP_FALLOFF 0.0000
		*MATERIAL_SELFILLUM 0.0000
		*MATERIAL_FALLOFF In
		*MATERIAL_XP_TYPE Filter
		*MAP_DIFFUSE {
			*MAP_NAME "GothicCabinet_01"
			*MAP_CLASS "Bitmap"
			*MAP_SUBNO 1
			*MAP_AMOUNT 1.0000
			*BITMAP "textures\darkmod\furniture\gothcab"
			*MAP_TYPE Screen
			*UVW_U_OFFSET 0.0000
			*UVW_V_OFFSET 0.0000
			*UVW_U_TILING 1.0000
			*UVW_V_TILING 1.0000
			*UVW_ANGLE 0.0000
			*UVW_BLUR 1.0000
			*UVW_BLUR_OFFSET 0.0000
			*UVW_NOISE_AMT 1.0000
			*UVW_NOISE_SIZE 1.0000
			*UVW_NOISE_LEVEL 1
			*UVW_NOISE_PHASE 0.0000
			*BITMAP_FILTER Pyramidal
		}
	}
}

And lastly the gothcab.mtr file contains the following:

goth_cab
 {
    // Use one of the predefined surface types like stone, glass, wood
    stone
    // or use this:
    // surfaceType 15
    // and make the first word in the description below your texture type,
    // like so:
    // description   "foliage" (This is a grass texture)
	surftype15
 
    description      "Gothic cabinet texture"
    qer_editorimage  textures/darkmod/furniture/gothcab_ed
 
    bumpmap          textures/darkmod/furniture/gothcab_local
    diffusemap       textures/darkmod/furniture/gothcab
    specularmap      textures/darkmod/furniture/gothcab_s
 
    // This is the code required for frob highlighting this texture
    {
        if ( parm11 > 0 )
        blend       gl_dst_color, gl_one
        map         _white.tga
        rgb         0.40 * parm11
    }
    {
        if ( parm11 > 0 )
        blend       add
        map         textures/darkmod/furniture/gothcab
        rgb         0.15 * parm11
    }

        // The following two blocks are required for the ambient shading:
        // TDM Ambient Method Related
        {
                if (global5 == 1)
                blend add
                map                             textures/darkmod/furniture/gothcab
                scale                   1, 1
                red                             global2
                green                   global3
                blue                    global4
        }
 
 }

 

  • Like 1
Link to comment
Share on other sites

Should be an easy enough fix.  Your .mtr file goes in testmission/materials, and your "goth_cab" on the first line should be "textures/darkmod/furniture/gothcab" instead.  I'm not sure about the "\" vs using a "/" in the MATERIAL_NAME within your model, but I'd imagine that's ok.

Link to comment
Share on other sites

Good, I made progress, but there are still some problems.

It's still a bit confusing for me what's just the material name and what's the full texture path, but it works so far. I had to change \ to / in the model file, backslash works with builtin textures, but for some reason not with custom ones. 

However. Now the model looks okay and loads the _ed texture in DarkRadiant fullbright preview. As soon as I switch to lighting preview , I get blue checkerboard textures again. And in game the model does not even load - I get a small black cube instead.

edit:

right, DarkRadiant now says:

[shaders] Unable to load texture: _default
[shaders] Unable to load texture: textures/darkmod/furniture/gothcab
[shaders] Unable to load texture: textures/darkmod/furniture/gothcab_local
[shaders] Unable to load texture: textures/darkmod/furniture/gothcab_s
[shaders] Unable to load texture: textures/darkmod/furniture/gothcab
[shaders] Unable to load texture: textures/darkmod/furniture/gothcab
 

since all the files are .dds it's possible that some of my gimp export settings are wrong, I'll try some changes.

Edited by vozka
Link to comment
Share on other sites

Okay. Changing all textures to .tga worked, now they all get loaded correctly in DarkRadiant, the object looks fine in light preview.

But when testing in game, dmap says that it couldn't load the file GothicCabinet_01.ase, that's why there's only a black box.

This is, again, interesting, because I was already able to load the model once, although without a material, and I don't think that I changed anything but the material settings in the .ase file. Too bad dmap isn't more detailed about why it canot load.

I'll probably try to export it to .lwo, tried .ase first because it seemed simpler and there's better instructions at the wiki.

Link to comment
Share on other sites

1. Using just material name before definition will make your material end up in the Other Materials folder, among dozens of others. While you don't have to mimic the structure of your project textures folder, I find it easier that way. Still, that this path is really just for DarkRadiant folder structure in the Media tab.

2. Now texture paths have to be actual texture paths, relative to your project root folder. The naming convention is actually up to you (I use simple _d, _n, _s suffixes), and you don't have to specify the file extension.

3. Ase models need a //base prefix before the material path, and the only place you have to declare it is inside the material # BITMAP section. So in your example, the

2 hours ago, vozka said:

*BITMAP "textures\darkmod\furniture\gothcab"

Should be replaced with

*BITMAP "//base/textures/darkmod/furniture/gothcab"

 

Edit1: if your 3d modeling software saves models with .ASE extension and not .ase, remember to change that to lowercase. There are instances where DR and the engine doesn't like the uppercase.

Edit2: specifying and making dedicated images for qer_editorimage slot is a waste of your time and resources. This feature was useful back in Doom3 days, when using regular-size textures would slow down the editor. You'll be fine even with a 10-year-old gpu now. You can delete this line, and DR will just display the diffuse texture.

Edited by peter_spy
Link to comment
Share on other sites

Thank you! That helped me understand it better.

The model now works correctly in DarkRadiant both as .ase and as .lwo. But it does not load in an actual level (the suffix is in lowercase). The console in dmap just says that it couldn't load the model and the game shows a black cube.

I used the newer .lwo and .ase export plugins for Blender. 

No idea what it could be this time, so I uploaded the model and materials to dropbox if anybody wants to take a look: https://www.dropbox.com/s/jub4fqs36nw9af5/gothcab_darkmod.zip?dl=0

Note that this is not a final model, I will reduce the polycount and optimize the textures later, but neither is so big that it shouldn't work afaik.

Link to comment
Share on other sites

Ase model file seems to be okay, at least at first glance. There's one more thing in the material though: description is not just to describe the material. There are several sound set names inherited from Doom3, all with proper TDM sounds: none, metal, stone, flesh, glass, wood. You use these at the beginning of your material with no quotes. If they're not sufficient for your needs, there are additional sound types, e.g. carpet. To use these, you have to declare additional keyword for these extra surface sounds with surftype15, and then you use description keyword to declare such type. Example:

Quote

 

surftype15

description "carpet"

 

If you want to have a description of your material, you have to do this:
 

Quote

 

surftype15

description "carpet This is a carpet material."

 

Now in your material there seems to be a new line after the // comment with default surface types, so stone gets declared as the surface set for your model. But then, you have also surftype15 uncommented, and then there's just a description "Gothic cabinet texture", without any extra surface type declared. IMO it's weird that the engine doesn't complain about the material, because it definitely should. Delete commented lines (have them at hand elsewhere), declare wood as surface type, get rid of that surftype15 keyword and it should help:

 

textures/darkmod/furniture/gothcab
{
	wood
	
    description      "Gothic cabinet material"
    qer_editorimage  textures/darkmod/furniture/gothcab_ed
 
    bumpmap          textures/darkmod/furniture/gothcab_local
    diffusemap       textures/darkmod/furniture/gothcab
    specularmap      textures/darkmod/furniture/gothcab_s
 
    // Frob
    {
        if ( parm11 > 0 )
        blend       gl_dst_color, gl_one
        map         _white.tga
        rgb         0.40 * parm11
    }
    {
        if ( parm11 > 0 )
        blend       add
        map         textures/darkmod/furniture/gothcab
        rgb         0.15 * parm11
    }

        // TDM Ambient Method Related
        {
                if (global5 == 1)
                blend add
                map                             textures/darkmod/furniture/gothcab
                scale                   1, 1
                red                             global2
                green                   global3
                blue                    global4
        }
}

 

Edited by peter_spy
Link to comment
Share on other sites

01.thumb.jpg.abd1a265f9ae9ac6d801cd8fbec37b2d.jpg

The model works, you must have something else done wrong in your setup. It's really not fit for TDM though. Texture layout suggest some doors that aren't even in the model, but this part alone is over 3k tris. Too many unnecessary edges. These ornament pieces at the top are modelled, not baked onto normalmap. It wouldn't be a problem for a static lighting engine and baked lightmap, but here stencil shadows are dynamic geometry extruded from model shape. Quite CPU and GPU heavy. All intricate details and soft edges have to be faked with normalmap to make shadow geometry more optimal.

Edited by peter_spy
Link to comment
Share on other sites

15 hours ago, peter_spy said:

It's really not fit for TDM though.

Right, I mentioned that above, this is not a final lowpoly version, I will reduce the polycount and possibly make a shadow mesh, same with adding doors. It also has 4k textures right now. I wanted to get it working as is first so that I know that my workflow is correct and I can test it in game.

 

15 hours ago, peter_spy said:

The model works, you must have something else done wrong in your setup.

Could you upload a zip of the test mission with model that you used so that I can try it here please?

 

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

    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 0 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
×
×
  • Create New...