[TUTORIAL] Making a texture with a normal map

Discussion in 'Tutorials & Resources' started by VelvetFistIronGlove, Apr 4, 2008.

  1. VelvetFistIronGlove

    aa VelvetFistIronGlove

    Messages:
    567
    Positive Ratings:
    437
    Here's how I built a cobblestone texture for my castle map (cp_siege). What I cover in here is the process of using free source photos to produce a TF2ish texture with a bump map. I don't go into the details of using photoshop (a screencast would be better for that), or of compiling vtfs, since that's already covered in other tutorials.

    First I decided on the look I wanted. I was after rectangular, fairly even granite cobbles. Here was a nice reference image on flickr:
    [​IMG]

    Starting from a photo is a good way to get a realistic-looking image: I was going to take some source photos myself, but my camera packed it in, so I hopped on over to cgtextures.com to find some suitable images. In particular, I was looking for a nice high-contrast picture. This one fit the bill quite nicely:
    [​IMG]

    I cropped this down, edited it to be seamless, resized it to 1024x1024, and adjusted the levels and colours a bit:
    [​IMG]

    I wanted the cobbles to look like granite, not sandstone, so it was off to cgtextures to find another source image:
    [​IMG]

    I cropped and resized it, and tweaked the colours to get what I wanted:
    [​IMG]

    I put this in a layer underneath the cobbles, and changed the cobbles layer to "Multiply" mode to get nice granite cobbles. Notice how a little of the texture of the original cobblestones has remained:
    [​IMG]

    So the texture was shaping up well. I didn't like the black cracks, so I thought I'd find a source image to put dirt in the cracks. From cgtextures:
    [​IMG]

    I cropped and resized this one down to fit:
    [​IMG]

    I now needed to make the dirt only appear in the cracks between stones. So I copied the light cobblestones texture, increased its brightness and contrast, and blurred it slightly. This gave me a nice outline of the cobblestones:
    [​IMG]

    Taking this, I inverted it and put it in a mask for the dirt, so the dirt was now only in the cracks:
    [​IMG]

    You can see that the stones don't seem to stand out from the dirt at all. I added another layer with a black "inner glow" on the stones so they'd be better defined:
    [​IMG]

    This is now almost right. It just looks a little to grainy and 'realistic'. I used the 'Artistic -> Dry Brush' filter to give it more of a painted look. I then tweaked the lightness a little as well. This is the final diffuse map:
    [​IMG]

    Now for the normal map. To make this, I used Nvidia's photoshop plugin. This works from a variety of sources, but I find it works well if you make a heightmap indicating the different levels of the texture. Since the cracks are low and the bricks are high, I used the same outline image again for the heightmap:
    [​IMG]

    Running it through the normal map filter, using the "Max (R, G, B)" conversion produced the normal map:
    [​IMG]

    Now we need to put it together. First I resize the texture down to 512x512 (it doesn't need to be bigger), and then I make a simple VMT file:
    Code:
    "LightmappedGeneric"
    {
    	"" "cp_siege/vfig-cobbles"
        "" "cp_siege/vfig-cobbles-normal"
        "" "rock"
    	"%keywords" "tf"
    }
    
    After compiling the textures, here's how it looks in-game:
    [​IMG]

    EDIT:

    So, I revised the texture a little, following the advice given in comments on this thread; mostly rounding off the normal map edges, and adding some brush strokes:
    [​IMG]

    And if anyone's interested, the PSD is available (7zipped, 18MB).

    If you've got any questions about the details of a particular step, please ask.
     
    • Thanks Thanks x 22
    Last edited: Apr 7, 2008
  2. R3dRuM

    R3dRuM L6: Sharp Member

    Messages:
    303
    Positive Ratings:
    19
    You own velve, nice tutorial!
     
  3. YM

    aa YM LVL100 YM

    Messages:
    7,099
    Positive Ratings:
    5,920
    Epic :D
    Nothing I didn't already know but thats besides the point.
    I think you need to make the normal map for your stones rounded slightly (more like cobbles) and you definatly need some brush strokes in there :p
     
  4. VelvetFistIronGlove

    aa VelvetFistIronGlove

    Messages:
    567
    Positive Ratings:
    437
    Yeah, I tweaked that this morning.

    Brush strokes? Pah. Well ok, maybe.
     
  5. The Scientist

    The Scientist L1: Registered

    Messages:
    48
    Positive Ratings:
    0
    It's an amazing looking texture, but I agree with youme that a few broad brush strokes could help it fit in with the tf2 style a little.
     
  6. MrAlBobo

    MrAlBobo L13: Stunning Member

    Messages:
    1,059
    Positive Ratings:
    219
    it would likely add to the tutorial if you added brush strokes steps as a optional add-on

    and also...is there somewhere i can find a list of the other texture types?
    like for this you have "rock" listed in the vmt code, if, say you wanted a texture that behaved like wood, would you just replace rock with wood?
     
  7. Hawk

    Hawk L7: Fancy Member

    Messages:
    419
    Positive Ratings:
    212
    Very well-done tutorial.
     
  8. YM

    aa YM LVL100 YM

    Messages:
    7,099
    Positive Ratings:
    5,920
    Oh i see the edit now, much better :D
     
  9. phatal

    phatal L6: Sharp Member

    Messages:
    259
    Positive Ratings:
    21
    Great tutorial. I've been looking for a step by step on this for some time. Much appreciated.
     
  10. l3eeron

    l3eeron L8: Fancy Shmancy Member

    Messages:
    594
    Positive Ratings:
    86
    Awesome....

    and I can actually follow you, even though Photoshop isnt my strongest program.

    +thanks
     
  11. MrAlBobo

    MrAlBobo L13: Stunning Member

    Messages:
    1,059
    Positive Ratings:
    219
  12. VelvetFistIronGlove

    aa VelvetFistIronGlove

    Messages:
    567
    Positive Ratings:
    437
    Unfortunately, I don't remmeber the steps I took to add the brush strokes; although you can see the end result, and download the PSD to see how it's different.

    Was about to post a link, but I see you've found it already :)
     
  13. Open Blade

    Open Blade L7: Fancy Member

    Messages:
    439
    Positive Ratings:
    34
    I wonder if Hammer has a way of allowing downloaded texture files that others have made to be selectable (using all the original properties the designer used).
     
  14. VelvetFistIronGlove

    aa VelvetFistIronGlove

    Messages:
    567
    Positive Ratings:
    437
    Hammer will let you use any material whose .vmt and .vtf files are in a subdirectory of the "[STEAMACCOUNT]\team fortress 2\tf\materials" directory -- is this what you mean?

    Also, if you're planning on reusing people's custom textures, make sure the texture author is ok with that first.
     
  15. MrAlBobo

    MrAlBobo L13: Stunning Member

    Messages:
    1,059
    Positive Ratings:
    219
    a question...do you happen to know how to make a texture reflective?
    I assume it has something to do with the alpha channel...but I haven't had a chance to experiment
     
  16. tedrock

    tedrock L2: Junior Member

    Messages:
    79
    Positive Ratings:
    8
    • Thanks Thanks x 1
    Last edited: May 8, 2008
  17. MrAlBobo

    MrAlBobo L13: Stunning Member

    Messages:
    1,059
    Positive Ratings:
    219
    eh...i was mostly looking for how to make a texture shiny, with a bit of reflectiveness
    like polished metal, or polished granite
    reflecting players isn't something i was aiming for
    the 1st link doesn't look like what i want, but Ill play with what it says in the 2nd tomorrow, the most useful thing though would be a name of a default shiny texture, so I can look at the vmt and see how its done
     
  18. Arhurt

    Arhurt L6: Sharp Member

    Messages:
    316
    Positive Ratings:
    142
    Take a look at the Phong material settings at the valve wiki.

    http://developer.valvesoftware.com/wiki/Phong
     
  19. dcar227

    dcar227 L1: Registered

    Messages:
    1
    Positive Ratings:
    0
    I have a problem plz HELP T-T..... I get the checkers and can't figure out whats wrong.
    I'm new at adding textures so where can i find a tutorial on how to add my textures to hammer 4 TF2?
     
  20. Arhurt

    Arhurt L6: Sharp Member

    Messages:
    316
    Positive Ratings:
    142
    If it's purple checkers layered on top of your textures in-game, then look for info on cubemaps, if you add but a single env_cubemap the checkers will disappear, but you want to take a look at it a little bit more. Just search the forums for Cubemaps. In fact, if you searched for checkers or Purple checkers you'd get an answer ;)

    If your whole texture is with checkers, there is either a problem in your VMT or materials folder configuration. In the VMT you don't add the .vtf extension!