Texture replacements #124
Replies: 5 comments 4 replies
-
@sultim-t We will very appreciate if you will answer to many people on SYS_CRASH problem |
Beta Was this translation helpful? Give feedback.
-
How can i adapt the og crowbar from 1998? i just copied the v_crowbar.mdl from "\Half-Life\valve" to "Half-Life\rt\valve\models" and the crowbar looks fantastic but the reflexions update slow like at 1 fps or less so should i extract and modify the original textures or just add pbr propeties to them. |
Beta Was this translation helpful? Give feedback.
-
how do you get devmode?!??! |
Beta Was this translation helpful? Give feedback.
-
i think hes dead |
Beta Was this translation helpful? Give feedback.
-
rip @sultim-t |
Beta Was this translation helpful? Give feedback.
-
Overview
RayTracedGL1 accepts an unmodified texture from a game, and tries to replace it by searching for a corresponding file.
rt/mat/
folderrt/mat_dev/
folderrt/mat/
folderAbout devmode
Files in the
rt/
folder are checked, and, if one was modified, RayTracedGL1 tries to hot-reload itTo enable devmode:
Create a text file named
RayTracedGL1.json
in the Half-Life folderPut this text inside:
Launching
rt/xash3d.exe
should open an additional window namedRTGL1 Dev
To disable devmode:
RayTracedGL1.json
, or set"developerMode": false
Modifying textures in devmode
In Xash3D, there are multiple places in the code where a texture upload may happen. Usually, world textures have a name like:
#maps/sign50.mip
; animated models:#models\barney\BX_Chrome1.mdl
; etc.Textures
tab, clickExport original textures
rt/mat_src
will be populated by all currently uploaded textures in TGA format. It may take some timert/mat_dev
folder and copy the file into it. The file must preserve the file hierarchy it previously had inrt/mat_src
, e.g. the target file for "rt/mat_src/#maps/out_snd2.mip.tga" is "rt/mat_dev/#maps/out_snd2.mip.tga"Modified textures in non-devmode
When devmode is disabled, only KTX2 textures can be used, as they are parsed in a fast manner and can be copied directly to a video memory wihout preprocessing. But this also means that textures need to be converted from TGA / PNG / etc to KTX2 before launching a game.
A small script
rt/CreateKTX2.py
converts TGA and PNG files fromrt/mat_dev/
folder to KTX2 files inrt/mat/
folder. It also creates aCreateKTX2Cache.txt
file to track what files have changed to prevent re-exporting the same data.To use the script:
compressonatorcli.exe
must be added to PATH environment variablecompressonatorcli.exe
can be found and called from any directory (as the script just calls that .exe)After that, launching
CreateKTX2.py
should convert textures to KTX2, and we would be able to see the changed textures even with disabled devmode.PBR info
Textures can have additional images that define properties for physically-based rendering:
_orm
suffix)_e
suffix)_n
suffix)For example, we would like "#models/v_crowbar/crowbar.mdl" to be more metallic:
enable devmode (just for faster iterations and hot-reloading)
create a metallic-roughness texture
save to a file called "mat_dev/#models/v_crowbar/crowbar.mdl_orm.tga"
_orm
suffixif a file didn't exist when original texture was uploaded, force this texture to be uploaded by a game, which happens for most textures on connecting to a map:
disconnect
in the console and load the savenow PBR properties should be visible in the game
Same process can be applied to:
_e
suffix_n
suffixNote: same process for converting to KTX2 needs to be done
Note: to check which PBR textures are active, look
Textures
tab of the devmode window* A - albedo
* P - metallic / roughness
* N - normal map
* E - emissive
* each number is an internal texture ID
Texture properties
There is some limited amount of texture properties that can be applied to a texture by its path.
For example:
.tga
(andmat/src/
) were removed, so we have the original texture namePrimitives
/Textures
tabs of devmode window (use middle mouse click to copy name, or right click -> Copy texture name)add an entry to
array
inrt/data/textures.json
:{"textureName":"#models/glassgibs/chome_glass.mdl","isGlass":true}
save JSON
Warning: JSON parser has some bugs related to spaces inside arrays, specifically, there must not be any spaces around colons
:
Note: Check the devmode's
Log
tab for parsing errors, after saving JSON filesA list of texture properties:
Beta Was this translation helpful? Give feedback.
All reactions