TeamSpen210 / HammerAddons

Useful tweaks and content for Source Engine Games
123 stars 36 forks source link

Auto-packing fails to consider textures in conditional VMT statements #282

Open piqey opened 1 month ago

piqey commented 1 month ago

I have a VMT that reads as follows:

"VertexLitGeneric"
{
//  $basetexture        "piqey/thebel/skybox/thebel_skybox/roof"    // This is loaded by another VMT in the project, that's why you'll see it still get packed in the compile log below
    $basetexture        "piqey/thebel/skybox/thebel_skybox/roof_lightmappable"
    $surfaceprop        "concrete"

    "ldr?$lightmap"     "piqey/thebel/skybox/thebel_skybox/roof_lightmap"
    "hdr?$lightmap"     "piqey/thebel/skybox/thebel_skybox/roof_lightmap_hdr"
}

However, as you can see from the following compile log excerpt, the $lightmaps specified by the ldr? and hdr? conditional statements were not packed by the postcompiler:

[...]
 | materials\piqey\thebel\skybox\thebel_skybox\pillars_normal.vtf
 | materials\piqey\thebel\skybox\thebel_skybox\roof.(vmt/vtf)
 | materials\piqey\thebel\skybox\thebel_skybox\roof_lightmappable.vtf
 | materials\piqey\thebel\skybox\thebel_skybox\roof_side.(vmt/vtf)
 | materials\skybox\piqey\blackbk.vmt
[...]

I could include in-game screenshots but I think that's somewhat unnecessary as it's just... not there. A missing texture. If you want it, here is the full compile log (I only ran vbsp.exe and postcompiler.exe to keep it concise).

Just a side note, I know the textures work fine. I've been using them for about a week now, and it was only today that I unmounted all my content to test the auto-packing and noticed postcompiler.exe wasn't doing its job on those particular textures.

TeamSpen210 commented 1 month ago

Yep, currently srctools' VMT parser (and therefore HammerAddons) doesn't handle flags specially, so it just thinks this is a property named ldr?$lightmap. When writing the parser I wasn't sure how to decode these, if you needed to know the list of flags up-front to detect, etc. I didn't think it was too important given how old Source is - it's not that likely anyone is going to have a DX8-only card or something today.

I probably should implement support though. As a workaround, you can place comp_pack entities to tell the autopacker directly about these textures.

piqey commented 1 month ago

Yep, currently srctools' VMT parser (and therefore HammerAddons) doesn't handle flags specially, so it just thinks this is a property named ldr?$lightmap. When writing the parser I wasn't sure how to decode these, if you needed to know the list of flags up-front to detect, etc. I didn't think it was too important given how old Source is - it's not that likely anyone is going to have a DX8-only card or something today.

I probably should implement support though. As a workaround, you can place comp_pack entities to tell the autopacker directly about these textures.

Yes, that's how I'm going to work around it for now. Have been doing something similar for custom sounds in soundscapes. Just thought I'd file an issue while I was at it.