Skybox (GoldSrc): Difference between revisions
Ktajxrhdktjg (talk | contribs) mNo edit summary |
m (Setting bug notice hidetested=1 param on page where the bug might not need tested in param specified) |
||
(18 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{gldsrc topicon}}{{back|Half-Life SDK/Textures}}{{cleanup}} | ||
[[ | [[File:Sky desert GoldSrc.png|thumb|256px|right|The default desert skybox]] | ||
Skyboxes in {{gldsrc|4}} are simple "cubemap" textures that display in the background behind the level. | Skyboxes in {{gldsrc|4}} are simple "cubemap" textures that display in the background behind the level. | ||
{{bug|Skyboxes are always filtered in OpenGL mode with {{code|GL_LINEAR}}, regardless of {{code|GL_TEXTUREMODE}} setting ([https://github.com/ValveSoftware/halflife/issues/2606 relevant issue on GitHub])}} | {{bug*|Skyboxes are always filtered in OpenGL mode with {{code|GL_LINEAR}}, regardless of {{code|GL_TEXTUREMODE}} setting ([https://github.com/ValveSoftware/halflife/issues/2606 relevant issue on GitHub])}} | ||
{{todo|Mention and explain using an [[MDL (GoldSrc)|MDL]] "skybox" for simulated 512x512 (or even 1024x1024!) skies outside of {{Sven}}.}} | |||
== Adding sky to a map == | == Adding sky to a map == | ||
Line 14: | Line 14: | ||
{{note|Ideally, your skybox should somewhat "wrap" around your map such that there is only a very small/zero amount of space between the play-space and the skybox itself, though it's usually not necessary to have the skybox "hugging" the bounds of the map to achieve reasonable compile times. Leaving some visible space between the playable space and the skybox can improve gameplay and world believableness.}} | {{note|Ideally, your skybox should somewhat "wrap" around your map such that there is only a very small/zero amount of space between the play-space and the skybox itself, though it's usually not necessary to have the skybox "hugging" the bounds of the map to achieve reasonable compile times. Leaving some visible space between the playable space and the skybox can improve gameplay and world believableness.}} | ||
{{warning|You should avoid making a skybox by drawing a big hollowed out cube with the {{code|sky}} texture around your map. This can drastically increase VIS compile times.}} | {{warning|You should avoid making a skybox by drawing a big hollowed out cube with the {{code|sky}} texture around your map. This can drastically increase VIS compile times.}} | ||
{{bug|[[VHLT]] expects the {{code|sky}} tool texture to be lowercase and will not compile skies correctly if the tool texture does not fit these criteria.}} | {{bug|hidetested=1|[[VHLT]] expects the first three characters of any {{code|sky}} tool texture to be all lowercase and will not compile skies correctly if the tool texture does not fit these criteria.}} | ||
{{modernImportant|The skybox is always drawn ''behind'' all other visible geometry! Don't put any geometry behind a {{mono|sky}} brush if it is part of the same [[PVS]]{{clarify}}.}} | |||
== Changing the displayed skybox == | == Changing the displayed skybox == | ||
[[ | [[File:Sky_change_JACK.png|thumb|right|350px|Changing a map's skybox in {{jack|4}}]] | ||
By default, no skybox is defined, so GoldSrc defaults to the {{code|desert}} skybox. You can change it by setting the skybox name in Hammer's Map Properties dialog. With the correct map opened, follow these steps: | By default, no skybox is defined, so GoldSrc defaults to the {{code|desert}} skybox. You can change it by setting the skybox name in Hammer's Map Properties dialog. With the correct map opened, follow these steps: | ||
Line 23: | Line 24: | ||
# Choose '''Map Properties...''' from the drop down list | # Choose '''Map Properties...''' from the drop down list | ||
# In the Object Properties window, select the '''enviroment map (cl_skyname)''' field. | # In the Object Properties window, select the '''enviroment map (cl_skyname)''' field. | ||
# Enter the name of the skybox you wish to display. | # Enter the name of the skybox you wish to display. If using a supported [[FGD]], {{jack|4.1}} will show a drop down list of skyboxes available to the current game configuration. | ||
{{note|If a skybox name includes an underscore before the suffix, include that as well.}} | |||
{{clr}} | {{clr}} | ||
== Creating a Custom 2D Skybox Texture == | == Creating a Custom 2D Skybox Texture == | ||
Skybox textures in GoldSrc MUST be 256x256 {{svencoop|in|addtext-front=''except''}}, and they follow the same naming convention as | Skybox textures in GoldSrc MUST be 256x256 {{svencoop|in|addtext-front=''except ''}}, and they follow the same naming convention as {{quake2|2}} and {{src|2}}, as so: | ||
<skyname>BK | <skyname>BK | ||
<skyname>DN | <skyname>DN | ||
Line 41: | Line 43: | ||
|- | |- | ||
! Format | ! Format | ||
| TGA || BMP | | [[TGA]] || [[BMP]] | ||
|- | |- | ||
! Resolution | ! Resolution | ||
Line 47: | Line 49: | ||
|- | |- | ||
! Color depth | ! Color depth | ||
| 24-bit (true color) || 8-bit (256 colors, no fewer) | | 24-bit (true color, no [[alpha]] channel) || 8-bit [[palette]]d (256 colors, no fewer) | ||
|- | |- | ||
! Compression | ! Compression | ||
| Uncompressed or RLE compression || Uncompressed | | Uncompressed or {{w|RLE}} compression || Uncompressed | ||
|- | |- | ||
! Additional settings | ! Additional settings | ||
Line 58: | Line 60: | ||
{{tip|{{svencoop|only}} Sven Co-op supports 512x512 and 1024x1024 skybox textures, in addition to 256x256.}} | {{tip|{{svencoop|only}} Sven Co-op supports 512x512 and 1024x1024 skybox textures, in addition to 256x256.}} | ||
{{warning|Avoid leaving an alpha channel in the skybox textures; this can result in the sky faces appearing upside-down!}} | {{warning|Avoid leaving an alpha channel in the skybox textures; this can result in the sky faces appearing upside-down!{{note|This will affect ports of skyboxes from the 2023 {{quake2|2}} remaster, which almost all would otherwise be compatible.}} }} | ||
<gallery mode=nolines widths=256px heights=160px> | <gallery mode=nolines widths=256px heights=160px> | ||
Gimp tga export.png|{{Gimp|4.1}} export settings for TGA skyboxes; RLE compression is optional | Gimp tga export.png|{{Gimp|4.1}} export settings for TGA skyboxes; RLE compression is optional, but recommend | ||
Gimp bmp export.png|{{Gimp|4.1}} export settings for BMP skyboxes (optional in Steam release) | Gimp bmp export.png|{{Gimp|4.1}} export settings for BMP skyboxes (optional in Steam release) | ||
</gallery> | </gallery> | ||
== Creating a skybox for GoldSrc, using [[Source]] == | == Creating a skybox for GoldSrc, using [[Source]] == | ||
It is possible to create an area of a {{src|4.1}} map into a Skybox to be used in {{ | It is possible to create an area of a {{src|4.1}} map into a Skybox to be used in {{gldsrc|4.1}}. Here's an simple example: | ||
# Create a large outdoor area with some displacement maps and treelines, and fog to hide the edges. Let's call it {{mono|'''carrotjuice'''}}. | # Create a large outdoor area with some displacement maps and treelines, and fog to hide the edges. Let's call it {{mono|'''carrotjuice'''}}. | ||
# Load the carrotjuice map ingame and turn cheats on ({{ | # Load the carrotjuice map ingame and turn cheats on ({{cmd|sv_cheats|1}}). | ||
# Activate noclip mode by simply opening the console and enter {{mono|'''noclip'''}} and hit Enter. | # Activate {{cmd|noclip}} mode by simply opening the console and enter {{mono|'''noclip'''}} and hit Enter. | ||
# Fly to the center of where you want the skybox. | # Fly to the center of where you want the skybox. Use {{cmd|setpos}} if a specific coordinate is desired. | ||
# Open up the console and type {{ | # Open up the console and type {{cmd|mat_envmaptgasize|256}}, hit {{key|Enter}}. | ||
# Now type {{ | # Now type {{cmd|envmap}} and press Enter. Now, 6 TGA files are now created and saved into a folder named {{mono|'''cubemap_screenshots'''}} in your Source game's mod folder ( i.e. for {{portal2|2}}: {{path|Steam\steamapps\common\Portal 2\portal2\cubemap_screenshots}}). | ||
Since the mapname was {{mono|'''carrotjuice'''}}, the name of the 6 TGA files are as following: | Since the mapname was {{mono|'''carrotjuice'''}}, the name of the 6 TGA files are as following: | ||
Line 82: | Line 84: | ||
You can now copy or move these to your mod's {{path|gfx\env}} folder, to use it as skybox in a level. | You can now copy or move these to your mod's {{path|gfx\env}} folder, to use it as skybox in a level. | ||
{{note|If the cubemap screenshots include the hud (such as in {{l4d2}}), {{cmd|bind}} {{cmd|envmap}} to a key instead of using it from the console.}} | |||
== See also == | == See also == | ||
Line 90: | Line 94: | ||
[[Category:GoldSrc]] | [[Category:GoldSrc]] | ||
[[Category:GoldSrc Textures]] | |||
[[Category:Skybox]] | [[Category:Skybox]] |
Latest revision as of 07:19, 20 May 2025

For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.
Skyboxes in GoldSrc are simple "cubemap" textures that display in the background behind the level.


Adding sky to a map
Simply texture a world brush (not a brush entity) with the sky texture.
In-game, the skybox will be seen through each surface that sky is applied to.
sky brushes do not need to be box-shaped.




Changing the displayed skybox


By default, no skybox is defined, so GoldSrc defaults to the desert skybox. You can change it by setting the skybox name in Hammer's Map Properties dialog. With the correct map opened, follow these steps:
- Go to the Map menu
- Choose Map Properties... from the drop down list
- In the Object Properties window, select the enviroment map (cl_skyname) field.
- Enter the name of the skybox you wish to display. If using a supported FGD,
J.A.C.K. will show a drop down list of skyboxes available to the current game configuration.

Creating a Custom 2D Skybox Texture
Skybox textures in GoldSrc MUST be 256x256 (except 'in ), and they follow the same naming convention as
Quake II and
Source, as so:
<skyname>BK <skyname>DN <skyname>FT <skyname>LF <skyname>RT <skyname>UP
Both TGA and BMP images are supported, but TGA is recommended for quality and compatibility reasons.
Software mode defaults to BMP skyboxes, and reads the TGA version if a BMP version is not present.
OpenGL mode defaults to TGA skyboxes. It will attempt to use the BMP version if a TGA version is not present, but not all modern GPUs support this.
Skybox textures must be encoded using the following settings
Format | TGA | BMP |
---|---|---|
Resolution | 256 x 256 | 256 x 256 |
Color depth | 24-bit (true color, no alpha channel) | 8-bit paletted (256 colors, no fewer) |
Compression | Uncompressed or ![]() |
Uncompressed |
Additional settings | Image origin: Bottom-Left | Compatibility: No color space information |
Skybox textures must be put in <moddir>\gfx\env\
, or a subfolder thereof.



GIMP export settings for TGA skyboxes; RLE compression is optional, but recommend
GIMP export settings for BMP skyboxes (optional in Steam release)
Creating a skybox for GoldSrc, using Source
It is possible to create an area of a Source map into a Skybox to be used in
GoldSrc. Here's an simple example:
- Create a large outdoor area with some displacement maps and treelines, and fog to hide the edges. Let's call it carrotjuice.
- Load the carrotjuice map ingame and turn cheats on (sv_cheats 1).
- Activate noclip mode by simply opening the console and enter noclip and hit Enter.
- Fly to the center of where you want the skybox. Use setpos if a specific coordinate is desired.
- Open up the console and type mat_envmaptgasize 256, hit ↵ Enter.
- Now type envmap and press Enter. Now, 6 TGA files are now created and saved into a folder named cubemap_screenshots in your Source game's mod folder ( i.e. for
Portal 2:
Steam\steamapps\common\Portal 2\portal2\cubemap_screenshots
).
Since the mapname was carrotjuice, the name of the 6 TGA files are as following:
carrotjuicert.tga
(Right)carrotjuiceft.tga
(Front)carrotjuicelf.tga
(Left)carrotjuicebk.tga
(Back)carrotjuiceup.tga
(Up)carrotjuicedn.tga
(Down)
You can now copy or move these to your mod's gfx\env
folder, to use it as skybox in a level.

