PBR material format - w23/xash3d-fwgs GitHub Wiki
Materials repository https://rtxash.omgwtf.ru/Half-Life-RTX/Half-Life-PBR
In the directory of the mod (valve
etc.) put the folder pbr
, here is its structure:
/pbr/
/materials.mat
— global file for base materials./wadname.wad/wadname.mat
— materials to replace the textures of a specific wad file (if it is specified in the map)./maps/mapname.bsp/mapname.bsp.mat
— materials used only on the specific map./models/materials.mat
— a common material file for all models (contains the includes)./models/modelname/modelname.mdl.mat
— file for a specific model (injected through/models/materials.mat
)./sprites/sprites.mat
— a common material file for all sprites (contains the includes)./sprites/spritename.spr/spritename.spr.mat
— file for a particular sprite (injected through/sprites/sprites.mat
).
As already understood, each .mat file can include other material files through a directive:
"include" "path/filename.mat"
Up to 4 levels of nesting are supported.
The materials.mat itself consists of repeating blocks of the form:
{
"for" "c2a3_gar3"
"basecolor_map" "c2a3_gar3.png"
"normal_map" "c2a3_gar3_normal.png"
"metal_map" "/colors/black.png"
"roughness_map" "c2a3_gar3_roughness.png"
}
Where {}
is the block boundary and the content itself is in the simple format "key" "value"
.
The value of the key "for"
describes the name of the texture to be replaced. To replace the texture of the map just specify its name from the wad file (or prescribed inside the map, which can be viewed through the command ui_infotool 1
or through the program bspguy) and that's all. To replace the texture model or sprite need to run the game with the keys -dev 2 -log
and in engine.log
find records related to the desired textures, there will be a full path of this type:
[2021:11:25|23:25:01] Uploading texture #models/v_357/bluesteelchrome.mdl, mips=7
[2021:11:25|23:25:01] Uploading texture #sprites/laserdot(frame:00).spr, mips=5
This is the path "#models/v_357/bluesteelchrome.mdl"
and "#sprites/laserdot(frame:00).spr"
must be entered after "for"
.
Then you can specify the textures manually by analogy. The names of the textures of the models can be obtained through the viewer HLMV, and sprites are in the folder /sprites/
(you can look through SprView). For sprites you just need to remember that if the sprite without animation he still need to prescribe (frame:00)
in the path for the value "for"
.
Next come the maps (textures) themselves to replace the original texture. The texture size step is 16 pixels. All textures at this point must be 8bit RGB(A) PNG. 16bits/sample are not suitable yet, nor is grayscale likely. That is, export textures from (for example) Substance B2M will need to be squeezed to 8 bits per channel.
"basecolor_map"
base color, albedo, similar to a diffuse texture only without extra highlights and shadows (they are done through the normal map), that is, it is devoid of visual volume, as if we have a completely flat surface in front of us.
"normal_map"
a normal map, which is just describing the light shape of the object, the normal has an opengl format, that is, the light areas on top.
"metal_map"
a metallic map, black (it's monochrome), describes where the metal (white) or dielectric (black) should be contained.
"roughness_map"
roughness map, grayscale, indicates where in which part of the texture there should be reflections, the darker the more glossy the surface will be, the lighter the matte.
Also available:
"base_color" "R G B"
to set the color without texture (useful for debugging/simple metals/correcting an existing texture), where R G B is red green blue, currently the data is in floating point format, 0 to 1, but this may change to 0-255.
"metalness" "V"
to specify metal or dielectric surface, where V is a value of 1 (metal) or 0 (dielectric).
"roughness" "V"
to specify roughness, where V is a floating point value from 0 (completely smooth) to 1 (completely rough).
Only the "basecolor_map"
is available for sprites, the other textures will be ignored.
Map of normals at the moment does not apply to models, this is a known problem.
A detailed description of the properties of PBR material maps can be read here.
After the key any map the path to it is specified in the value.
A path starting with /
leads to the root /pbr/
.
A path starting without /
leads to the subdirectory in which the involved materials.mat
is located.
Relative paths are possible (e.g. you can refer to textures in subdirectories).
Other keys:
"force_reload" "1"
which is written in a block of desired texture (immediately the next line after the "for" "texture" otherwise it will not work) for her quick reload via the console commandvk_rtx_reload_materials
(you can key in, for examplebind m vk_rtx_reload_materials
)."new" "texturename"
(repeat name for "for") to create a new texture that is not on the map, to patch one texture to another, declared inside/maps/mapname.bsp/mapname.bsp.mat
and then in/luchiki/maps/mapname.bsp.patch
set_xvk_texture
with this name.