Texture Creation - Basic Tutorial: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Line 74: Line 74:


Oh and don't use Notepad, it sucks. That's it. Your new texture should appear in both the editor and in-game.
Oh and don't use Notepad, it sucks. That's it. Your new texture should appear in both the editor and in-game.
See [[Basic Material File]] for more information.


= Summary =
= Summary =

Revision as of 00:47, 5 June 2007

Originally written by SneaksieDave on http://forums.thedarkmod.com/topic/3814

For what seems like forever, we've been wanting for textures. The donated DVD, countless free sources on the web, new 'techniques and ideas' on how to make them. That's all great, but for whatever reasons, we still don't have much. A game like this needs a TON of textures, and TDM is lacking them badly. So I wanted to try to learn how to do this mysterious, wonderous, magick...

Erm, well, it's not magick. Far from it, in fact. This tutorial isn't for those of you who already know how to do this*, and already know it's not magick. This tutorial is for the rest of us, those who have been too scared or lazy to even bother asking "how do I?", like me. (It's the former, honest!)

One other thing: this is not a Photoshop tutorial. Photoshop does a whole lot of things, and I don't know squat about it yet. Tutorials for it are all over the place, so just Google it.

Texture Creation for the Rest of Us

Prerequisits

You'll need: (to follow this tutorial, not necessarily for the process)


Off we go

Get your source pic

This could be anything from a photograph you took, to a free texture download from the internet, to a hand drawn picture, if you're one of those fortunate enough to possess that skill.

If you do want to take photos, some tips:

  • try to shoot on an overcast day; the diffuse light will remove most unwanted shadows
  • try to take the photo as perfectly face-on to the surface as you can manage. If your end result isn't perfect, don't worry, there are ways to fix it (transform->skew, to name one)
  • try to select an area that will be tile-able (if that's what you want)
  • try to capture a large area such that you'll have enough to work with, but not so big that your resolution on the final product will suck

Inspect your image

In Photoshop, inspect the source image. If you're going to tile it, try to find a regular repeating area. This is only to make your job easier. You can tile anything, really, but it depends on how much work you want to give yourself. If you don't know what I mean here, at the next step you will.

After you've chosen a rough tile-able area (from here forward I'm going to assume you are doing a tiled texture), crop that area out, and size your image to the desired size ratio. I wouldn't go lower than 1024 resolution at this stage of the work, or you'll start losing picture quality quickly. So set it to 2048X1024, or 1024X1024, etc. The reason we need to fix the size ratio (not the final size) at this stage is for the next step.

Set the offset

Go to Filter->Other->Offset. You want to set the horizontal and vertical to be exactly half of your cropped picture's width and height. That will make the opposite edges of the texture meet each other in the middle of the view, so you can make it really tile-able.

Make the seams disappear

See those seams running right down the middle of the pic, vertically and horizontally? You have to make them disappear. Get to know the clone tool. (Google...) There are many other ways to shuffle pixels too, but I'll leave the specifics up to you. This is usually the hardest, most time consuming step.

Once you've blended the lines away, run the Offset filter again to restore the correct layout of your pic, and save it out in a nice high quality (but not too big to manage) format. This is the "diffuse" image. We're using 24bit TGA for TDM.

Create a normal map

Now that the diffuse is done, using that same pic, open Filter->Nvidia Tools->NormalMapFilter. You'll probably have to play with the values for a while to get a feel for it, and to get a normal map you are happy with. This is a rough approximation method, by no means as accurate as actually modelling a texture, but it works pretty good in most cases. Basically, it will make light areas "high" and dark areas "low". Learn how to manipulate color levels in Photoshop, and you'll be making good normal maps with the Nvidia filter in no time. If you think about it, there are countless ways to adjust the image (in fact, you're not even restricted to using the diffuse image as the base of the normal map...) to get desired results - inverting colors, brightness and contrast controls, painting over areas, gradients, etc. It's a "feel" thing, so you'll have to develop that for yourself. After creating your desired normal map (try not to make it too blurry, or too sharp, or too bumpy - yuck), save it out as you did with the diffuse image, with "_local" appended.

Add a specular map

If you want a specular map, the process is even more subjective. There are countless ways in Photoshop to adjust color and light level and even invert everything or parts or mask out areas. Specular maps work as such: Darker is rendered as dull, lighter is rendered as shiny. Get it? Think of the possibilities, and have fun with it. You can get some pretty amazing results with just minutes of work. Save that image out as you did the diffuse, with "_s" appended.

Create your material file

Create a material for the texture. In the materials folder, create a file like mytex.mtr, and add the following:

textures/your_desired_editor_texture_folder/your_texture_name
{
   [TDM has custom surface types here.  for example, wood, stone, glass]

   qer_editorimage  textures/your_file_folder/your_texture_name

   bumpmap          textures/your_file_folder/your_texture_name_local
   diffusemap       textures/your_file_folder/your_texture_name
   specularmap      textures/your_file_folder/your_texture_name_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/your_file_folder/your_texture_name
       rgb         0.15 * parm11
   }
}

Oh and don't use Notepad, it sucks. That's it. Your new texture should appear in both the editor and in-game.

See Basic Material File for more information.

Summary

So you see, it's really quite simple:

  • Crop the desired area
  • Make it tileable if necessary
  • Generate a normal map
  • Create a specular map if you want one
  • Include it in a material file
  • DONE

Those who know more about this than me (I've been doing it all of one day so far) are encouraged to contribute tips if you have them.

Links