Level Overviews: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(53 intermediate revisions by 24 users not shown)
Line 1: Line 1:
[[Category:Level Design]] [[Category:Tutorials]]
{{LanguageBar}}
__TOC__
Some games or mods (such as {{css|4}} and {{dods|4}}) 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 [[screenshot]]s and must be created once a new map is finished.


Some Mods (Counter-Strike:Source, Day of Defeat:Source) have a minimap mode, that shows a level overview and projects players and objects on that map. An <i>overview map</i> is an image made from in-game screenshots and must be created once a new map is finished.
'''* [[Creating a working mini-map for CS:GO|Making a mini-map for Counter-Strike: Global Offensive]]'''
 
== Make the raw overview image ==
==Make the raw overview image==
{{todo|Move when {{mono|cl_drawhud}} is disabled to right before taking screenshot; disabling it also disables the red line required for alignment!}}
 
<ol>
1. Start the game. Click '''Options''' and switch to the '''Video''' tab. Change '''Resolution''' to "1280x1024" pixels and the '''Aspect Ratio''' to "Normal".
<li>Start the game. Click '''Options''' and switch to the '''Video''' tab. Change '''Resolution''' to "1280x1024" pixels and the '''Aspect Ratio''' to "Normal".</li>
 
<li>Load the new level with the map <code><mapname></code> [[console command]] and enable <code>"sv_cheats 1"</code>.</li>
2. Load the new level with the map <code><mapname></code> [[console command]] and enable <code>"sv_cheats 1"</code>.
<li>Join the Spectator team.</li>
 
<li>Bind the "[[screenshot]]" command to a key, etc. <code>"bind f12 screenshot"</code> using the [[console]].</li> This is important, as using the default screenshot key (F5) will take a compressed [[JPEG]] rather than a raw [[TGA]].
3. Join the Spectator team.
<li>Remove any HUD elements with console commands <code>"cl_drawhud 0"</code> and <code>"hidepanel all"</code>.</li>
 
<li>Remove disturbing world effects like skyboxes (<code>"r_skybox 0"</code>), fog (<code>"fog_override 1"</code> and <code>"fog_enable 0"</code>), props (''optional:'' <code>"r_drawstaticprops 0"</code>), etc.</li>
4. Bind the screenshot command to a key, eg. <code>"bind p screenshot"</code> using the [[console]].
<li>Move in spectator mode to a position where you can see the whole level from above.</li>
 
<li>Switch to orthographic mode with the console command <code>"cl_leveloverview ''x''"</code>, where ''x'' is the scale factor.</li>
5. Remove any HUD elements with console commands <code>"cl_drawhud 0"</code> and <code>"hidepanel all"</code>.
<li>Set <code>"cl_leveloverviewmarker 1024"</code> to show a red helper line on the right. You will need to briefly toggle <code>cl_drawhud 1</code>, line it up, and then toggle the HUD off again.</li>
 
6. Remove disturbing world effects like skyboxes (<code>"r_skybox 0</code>), fog (<code>"fog_override 1"</code> and <code>"fog_enable 0"</code>), props (''optional:'' <code>"r_drawstaticprops 0</code>), 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 "<code>cl_leveloverview ''x''"</code>, where ''x'' is the scale factor.
 
9. Set <code>"cl_leveloverviewmarker 1024"</code> to show a red helper line on the right. You will need to briefly toggle <code>cl_drawhud 1</code>, line it up, and then toggle the hud off again.


{{note|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?|No red line]] section below.}}
{{note|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?|No red line]] section below.}}


[[Image:dust2_overview.jpg|350px|thumb|right|Sample raw level overview for de_dust2]]
[[File:dust2_overview.jpg|200px|thumb|Sample level overview (de_dust2)]]
10. You can move around while in 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. Here is a screenshot how it would look for the map <code>de_dust2</code> in Counter-strike:Source.<br style="clear:both">
 
11. The current projection data (position and scale) will be updated in the console, eg "Overview: <code>scale 6.00, pos_x -2651, pos_y 4027</code>"


12. 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.
<li>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 <code>de_dust2</code> running under Counter-strike:Source.</li>
<li>The current projection data (position and scale) will be updated in the console, eg "Overview: <code>scale 6.00, pos_x -2651, pos_y 4027</code>".</li>
<li>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.</li>
</ol>


===No red line?===
=== No red line? ===
If you don't see the red line appear at step 9, make sure you have set <code>cl_drawhud 1</code> (turn this off again before taking the screenshot though).
If you don't see the red line appear at step 9, make sure you have set <code>cl_drawhud 1</code> (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 <code>"cl_leveloverviewmarker 768"</code>.
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 <code>"cl_leveloverviewmarker 768"</code>.
{{note|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|Map overview captured with lower screen resolution will look blurrier and lower-res.}}
{{Note|* - Some resolution like this may require you to create custom resolution on graphics card control panel.}}


==Edit the overview image==
== Create the overview material ==
 
<ol>
1. 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.
<li>Close the game and open the screenshot in an [[image editor]]. You will find it in <code><game dir>\screenshots</code>. Crop the image horizontally, so that the horizontal resolution matches the vertical resolution (leaving only the left side).
 
<li>Modify the image as you see fit, perhaps adding an alpha channel to remove unused areas.
2. Modify the image as you like or add an alpha channel to blend out unused areas. Save the final image as mapname.TGA where mapname is the name of your .BSP file. Save the .TGA in your material source folder (eg. <code>"sourcesdk_content\cstrike\materialsrc\overviews\mapname.TGA"</code>)
{{tip|If making a minimap for a {{dods|4}} 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!}}
 
<li>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!
3. If you used the "768" mode make sure the image size is a power of two so 512x512 or 1024x1024 or vtex will fail
<li>Save your image in a lossless format (e.g. [[PNG]] or [[TGA]]) and [[Creating a Material|create a material]] with it. You can use this template for the VMT:
{{codeblock|lang=vmt|src=overviews/mapname.vmt|<nowiki>UnlitGeneric
{
$translucent 1
$basetexture overviews/mapname
$vertexalpha 1
$no_fullbright 1
$ignorez 1
}</nowiki>}}
</ol>
=== Creating the VTF ===
When importing the TGA into {{vtfedit reloaded|2}} (or your VTF creator of choice), make sure to have texture format set to {{mono|DXT1}}, with mipmap generation enabled and filter set to {{mono|Box}}.


If you do not resize it, vtex will give an error, it must be square!
In the texture flags, enable {{mono|Clamp S}}, {{mono|Clamp T}}, and {{mono|No Level of Detail}}. This will prevent the border pixels from stretching and looking horrible, and ensures that it won't be a blurry mess if the user


==Create the material files==
{{important|Many vanilla level overviews also use the "no mipmaps" flag. This is unnecessary! Disabling LOD prevents the same issues that disabling mipmaps is used for here, without introducing aliasing when the overview is inevitably shown at a smaller size as part of the minimap.}}


1. Run <code>"vtex.exe mapname.TGA"</code> to create a matching .VTF texture file (eg. <code>counter-strike source\cstrike\materials\overviews\mapname.VTF</code>). Make sure that '''Current Game''' is set correctly in the SDK window for the Mod your working on. More information on creating materials can be found in [[Creating Materials]].
Don't forget to save to whatever filename $basetexture pointed to in the previous section.


2. In the same folder as this .VTF, using a text editor, add a new material file, mapname.VMT, which should look like this:
== Create the overview script ==


<pre>
Finally, create a text file called <code><mapname>.txt</code> in <code><game dir>\resource\overviews\</code>. This file will define the precise numbers needed to align the overview:
"UnlitGeneric"
{
"$translucent" "1"
"$basetexture" "overviews/mapname"
"$vertexalpha" "1"
"$no_fullbright" "1"
"$ignorez" "1"
}
</pre>


3. Finally, in a text editor, create a text file mapname.txt in \resource\overviews (eg. counter-strike source\cstrike\resource\overviews) that contains the necessary projection data:
<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 // (optional) map was rotated by 90 degrees in [[image editor]]
zoom 1.3 // (optional) optimal zoom factor if map is shown in full size
}


<pre>
== See also ==
"mapname"
* [[VGUI2: Overview Display]]
{
* [[How To Take Screenshots]]
"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 degress in image editor
"zoom" "1.3" // optimal zoom factor if map is shown in full size
}
</pre>


==See also==
[[Category:Level Design]]
[[VGUI2: Overview Display]]
[[Category:Tutorials]]
[[Category:Entry pages]]

Latest revision as of 17:43, 3 May 2025

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 f12 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

When importing the TGA into VTFEdit Reloaded VTFEdit Reloaded (or your VTF creator of choice), make sure to have texture format set to DXT1, with mipmap generation enabled and filter set to Box.

In the texture flags, enable Clamp S, Clamp T, and No Level of Detail. This will prevent the border pixels from stretching and looking horrible, and ensures that it won't be a blurry mess if the user

Icon-Important.pngImportant:Many vanilla level overviews also use the "no mipmaps" flag. This is unnecessary! Disabling LOD prevents the same issues that disabling mipmaps is used for here, without introducing aliasing when the overview is inevitably shown at a smaller size as part of the minimap.

Don't forget to save to whatever filename $basetexture pointed to in the previous section.

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			// (optional) map was rotated by 90 degrees in image editor
	zoom		1.3			// (optional) optimal zoom factor if map is shown in full size
}

See also