Ads keep us online. Without them, we wouldn't exist. We don't have paywalls or sell mods - we never will. But every month we have large bills and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3

Fake Skyboxes Using Cubemaps - A Tutorial for Source Engine.

Fake Skyboxes for the Source Engine

Creating a fake skybox allows you to have multiple skyboxes, it also allows you to hide geometry behind the material, as it will not render anything behind it as though it were a solid brush! The benefits of this method is mainly that you can make fake skies up to 4096x4096 without the use of any resolution scaling software.

   !!!! If you're unsure if you need LDR or HDR, you only need to make the HDR version as it will work for both LDR and HDR - but beware the file size will be huge and it will be preferable to use LDR if you can. !!!!

If do you need HDR ensure you have either Photoshop or ImageConverter
Note: While ImageConverter does work, the colours will suffer. Photoshop will look better.
UPDATE: Apparently you can also use GIMP to convert to PFM, use at your own discretion as it's not covered in this tutorial.

!!! FOR CSGO ONLY !!!

It's come to my attention that CSGO has an extra step when trying to complete this tutorial. VTEX.exe complains and will want you to use "-oldcubepath." To accomplish this, right click VTEX.exe (located in Counter-Strike Global Offensive/bin) and click "Create Shortcut" then edit the properties of the shortcut and in the "Target" box add -oldcubepath to the end of it. Throughout this tutorial you'll instead use the newly created shortcut instead of VTEX.exe.

NOTE: Also for CSGO only, this will generate a "pwl" AND "vtf" file; you must include both in your map.

1.

To start off, we need to have a folder setup that is in your game directory (eg, tf2/materialsrc, cstrike/materialsrc, csgo/materialsrc) that mirrors the one you'll want it output to. For instance, if you want your output folder to be "cstrike/materials/fakeskies/" then your folder setup should be "cstrike/materialsrc/fakeskies/"

2.

Then, we need to convert our VTFs into image editor readable files. Find your skybox of choice in your files, it should have 6 total VTFs, one for each face, as such:

bk.vtf
dn.vtf
ft.vtf
lf.vtf
rt.vtf
up.vtf


We need to convert these into TGA files, you can do this through VTFEdit by individually opening all 6 VTFs and exporting them (File > Export). The result should be 6 TGA files, one for each of the skybox's faces, and move them to your working folder we created in materialsrc.

Your materialsrc folder should look something similar, with 6 newly generated TGAs.

!!! LDR Steps - If you do not need LDR, skip these two steps. !!!



1. (LDR STEP)

Create a .txt file with the same name as your skybox and within it, add the following lines:


nonice 1
nocompress 1


2. (LDR STEP)

Drag the TXT file onto VTEX.exe located in your /bin (eg, Counter-Strike Source/bin, Team Fortress 2/bin, Counter-Strike Global Offensive/bin).


Once compiled, VTEX will put the resulting VTF in your "cstrike/materials/" - and not the current "materialsrc" path.

!!! HDR Steps - If you do not need HDR, skip these three steps. !!!



1. (HDR STEP)

Before we begin, the Source engine wants us to use .pfm files for HDR so to convert them from TGA you can use Photoshop or ImageConverter.
(Side note: Source likely has a built-in way to do this with "pfm2tgas.exe" but there's a lack of documentation on it)

Photoshop:

Open up the 6 TGA files, then navigate to Image > Mode > 32 Bits/Channel to convert the image, in addition, we need to flip all 6 vertically so go Image > Image Rotation > Flip Vertically, then File > Save As > Select "Portable Bit Map" and rename the file extension to .pfm - do this for all 6 TGAs

ImageConverter:

Drag and drop all 6 TGA files into ImageConverter, change the following settings in the "Save" and in the "Actions" section:

Rotate and Mirror > Flip Horizontally

Name: %name%
Format: *.pfm - Portable Float Map

When the settings are correct, hit "Convert and Save."

2. (HDR STEP)

Create a .txt file with the same name as your skybox and add the following lines:


pfm 1
pfmscale 1
nonice 1
nocompress 1

Note: if you've made an LDR version from the steps above, just add the two new lines pertaining to the PFMs.

3. (HDR STEP)

Drag the TXT file onto VTEX.exe located in your /bin (eg, Counter-Strike Source/bin, Team Fortress 2/bin, Counter-Strike Global Offensive/bin).

Once compiled, VTEX will put the resulting VTF in your "cstrike/materials/" - and not the current "materialsrc" path.


3.

Finally now the HDR and/or LDR VTFs have been generated, you can create a matching VMT file:



"WindowImposter"
{
"$envmap" "(pathtosky)/(skyboxname)"
"$nofog" "1"
}


Note: If you ONLY made HDR, remove the .hdr naming part of the VTF. If you have both, the game will find the .hdr version on its own!

!!! This material will not seal your map, so be careful what brush(es) you put it on !!!



Thanks to Juxtapo, NvC_DmN_CH, Shadow Sheep, and xen for their help on this tutorial.

If there are any errors in the tutorial, or you're having trouble you may contact me on Discord - Syncronyze#5202