Level Overviews: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
Line 30: Line 30:


== Edit the overview image ==
== Edit the overview image ==
<ol>
 
<li>Close the game and open the screenshot in an [[image editor]]. Screenshots are found in the <code>"<game dir>\screenshots"</code> directory. Using the [[image editor]], remove the unused border right of the red line so the image size is reduced to 1024x1024 pixels. Look for any option to reduce the "canvas size", you do not want to resize the image, but rather chop off the right side so you're left with a perfect square 1024x1024 or 768x768. It must be square and its dimensions must be a power of two, or [[Vtex]] will give an error.</li>
#Close the game and open the screenshot in an [[image editor]]. You will find it in <code><game dir>\screenshots</code>. Using your editor, crop away the unused part of the image to the right of the red line so that the image becomes a square. If you don't see the red line, then just make sure that the image is square.
<li>If you had an issue viewing the red line and used the "1024x768" mode, make sure the image size is a power of two. Resize your image to 512x512 or 1024x1024 or [[Vtex]] will fail.</li>
#Modify the image as you see fit, perhaps adding an alpha channel to remove unused areas.
<li>Modify the image as you like or add an alpha channel to blend out unused areas.</li>
#Resize it so that its dimensions are a power of two. 1024x1024 is a good choice, assuming that your image starts off large than that!
<li>Save it as a [[TGA|targa (.tga)]] image with the same name as your .bsp file, in your material source folder (eg. <code>"sourcesdk_content\cstrike\materialsrc\overviews\mapname.tga"</code>).</li>
#Save your image in a lossless format (e.g. PNG or TGA) and [[Creating a Material|create a material]] with it.
<li>If you are using Photoshop, you can instead download the "VTF-Plugin for Photoshop". You then select "Save as" from the menu, change the file type to ''.vtf'' and give it the exact same name as your map. Click ''OK'' and a box will pop-up. Select "Clamp S", "Clamp T", "No Compression" and "Eight Bit Alpha", and then select ''OK''.</li>
 
</ol>
== Create the material files ==
== Create the material files ==
<ol>
<ol>

Revision as of 04:42, 31 May 2008

Some mods (Counter-Strike:Source, Day of Defeat:Source) have a mini-map mode, that shows a level overview and projects players and objects on that map. An overview map is an image made from in-game screenshots and must be created once a new map is finished.

Make the raw overview image

  1. Start the game. Click Options and switch to the Video tab. Change Resolution to "1280x1024" pixels and the Aspect Ratio to "Normal".
  2. Load the new level with the map <mapname> console command and enable "sv_cheats 1".
  3. Join the Spectator team.
  4. Bind the screenshot command to a key, etc. "bind p screenshot" using the console.
  5. Remove any HUD elements with console commands "cl_drawhud 0" and "hidepanel all".
  6. Remove disturbing world effects like skyboxes ("r_skybox 0), fog ("fog_override 1" and "fog_enable 0"), props (optional: "r_drawstaticprops 0"), etc.
  7. Move in spectator mode to a position where you can see the whole level from above.
  8. Switch to orthographic mode with the console command "cl_leveloverview x", where x is the scale factor.
  9. Set "cl_leveloverviewmarker 1024" to show a red helper line on the right. You will need to briefly toggle cl_drawhud 1, line it up, and then toggle the HUD off again.
  10. Note.pngNote:Several people have commented that the red line does not appear when doing this at 1280x1024 resolution. If you don't see the red line, read the No red line section below.
    Sample level overview (de_dust2)
  11. You can move around while cl_leveloverview mode is on. You are still in spectator mode and moving, so move the arrow keys to change the position. Now change scale so the map fits into the square defined by the red line. The right edge of your map should be on the left of the red line, anything to the right of the red line will be chopped off in a later step. Check the attached screenshot to see how this step looks in de_dust2 running under Counter-strike:Source.
  12. The current projection data (position and scale) will be updated in the console, eg "Overview: scale 6.00, pos_x -2651, pos_y 4027".
  13. Once everything is perfect, take a screenshot (using the key you bound to "screenshot") and write down the projection data values. You will need them in a later step.

No red line?

If you don't see the red line appear at step 9, make sure you have set cl_drawhud 1 (turn this off again before taking the screenshot though). After this, if you still can't see the line, you may want to try starting over but use 1024x768 resolution instead of 1280x1024. Set "cl_leveloverviewmarker 768".

Edit the overview image

  1. Close the game and open the screenshot in an image editor. You will find it in <game dir>\screenshots. Using your editor, crop away the unused part of the image to the right of the red line so that the image becomes a square. If you don't see the red line, then just make sure that the image is square.
  2. Modify the image as you see fit, perhaps adding an alpha channel to remove unused areas.
  3. Resize it so that its dimensions are a power of two. 1024x1024 is a good choice, assuming that your image starts off large than that!
  4. Save your image in a lossless format (e.g. PNG or TGA) and create a material with it.

Create the material files

  1. Convert your image into a Valve Texture File (.vtf) using Vtex. (See Vtex for step-by-step instructions on how.) The texture file should end up as counter-strike source\cstrike\materials\overviews\mapname.vtf.
  2. In the same folder as this texture file, using a text editor, add a new Valve Material (.vmt) file called mapname.vmt, which should look like this:
  3. "UnlitGeneric"
    {
    	"$translucent" "1"
    	"$basetexture" "overviews/mapname"
    	"$vertexalpha" "1"
    	"$no_fullbright" "1"
    	"$ignorez" "1"
    }
    
  4. Finally, in a text editor, create a text file called mapname.txt in \resource\overviews\ (eg. counter-strike source\cstrike\resource\overviews\) that contains the necessary projection data:
  5. "mapname"
    {
    	"material"	"overviews/mapname"	// texture file
    	"pos_x"		"-2651"	// X coordinate,
    	"pos_y"		"4027"	// Y coordinate,
    	"scale"		"6.0" 	// and used scale used when taking the screenshot
    	"rotate"	"0"	// map was rotated by 90 degrees in [[image editor]]
    	"zoom"		"1.3"	// optimal zoom factor if map is shown in full size
    }
    

See also