sultim-t / vkquake-rt

GNU General Public License v2.0
345 stars 14 forks source link

Request: Document process for creating replacement textures or shaders #14

Closed hemebond closed 1 year ago

hemebond commented 1 year ago

I've yet to see a clear example in screenshots or videos, but I'm assuming it is possible to provide replacement textures with PBR information.

If so, could this process (how they should be provided to the game) please be documented somewhere?

WabbitToonz commented 1 year ago

for textures i was able to add 2 different ways . 1 would be by adding .tga files in quake-rt\id1\textures . And the 2nd way would be to add to make a ktx2 file and place it in quake-rt\ovrd\mat\maps

sultim-t commented 1 year ago

Creating custom textures

ovrd/mat folder contains new textures to use with the new lighting system. Each texture is compressed and wrapped into .ktx2 format.

Assume that AFLOOR texture needs to be modified.

  1. Setup environment:

    • Install CompressonatorCLI
      • and append a path to its executable to $PATH environment variable (so compressonatorcli.exe can be called from anywhere)
    • Install Python3
    • Find CreateKTX2.py script in the ovrd folder
      • this tool is a part of RTGL1
  2. Create files:

    • create folder ovrd/matdev
    • ovrd/matdev/maps/AFLOOR.png -- albedo map
      • alpha channel (transparency) is used, if Doom uses transparency for that texture
    • ovrd/matdev/maps/AFLOOR_rme.png:
      • roughness in R channel
      • metallicity in G channel
      • emission in B channel, color is controlled by albedo map at the same pixel
    • ovrd/matdev/maps/AFLOOR_n.png -- normal map, G channel is ignored (it's assumed to be always 255)
  3. Run CreateKTX2.py script with Python3

    • it will pack textures from ovrd/matdev to ovrd/mat
  4. Changes should be visible, when the game reloads textures (usually, on game re-enter)

-- ovrd/texture_custom_info.txt contains some meta-info for the textures, e.g. if a texture should have a light source to be attached

Hot-reloading

There's a very limited and unstable hot-reloading:

  1. Create empty RayTracedGL1.txt in the same folder as vkQuake.exe. Write developer inside.
  2. Now it will check files inside matdev folder, if a file has changed it date/time, then it will reload it directly from .png (ignoring .ktx2; but while publishing, everything must be in .ktx2 and without developer mode)

Limitations: