Engine icon indicating copy to clipboard operation
Engine copied to clipboard

VMT parameter to override brush/disp material UV size

Open SirYodaJedi opened this issue 1 year ago • 0 comments

Which component should be improved?

Rendering (Material System)

Describe your feature suggestion in more detail

In Source 1, brush and displacement UVs are determined based upon the resolution of the $basetexture, or (if present) %tooltexture. This works reasonably when dealing with power of 2 textures, but makes porting IdTech 2 and GoldSrc textures tedious, as they are often deliberately designed to be used at a fixed 1.0 or 0.5 scale, but are not necessarily powers of two. Valve solved this by having xwad write a .resizeinfo containing the original texture resolution for textures that it resizes, which is then read by Hammer when running Convert WAD to VMT.... This works well enough for conversion, fixing the UVs in the VMF, but is inconvenient when it's necessary to edit a brush, and especially when using the ported assets in a brand-new map made specifically for Source. $basetexturetransform sort of works here, but is difficult to use for this purpose.

It'd be better if a texture size could be defined directly in the VMT, which would result in both Hammer and the engine calculating the material's UVs based upon the size defined in the VMT, instead of $basetexture or %tooltexture. For example:

"LightmappedGeneric"
{
    $basetexture "metal/door48x96" // VTF is 64x128
    $uvsize "[ 48 96 ]" // but treat as 48x96
}

This would also be useful when dealing with dense HD textures, so that they would stay at the same scale as regular SD textures.

SirYodaJedi avatar Jun 03 '24 20:06 SirYodaJedi