Sky (Source 1 shader): Difference between revisions
(Change SDR -> LDR, the engine refers to it as only LDR so it should be treated in such context) |
SirYodaJedi (talk | contribs) (Clean up most misinformation, except $basetexturetransform) |
||
Line 1: | Line 1: | ||
'''Sky''' is a shader for materials in [[Source]] meant for [[Skybox_(2D)|2D skyboxes]]. The old method of making skyboxes before [[Source 2007]] involved using the [[UnlitGeneric]] shader with <code>[[$ignorez|$ignorez 1]]</code>. This shader expands the amount of usable parameters and also allows for [[HDR]] skyboxes. | '''Sky''' is a shader for materials in [[Source]] meant for [[Skybox_(2D)|2D skyboxes]]. The old method of making skyboxes before [[Source 2007]] involved using the [[UnlitGeneric]] shader with <code>[[$ignorez|$ignorez 1]]</code>. This shader expands the amount of usable parameters and also allows for [[HDR]] skyboxes. | ||
{{tip|{{l4d2|since}} [[$basetexture]] is not necessary for games that are HDR-only, as only the [[$hdrbasetexture]] or [[$hdrcompressedtexture]] will be used.}} | |||
=== With an uncompressed HDR skybox texture === | |||
If the skybox texture uses [[Valve Texture Format#Image_data_formats|uncompressed BGRA16f16f16f16f]], then the [[VMT]] should look something like this: | |||
= | <source lang=vmt> | ||
sky | |||
{ | |||
$basetexture skybox/sky_wasteland_00up // Sky texture to use for LDR | |||
$hdrbasetexture skybox/sky_wasteland_00_hdrup // Uncompressed HDR Sky texture to use for HDR-enabled maps | |||
$nofog 1 | |||
$ignorez 1 | |||
$nomip 1 | |||
} | |||
</source> | |||
=== With a compressed HDR skybox texture === | |||
If the skybox has been [[Valve Texture Format#HDR compression|compressed using BGRA8888]], then [[$hdrcompressedtexture]] should be used instead: | |||
<source lang=vmt> | <source lang=vmt> | ||
Line 10: | Line 22: | ||
{ | { | ||
$basetexture skybox/sky_wasteland_00up // Sky texture to use for LDR | $basetexture skybox/sky_wasteland_00up // Sky texture to use for LDR | ||
$hdrcompressedtexture skybox/sky_wasteland_00_hdrup // HDR | $hdrcompressedtexture skybox/sky_wasteland_00_hdrup // Compressed HDR Sky texture to use for HDR-enabled maps | ||
$nofog 1 | $nofog 1 | ||
$ignorez 1 | $ignorez 1 | ||
Line 17: | Line 29: | ||
</source> | </source> | ||
=== Without an HDR | === Without an HDR skybox texture === | ||
If an HDR version of the skybox texture is not available, [[$hdrbasetexture]] can use the same VTF as [[$basetexture]]: | |||
<source lang=vmt> | <source lang=vmt> | ||
Line 33: | Line 44: | ||
=== Issues === | === Issues === | ||
{{cleanup|See [[HDR Skybox Creation]] for better explanation of when $basetexturetransform may be necessary.}} | |||
You might find that skyboxes sometimes fit the entire projection area of a level. To re-scale the material to fit, use [[$basetexturetransform]] or add the following line: | You might find that skyboxes sometimes fit the entire projection area of a level. To re-scale the material to fit, use [[$basetexturetransform]] or add the following line: | ||
<source lang=vmt> | <source lang=vmt> |
Revision as of 10:17, 25 May 2023
Sky is a shader for materials in Source meant for 2D skyboxes. The old method of making skyboxes before Source 2007 involved using the UnlitGeneric shader with $ignorez 1
. This shader expands the amount of usable parameters and also allows for HDR skyboxes.


With an uncompressed HDR skybox texture
If the skybox texture uses uncompressed BGRA16f16f16f16f, then the VMT should look something like this:
sky
{
$basetexture skybox/sky_wasteland_00up // Sky texture to use for LDR
$hdrbasetexture skybox/sky_wasteland_00_hdrup // Uncompressed HDR Sky texture to use for HDR-enabled maps
$nofog 1
$ignorez 1
$nomip 1
}
With a compressed HDR skybox texture
If the skybox has been compressed using BGRA8888, then $hdrcompressedtexture should be used instead:
sky
{
$basetexture skybox/sky_wasteland_00up // Sky texture to use for LDR
$hdrcompressedtexture skybox/sky_wasteland_00_hdrup // Compressed HDR Sky texture to use for HDR-enabled maps
$nofog 1
$ignorez 1
$nomip 1
}
Without an HDR skybox texture
If an HDR version of the skybox texture is not available, $hdrbasetexture can use the same VTF as $basetexture:
sky
{
$basetexture skybox/sky_wasteland_00up // Sky texture to use for LDR
$hdrbasetexture skybox/sky_wasteland_00up // Sky texture to use for HDR, if the texture has NOT been specifically compiled for HDR
$nofog 1
$ignorez 1
$nomip 1
}
Issues

You might find that skyboxes sometimes fit the entire projection area of a level. To re-scale the material to fit, use $basetexturetransform or add the following line:
$basetexturetransform "center 0 0 scale 1 2 rotate 0 translate 0 0" // For cutting off the bottom halves of the skybox
The scale 1 2
segment will maintain the fill-sizing of the X-axis, while locking the texture to the center line of the Y-axis (i.e. the absolute horizon line).