User:Frost Salamander: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
(28 intermediate revisions by the same user not shown)
Line 19: Line 19:
|-
|-
| materials definitions || tdm_textures_base01.pk4\materials || base materials files  
| 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
|}
|}
== 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 ==
== 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.
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.


Line 34: Line 70:


=== Obtain your image ===
=== Obtain your image ===
# Log into textures.com and find an image you like.  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. Download it.
# 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 ===
=== Open your Image in GIMP ===
The first thing 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)'''
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)'''


=== Crop your Image ===
=== Crop your Image ===
This is only needed if you don't intend to use the entire image as-is.  Skip this section if that is the case.
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).
# With the image in GIMP, select the Crop Tool (Shift+C).
# Under the 'Tool Options' tab, tick the box for 'Delete cropped pixels'
# 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 click 'Enter' when done.
# 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) ===
=== Create the Diffuse Map (DDS File) ===
# Open the image in GIMP and choose File -> Export as... Choose 'Select File Type (By Extension)' at the bottom of the dialogue and select 'DDS Image' and click 'Export'
# With the original or cropped image open in GIMP Choose File -> Export as...
# On the next pop-up, choose 'BC3 / DXT5' for Compression and select 'Generate mipmaps'. Leave everything else as default. '''(ADVICE NEEDED)'''  Click 'Export'
# In the next popup, change the filename to 'texturename.dds' and click 'Export'.
# Name the file 'texturename.dds'
# On the next pop-up, choose your compression format (see below) and select 'Generate mipmaps'. Leave everything else as default. '''(ADVICE NEEDED)'''  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 ===
=== Create the Normal Map (TGA File)===
# With the original image open in GIMP, select Filters -> Generic -> Normal Map..
# With the original or cropped image open in GIMP, select Filters -> Generic -> Normal Map..
# 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.
# 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'
# After adjusting the scale, click 'OK'
# Choose 'Select File Type (By Extension)' at the bottom of the dialogue and select 'TarGA Image' and click 'Export'
# 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)'''
# On the next pop-up, untick 'RLE compression' and leave 'Origin' at 'Bottom left'. Click 'Export'. '''(ADVICE NEEDED)'''
# Name the file 'texturename_local.tga'


=== Create the editor icon ===
=== Create the editor icon (JPG File) ===
# Since you've modified the image, either close and re-open the image in GIMP, or go back in your Undo History in GIMP and select the original image before you made any changes.  It will be called '[ Base Image ]'.
# 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.
# 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'.
# 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'.
# Choose File -> Export as... Choose 'Select File Type (By Extension)' at the bottom of the dialogue and select 'JPEG Image' and click 'Export'
# 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'
# On the next pop-up, untick all the 'save data' boxes except for 'Save color profile' '''(ADVICE NEEDED)'''.  Click 'Export'
# Name the file 'texturename_ed.jpg'


=== Create TDM materials file ===
=== Create TDM materials file ===
Line 70: Line 107:
# 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.
# 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
  textures/darkmod/stone/brick/bricks_dirty
  {
  {

Revision as of 21:45, 26 April 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

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)

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'. Leave everything else as default. (ADVICE NEEDED) 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)

  1. With the original or cropped image open in GIMP, select Filters -> Generic -> Normal Map..
  2. 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.
  3. After adjusting the scale, click 'OK'
  4. Choose File -> Export as..., change the file name to 'texturename_local.tga' and click 'Export'
  5. 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'.
  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
}