User:Frost Salamander: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
No edit summary
 
(53 intermediate revisions by the same user not shown)
Line 1: Line 1:
# TDM Files and Contents
== TDM Files and Contents ==


{| class="wikitable"
{| class="wikitable"
Line 10: Line 10:
| 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 Constants|| tdm_base01.pk4\script\tdm_defs.script || constant values. Useful if you need to know the literal values for use in your scripts.
|-
|-
| Example || Example || Example
| 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
|-
| guard model materials || tdm_ai_humanoid_guards01.pk4 || guard materials and texture files
|-
| Stim types || tdm_base01.pk4/script/tdm_stim_response.script ||
|-
| Readable textures || tdm_gui01.pk4/dds/guis/assets/readables || various parchment textures
|-
| Blueprint textures || tdm_models02.pk4 || textures/readables/blueprint01*
|}
|}
== Creating an Image Decal with Gimp ==
# Go to somewhere like pixabay.com and search for free images.  I usually filter by 'vector graphics' (e.g. PNG) because it supports alpha channel which you'll need for decals.
# Once you find an image, download it.  I tend to get medium-sized versions (e.g. close to 1024 x 1024)
# Open the file in Gimp
# Scale the image to 1024x1024 pixels.
# export as TGA
== Creating a Text Decal with Gimp ==
# Open Gimp - New ->
# Set image size to 1024 x 1024 (or something more rectangular like 1024 x 512)
# Click Advanced -> Fill with: transparency
# Add text layer
# When happy with text, right-click the text layer and 'merge down' into alpha layer
# save and export as TGA.
# Create a materials file (.mtr) like so:
  textures/darkmod/decals/signs/coronet
  {
  DECAL_MACRO
  noimpact
 
  {
  blend blend
  map textures/darkmod/decals/signs/coronet
  }
  }
== 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 ===
# 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 if 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)'''
=== Resize Image (if needed) ===
TDM standard resolution for textures is 1024 x 1024.  However it's possible to get away with 2048 x 2048 at the cost of file size and performance.
If you can't find a 1024 x 1024 image for whatever reason (say it's 4K instead), you can scale it down:
# With the image open in GIMP, click Image -> Scale Image...
# Set the width in 'Image Size' in pixels to 1024.  Make sure the width and height are 'chained' (the little link icon should be whole). The height will then scale down proportionately to match the width.
=== 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.
# With the image in GIMP, select the Crop Tool (Shift+C).
# Under the 'Tool Options' tab, tick the box for 'Delete cropped pixels'
# Using the crop tool select the area you want to keep on the image with your mouse, and press 'Enter' when done.
=== Create the Diffuse Map (DDS File) ===
# With the original or cropped image open in GIMP Choose File -> Export as...
# In the next popup, change the filename to 'texturename.dds' and click 'Export'.
# On the next pop-up, choose your compression format (see below) and select 'Generate mipmaps'. Under 'Mipmap Options' choose 'Filter': 'Kaiser' for best quality. Click 'Export'
  - Compression:
    - if your image contains an alpha channel, choose 'BC3 / DXT5'
    - if your image does not contain an alpha channel, choose 'BC1 / DXT1'
=== Create the Normal Map (TGA File)===
Apart from creating the normal map, the point of the first few steps is to reduce the amount of 'noise' in the image which can lead to a grainy appearance.
# With the original or cropped image open in GIMP, select Colors -> Desaturate -> Desaturate. Click 'OK'
# Select Filters -> Blur -> Gaussian Blur.  Leave the defaults and click 'OK'.
# Select Colors -> Curves and adjust the curve to 'wash out' (i.e. brighten) the image to remove any noise detail.
# Select Filters -> Generic -> Normal Map..
# The image will change to a blueish colour and you will be able to see the 'bumps'. The only thing I adjust here is the 'Scale' property.  If it looks very grainy, just reduce the scale. 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.
# After adjusting the scale, click 'OK'
# Choose File -> Export as..., change the file name to 'texturename_local.tga' and click 'Export'
# On the next pop-up, untick 'RLE compression' and leave 'Origin' at 'Bottom left'. Click 'Export'. '''(ADVICE NEEDED)'''
=== Create the editor icon (JPG File) ===
# 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).
# Choose Image -> Scale Image... from the menu.
# 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'. If the image looks too blurry, you can try 512 x 512.
# Choose File -> Export as..., change the file name to 'texturename_ed.jpg' and click 'Export'
# On the next pop-up, untick all the 'save data' boxes except for 'Save color profile' '''(ADVICE NEEDED)'''.  Click 'Export'
=== Create TDM materials file ===
# 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'
# 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
}

Latest revision as of 17:47, 8 June 2024

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
guard model materials tdm_ai_humanoid_guards01.pk4 guard materials and texture files
Stim types tdm_base01.pk4/script/tdm_stim_response.script
Readable textures tdm_gui01.pk4/dds/guis/assets/readables various parchment textures
Blueprint textures tdm_models02.pk4 textures/readables/blueprint01*

Creating an Image Decal with Gimp

  1. Go to somewhere like pixabay.com and search for free images. I usually filter by 'vector graphics' (e.g. PNG) because it supports alpha channel which you'll need for decals.
  2. Once you find an image, download it. I tend to get medium-sized versions (e.g. close to 1024 x 1024)
  3. Open the file in Gimp
  4. Scale the image to 1024x1024 pixels.
  5. export as TGA

Creating a Text Decal with Gimp

  1. Open Gimp - New ->
  2. Set image size to 1024 x 1024 (or something more rectangular like 1024 x 512)
  3. Click Advanced -> Fill with: transparency
  4. Add text layer
  5. When happy with text, right-click the text layer and 'merge down' into alpha layer
  6. save and export as TGA.
  7. Create a materials file (.mtr) like so:
 textures/darkmod/decals/signs/coronet
 {
 	DECAL_MACRO
 	noimpact
 	
 	{
 		blend blend
 		map textures/darkmod/decals/signs/coronet
 	}
 }

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 if 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)

Resize Image (if needed)

TDM standard resolution for textures is 1024 x 1024. However it's possible to get away with 2048 x 2048 at the cost of file size and performance. If you can't find a 1024 x 1024 image for whatever reason (say it's 4K instead), you can scale it down:

  1. With the image open in GIMP, click Image -> Scale Image...
  2. Set the width in 'Image Size' in pixels to 1024. Make sure the width and height are 'chained' (the little link icon should be whole). The height will then scale down proportionately to match the width.

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 press 'Enter' when done.

Create the Diffuse Map (DDS File)

  1. With the original or cropped image open in GIMP Choose File -> Export as...
  2. In the next popup, change the filename to 'texturename.dds' and click 'Export'.
  3. On the next pop-up, choose your compression format (see below) and select 'Generate mipmaps'. Under 'Mipmap Options' choose 'Filter': 'Kaiser' for best quality. Click 'Export'
 - Compression:
   - if your image contains an alpha channel, choose 'BC3 / DXT5'
   - if your image does not contain an alpha channel, choose 'BC1 / DXT1'

Create the Normal Map (TGA File)

Apart from creating the normal map, the point of the first few steps is to reduce the amount of 'noise' in the image which can lead to a grainy appearance.

  1. With the original or cropped image open in GIMP, select Colors -> Desaturate -> Desaturate. Click 'OK'
  2. Select Filters -> Blur -> Gaussian Blur. Leave the defaults and click 'OK'.
  3. Select Colors -> Curves and adjust the curve to 'wash out' (i.e. brighten) the image to remove any noise detail.
  4. Select Filters -> Generic -> Normal Map..
  5. The image will change to a blueish colour and you will be able to see the 'bumps'. The only thing I adjust here is the 'Scale' property. If it looks very grainy, just reduce the scale. 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.
  6. After adjusting the scale, click 'OK'
  7. Choose File -> Export as..., change the file name to 'texturename_local.tga' and click 'Export'
  8. On the next pop-up, untick 'RLE compression' and leave 'Origin' at 'Bottom left'. Click 'Export'. (ADVICE NEEDED)

Create the editor icon (JPG File)

  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'. If the image looks too blurry, you can try 512 x 512.
  4. Choose File -> Export as..., change the file name to 'texturename_ed.jpg' and click 'Export'
  5. On the next pop-up, untick all the 'save data' boxes except for 'Save color profile' (ADVICE NEEDED). Click 'Export'

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
}