Level Overviews

From Valve Developer Community
(Redirected from Creating radar image)
Jump to: navigation, search
English (en)한국어 (ko)Translate (Translate)


Some games or mods (such as Counter-Strike: Source Counter-Strike: Source and Day of Defeat: 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.

* Making a mini-map for Counter-Strike: Global Offensive

Make the raw overview image

Todo: Move when cl_drawhud is disabled to right before taking screenshot; disabling it also disables the red line required for alignment!
  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. This is important, as using the default screenshot key (F5) will take a compressed JPEG rather than a raw TGA.
  6. Remove any HUD elements with console commands "cl_drawhud 0" and "hidepanel all".
  7. Remove disturbing world effects like skyboxes ("r_skybox 0"), fog ("fog_override 1" and "fog_enable 0"), props (optional: "r_drawstaticprops 0"), etc.
  8. Move in spectator mode to a position where you can see the whole level from above.
  9. Switch to orthographic mode with the console command "cl_leveloverview x", where x is the scale factor.
  10. 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.
  11. 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)
  12. 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.
  13. The current projection data (position and scale) will be updated in the console, eg "Overview: scale 6.00, pos_x -2651, pos_y 4027".
  14. 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 (or alternatively 1440x1080*) resolution instead of 1280x1024. Set "cl_leveloverviewmarker 768".

Note.pngNote:The exact resolution doesn't actually matter, as long as it is 4:3 or 5:4; we will be cropping the image to square, then resizing the image to a power of two in the next step.
Note.pngNote:Map overview captured with lower screen resolution will look blurrier and lower-res.
Note.pngNote:* - Some resolution like this may require you to create custom resolution on graphics card control panel.

Create the overview material

  1. Close the game and open the screenshot in an image editor. You will find it in <game dir>\screenshots. Crop the image horizontally, so that the horizontal resolution matches the vertical resolution (leaving only the left side).
  2. Modify the image as you see fit, perhaps adding an alpha channel to remove unused areas.
    Tip.pngTip:If making a minimap for a Day of Defeat: Source Day of Defeat: Source map, consider desaturating the image to sepia. Not only will this improve period authenticity, it will also improve the accuracy of the DXT compressor, minimizing blocky compression artefacts without requiring an uncompressed VTF!
  3. Resize it so that its dimensions are a power of two. 1024x1024 is a good choice, assuming that your image starts off larger than that!
  4. Save your image in a lossless format (e.g. PNG or TGA) and create a material with it. You can use this template for the VMT:
    overviews/mapname.vmt
    vmt
    UnlitGeneric { $translucent 1 $basetexture overviews/mapname $vertexalpha 1 $no_fullbright 1 $ignorez 1 }

Creating the VTF

Icon-broom.png
This article or section needs to be updated to include current information regarding the subject because:
VTFLib clamps properly now, so VTFEdit VTFEdit (or VTFEdit Reloaded) would be better.
Remember to check for any notes left by the tagger at this article's talk page.

Don't forget to Clamp S and Clamp T when you are creating your VTF otherwise the border pixels will stretch and look horrible. Additionally it would appear that VTFLib.dll isn't clamping correctly so you will have to use Vtex.

When making a vtf with vtex you can use this for the configs:

"clamps" "1"
"clampt" "1"
"nocompress" "1"
"nomip" "1"

You can also use this code in a bat file to run vmex:

cd steamdirectory\steamapps\username\sourcesdk_content\gamefolder\materialsrc\overviews
"%sourcesdk%\bin\orangebox\bin\vtex" mapname.tga mapname_radar.tga
pause

Be sure to create a new folder called overviews in materialsrc and place the overview tga files in there. Don't forget to also change the italics in the bat code.

Create the overview script

Finally, create a text file called <mapname>.txt in <game dir>\resource\overviews\. This file will define the precise numbers needed to align the overview:

<mapname>
{
	material	overviews/mapname	// texture file
	pos_x		-2651			// X coordinate
	pos_y		4027			// Y coordinate
	scale		6.0 			// 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