Left 4 Dead Graffiti Tutorial: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (→‎Create the VMT and testing: Overstepped on VMT naming.)
Line 22: Line 22:
==Create the VMT and testing==
==Create the VMT and testing==
[[Image:l4d_graffiti_tutorial_03.png|thumb|right|200px|caption|The VMT text, resulting graffiti placed as an overlay in Hammer, and in-game result. Please click to view details.]]
[[Image:l4d_graffiti_tutorial_03.png|thumb|right|200px|caption|The VMT text, resulting graffiti placed as an overlay in Hammer, and in-game result. Please click to view details.]]
The VMT uses the <code>DecalModulate</code> shader. The following example VMT refers to the basetexture located in the '''materials''' folder (also in the '''graffiti''' subfolder), '''graffiti/graffiti_saferoom_c1_m3-4_01.vtf'''. It is the only line that should be changed within the VMT. Only as a convention, the actual file name of the VMT is the same name as the VTF. In this case, the VMT file name is '''graffiti_saferoom_c1_m3-4_01.vmt'''.  
The VMT uses the <code>DecalModulate</code> shader. The following example VMT refers to the basetexture located in the '''materials''' folder (also in the '''graffiti''' subfolder), '''graffiti/graffiti_saferoom_c1_m3-4_01.vtf'''. It is the only line that should be changed within the VMT. The actual file name of the VMT is the same name as the VTF but only as a convention. In this case, the VMT file name is '''graffiti_saferoom_c1_m3-4_01.vmt'''.  
<pre>
<pre>
DecalModulate
DecalModulate

Revision as of 09:02, 28 February 2011

Left 4 Dead seriesLeft 4 Dead series Graffiti in the Left 4 Dead series is used extensively in official maps. Also known as wall writings and scrawlings, there are many ways to make graffiti, as seen in Portal 1 and other Valve games. The L4D series follows a particular technique that keep them small in file size and supposedly more efficient to render. The process is simple and fun! Only a few important details are should be kept in-mind in order to ensure a fast and painless process. In short, the goal is to create a material with a DecalModulate shader along with a texture that has a RGB 124 126 124 background. Steps and details are as follows:

Note.pngNote:It is assumed that material creation is already understood in regards to proper texture dimensions and material editing. This tutorial also does not cover art techniques.

The process can be broken down into four small steps:

  1. Create a transparent source image with background completely filled with color RGB 127 127 127
  2. Save the image as TGA without alpha
  3. Convert the image to a VTF using vtex provided by the L4D1 or L4D2 Authoring Tools (this results in a background color of RGB 124 126 124)
  4. Create the accompanying VMT with DecalModulate shader and test

Creating and saving the image

The source image in an image editing program, Adobe Photoshop CS5. Source image 149_graffiti_monolith provided by Kev Edwards. Please click to view details.

Save the image with the RGB 127 127 127 background as a TGA in the materialsrc folder found in the game directory (located alongside the sounds, materials, models, etc. folders). If the folder does not exist, please create it. 24-bit appears to give good results. There is no need for an alpha channel in the image. Unfortunately, you cannot create the VTF using VTFEdit or the VTFedit plug-in. Vtex is necessary in order to generate a VTF with a background color of RGB 124 126 124.

Programs other than Adobe Photoshop should give the same results but they are not guaranteed. Feel free to experiment with other image editing programs, file formats, and settings.

Converting to VTF

149_graffiti_monolith.tga in the L4D2 materialsrc folder alongside a shortcut of vtex.exe, ready for converting. Please click to view details.

The simplest process is to create a shortcut of vtex.exe and place it in the materialsrc folder. vtex is located in the bin directory of the game (for example, C:\Program Files (x86)\Steam\steamapps\common\left 4 dead 2\bin). Drag the source image, the TGA file, onto the vtex.exe shortcut. The resulting VTF will be created in the materials folder. In this tutorial, *.pwl.vtf can be disregarded.

Create the VMT and testing

The VMT text, resulting graffiti placed as an overlay in Hammer, and in-game result. Please click to view details.

The VMT uses the DecalModulate shader. The following example VMT refers to the basetexture located in the materials folder (also in the graffiti subfolder), graffiti/graffiti_saferoom_c1_m3-4_01.vtf. It is the only line that should be changed within the VMT. The actual file name of the VMT is the same name as the VTF but only as a convention. In this case, the VMT file name is graffiti_saferoom_c1_m3-4_01.vmt.

DecalModulate
{
$basetexture "graffiti/graffiti_saferoom_c1_m3-4_01" //notice how the file type is not needed!
$surfaceprop default
$decal 1
$vertexcolor 1
$vertexalpha 1
}

The new material should appear in Hammer and its material browser. The graffiti should have a completely transparent background when applied as an overlay on a brush.

Troubleshooting

There are some issues that may crop up during the process that can be easily resolved:

  • Graffiti simply does not show up in the material browser or in the 3D view in Hammer
In most cases, simply re-check the basetexture path used in the VMT. It might have the incorrect path to the texture (VTF).
  • The background is not transparent as expected and appears to show the overlay border.
Make sure the background layer to the source image (TGA) is completely filled with RGB 127 127 127. The solid gray background can be lost during image resizing, for example, especially around the edges of the image.
  • The VTF converted always has a background other than RGB 124 126 124. This results in a non-transparent background in-game.
The source image should be converted using vtex provided with the authoring tools. Third-party programs appear to have difficulty achieving that specific color.

See also

Decals - Using modulation

External links

The Left 4 Dead Wiki - Graffiti - Gallery and captions of graffiti found in official maps