This article's documentation is for anything that uses the Source engine. Click here for more information.

PPL: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{stub}}{{src topicon}}{{src13mp|only}} {{gmod|also}}  
{{stub}}{{src topicon}}{{src13mp|since}} {{gmod|also}}  
'''PPL''' files are lightmaps ('''p'''er-'''p'''ixel '''l'''ighting) generated by [[VRAD]] for {{ent|prop_static}} models that have {{code|[[$lightmap|generatelightmaps]]}} enabled. Unlike brush lightmaps, PPL files are always uncompressed RGB888 (24-bit {{w|Standard dynamic range|SDR}}), even when the map is compiled in [[HDR]] mode.  
'''PPL''' files are lightmaps ('''p'''er-'''p'''ixel '''l'''ighting) generated by [[VRAD]] for {{ent|prop_static}} models that have {{code|[[$lightmap|generatelightmaps]]}} enabled. Unlike brush lightmaps, PPL files are always uncompressed RGB888 (24-bit {{w|Standard dynamic range|SDR}}), even when the map is compiled in [[HDR]] mode.  


{{code fix|Being always RGB888 is a VRAD limitation, not a format or engine one; a custom compiler could make DXT1, I8, or even RGBA16161616F lightmaps, and these would be properly loaded by the game.
{{code fix|Being always RGB888 is a VRAD limitation, not a format or engine one; a custom compiler could make DXT1, I8, or even RGBA16161616F lightmaps, and these would be properly loaded by the game (but HDR lightmaps may require shader changes to work correctly).
To do so in the most basic manner, modify {{file|vradstaticprops|h}} to replace all mentions of IMAGE_FORMAT_RGB888 with the desired format. If used in conjunction with a modified VBSP, this could be replaced with if statements or switch cases that check for newly assigned [[static prop flags]].}}
To do so in the most basic manner, modify {{file|vradstaticprops|h}} to replace all mentions of IMAGE_FORMAT_RGB888 with the desired format. If used in conjunction with a modified VBSP, this could be replaced with if statements or switch cases that check for newly assigned [[static prop flags]].
 
This is fixed in {{gmod|2}}, which uses a separate {{code|_hdr.ppl}} for HDR lighting.}}


{{modernImportant|To account for potential discrepancies between [[UV map]]s of [[$lod|LoD]] models, PPL files contain a lightmap for each LoD model. This can greatly increase the file size of a map if a lightmapped model has several LoD models!}}
{{modernImportant|To account for potential discrepancies between [[UV map]]s of [[$lod|LoD]] models, PPL files contain a lightmap for each LoD model. This can greatly increase the file size of a map if a lightmapped model has several LoD models!}}


A PPL file can be converted to uncompressed [[VTF]](s) using <!--[https://cdn.discordapp.com/attachments/235121530609205249/797996930956656680/proptexelvtf.exe -->[https://files.gamebanana.com/bitpit/proptexelvtf.exe Ficool2's proptexelvtf.exe] (direct download), which can then be used for {{ent|$lightmap}}.
A PPL file can be converted to uncompressed [[VTF]](s) using [https://ficool2.github.io/HammerPlusPlus-Website/tools.html Ficool2's proptexelvtf.exe], which can then be used for {{ent|$lightmap}}.
== File format ==
 
The format is super simple, and is as follows:
 
<source lang="cpp">struct FileHeader_t
{
    int            version;
    unsigned int  checksum;
    unsigned int  imageFormat;
    int            meshCount;
    unsigned int  unused[4];
 
    // Immediately after, "meshCount" number of MeshHeader_t headers
};
 
struct MeshHeader_t
{
    unsigned int  lod;
    unsigned int  offset; // Offset from the top of the file to the raw image data in given image format (usually RGB888)
    unsigned int  length; // Length of the image data, including all mip maps
    unsigned int  width;
    unsigned int  height;
    unsigned int  unused[3];
};
</source>
 


== See also ==
== See also ==

Latest revision as of 07:34, 25 November 2025

Stub

This article or section is a stub. You can help by expanding it.

(in all games since Source 2013 Multiplayer) (also in Garry's Mod)

PPL files are lightmaps (per-pixel lighting) generated by VRAD for prop_static models that have generatelightmaps enabled. Unlike brush lightmaps, PPL files are always uncompressed RGB888 (24-bit Wikipedia icon SDR), even when the map is compiled in HDR mode.

Cpp.pngCode Fix:Being always RGB888 is a VRAD limitation, not a format or engine one; a custom compiler could make DXT1, I8, or even RGBA16161616F lightmaps, and these would be properly loaded by the game (but HDR lightmaps may require shader changes to work correctly).

To do so in the most basic manner, modify 🖿vradstaticprops.h to replace all mentions of IMAGE_FORMAT_RGB888 with the desired format. If used in conjunction with a modified VBSP, this could be replaced with if statements or switch cases that check for newly assigned static prop flags.

This is fixed in Garry's Mod Garry's Mod, which uses a separate _hdr.ppl for HDR lighting.
Icon-Important.pngImportant:To account for potential discrepancies between UV maps of LoD models, PPL files contain a lightmap for each LoD model. This can greatly increase the file size of a map if a lightmapped model has several LoD models!

A PPL file can be converted to uncompressed VTF(s) using Ficool2's proptexelvtf.exe, which can then be used for $lightmap.

File format

The format is super simple, and is as follows:

struct FileHeader_t
{
    int            version;
    unsigned int   checksum;
    unsigned int   imageFormat;
    int            meshCount;
    unsigned int   unused[4];

    // Immediately after, "meshCount" number of MeshHeader_t headers
};

struct MeshHeader_t
{
    unsigned int   lod;
    unsigned int   offset; // Offset from the top of the file to the raw image data in given image format (usually RGB888)
    unsigned int   length; // Length of the image data, including all mip maps
    unsigned int   width;
    unsigned int   height;
    unsigned int   unused[3];
};


See also

  • VHV, the equivalent for vertex-lit props