User:Frost Salamander

From The DarkMod Wiki
Jump to navigationJump to search

TDM Files and Contents

Caption text
Content File path Notes
Skins tdm_models_decls01.pk4\skins skin files shipped with TDM
Script Constants tdm_base01.pk4\script\tdm_defs.script constant values. Useful if you need to know the literal values for use in your scripts.
Script Objects tdm_base01.pk4\script various script objects for entities.
tdm_ai_humanoid_newskel.def tdm_ai_humanoid_undead01.pk4\def\tdm_ai_humanoid_newskel.def Base class for all TDM humanoid entities
GUI Icons tdm_gui01.pk4\dds\guis\assets\hud\ HUD icons. e.g. loot, potions, etc
sound shaders tdm_sound_ambient_decls01.pk4\sound ambient environmental sound shaders
materials definitions tdm_textures_base01.pk4\materials base materials files

Creating a material using existing images (e.g. from textures.com) using GIMP

Written on May 28th, 2023 using GIMP 2.10.34

This will describe how to create your own texture (material) using an image found on the internet. I will use textures.com as an example.

Ensure that the license for whatever source you use is appropriate for TDM (e.g. allows use in video games)

We will end up with 3 image files and one materials file:

  • diffuse map (the base image with colour details, etc)
  • normal map (faked bump/dent data)
  • DarkRadiant editor icon

This doesn't cover creation of a specular map. This isn't needed unless your material needs a shiny surface (e.g. metal or wet surfaces).

Obtain your image

  1. Log into textures.com and find an image you like under the 'Regular Photos' section (NOT 'Special Content'). Make sure it's seamless if it needs to be tiled/repeatable (e.g. for bricks or walls). If it's something like a door or window, it doesn't need to be seamless. There is normally a JPG format that that is close to or exactly 1024x1024 pixels (ADVICE NEEDED). Download it.

Open your Image in GIMP

The first thing you may see here is a pop-up asking of you want to convert the image to 'the built-in sRGB color profile'. I'm not sure the implications of doing this but just choose 'Convert'. (ADVICE NEEDED)

Crop your Image

This is only needed if you don't intend to use the entire image as-is (e.g. if you want to cut a door or window out of an image). Skip this section if that is not the case.

  1. With the image in GIMP, select the Crop Tool (Shift+C).
  2. Under the 'Tool Options' tab, tick the box for 'Delete cropped pixels'
  3. Using the crop tool select the area you want to keep on the image with your mouse, and click 'Enter' when done.

Create the Diffuse Map (DDS)

  1. With the original or cropped image open in GIMP Choose File -> Export as... Choose 'Select File Type (By Extension)' at the bottom of the dialogue and select 'DDS Image' and click 'Export'
  2. On the next pop-up, choose 'BC3 / DXT5' for Compression and select 'Generate mipmaps'. Leave everything else as default. (ADVICE NEEDED) Click 'Export'
  3. Name the file 'texturename.dds'

Create the Normal Map

  1. With the original or cropped image open in GIMP, select Filters -> Generic -> Normal Map..
  2. The only thing I adjust here is the 'Scale' property. For things like bricks, I use a value < 5 or else the finished texture will look very grainy in TDM. For stuff like doors, a value of about 10 looks OK.
  3. After adjusting the scale, click 'OK'
  4. Choose 'Select File Type (By Extension)' at the bottom of the dialogue and select 'TarGA Image' and click 'Export'
  5. On the next pop-up, untick 'RLE compression' and leave 'Origin' at 'Bottom left'. Click 'Export'. (ADVICE NEEDED)
  6. Name the file 'texturename_local.tga'

Create the editor icon

  1. Since you've modified the image, either close and re-open the image in GIMP, or go back into your Undo History and select the original image (or cropped image if it's been cropped).
  2. Choose Image -> Scale Image... from the menu.
  3. On the dialogue, either scale it to 256x256 px (if it was a 1024x1024 image originally), or just scale it down to 25% if it was something else. Click 'Scale'.
  4. Choose File -> Export as... Choose 'Select File Type (By Extension)' at the bottom of the dialogue and select 'JPEG Image' and click 'Export'
  5. On the next pop-up, untick all the 'save data' boxes except for 'Save color profile' (ADVICE NEEDED). Click 'Export'
  6. Name the file 'texturename_ed.jpg'

Create TDM materials file

  1. Within your FM folder, save all your images in the appropriate TDM folder structure. Just follow the existing conventions. For example your DDS files go into 'dds/textures/darkmod/stone/brick' and your normal map and editor files go into 'textures/darkmod/stone/brick'
  2. Create the materials file as follows below. Give it a name like 'mybricks.mtr' and put it in the /materials folder in your FM. The material name as it appears in DarkRadiant appears at the top.

NOTE: 'texturename' in this example is 'bricks_dirty'

textures/darkmod/stone/brick/bricks_dirty
{
    stone
    description	"vine_friendly"

    qer_editorimage textures/darkmod/stone/brick/bricks_dirty_ed
    diffusemap      textures/darkmod/stone/brick/bricks_dirty
    bumpmap         textures/darkmod/stone/brick/bricks_dirty_local
}