Skip to content

Textures

BraXi edited this page Nov 2, 2023 · 1 revision

NOT FINISHED

All textures and images in pragma are in TGA format and can be RGB or RGBA, with optional RL compression. Their dimensions should be power-of-two and not exceed maximum size of 256x256px, higher resolution images will be rounded down.

Engine uses TGA files for everything which is totally opposite to Q2 which used PCX, WAL or TGA depending on their desired use.

Models and sprites should reference image files directly in images folder

Default directory tree:

\main\           <- default game dir
     \env\       <- location of sky textures
     \guipics\   <- images used by GUI
     \images\    <- images used by models
     \textures\  <- world textures like bricks, walls, etc..

Sky textures

Each sky is made of 6 images in env folder that represent all sides of a cube - "_rt" right, "_bk" back, "_lf" left, "_ft" front, "_up" up, "_dn" down

If you wanted to create a new sky named "dusk", it should be 6 files:

env\dusk_rt.tga
env\dusk_bk.tga
env\dusk_lf.tga
env\dusk_ft.tga
env\dusk_up.tga
env\dusk_dn.tga

Textures

This section assumes that you use ericw-tools for BSPing your map

Textures are used for all BSP geometry, pragma only needs .tga file to load map

During BSP process .tga file is used for lighting pass to calculate bounce colors, but during BSP process .wal_json file is used to determine surface flags, surface type like water, sky, lava, non solid, ladder and more. Without json file your water texture will be completly solid to entities and will behave like a standard wall. For shipping, you only need to distribute .tga file

Now, that we know the basics, you should always have two files for a texture:

textures\yourtexturename.tga        <- displayed in pragma and used in BSP light calculations
textures\yourtexturename.wal_json   <- used exclusively by BSP tools to describe texture params

During BSP building process, surfaces are reading flags and contents from a .wal_json files

Description of .wal_json format that is necessary for building BSPs

   JSON meta format, meant to supplant .wal's metadata for external texture use.
    All of the values are optional.
    {
        // valid instances of "contents"; either:
        // - a case-insensitive string containing the textual representation
        //   of the content type
        // - a number
        // - an array of the two above, which will be OR'd together
        "contents": [ "SOLID", 8 ],
        "contents": 24,
        "contents": "SOLID",

        // valid instances of "flags"; either:
        // - a case-insensitive string containing the textual representation
        //   of the surface flags
        // - a number
        // - an array of the two above, which will be OR'd together
        "flags": [ "SKY", 16 ],
        "flags": 24,
        "flags": "SKY",

        // "value" must be an integer
        "value": 1234,

        // "animation" must be the name of the next texture in
        // the chain.
        "animation": "e1u1/comp2",

        // width/height are allowed to be supplied in order to
        // have the editor treat the surface as if its dimensions
        // are these rather than the ones pulled in from the image
        // itself. they must be integers.
        "width": 64,
        "height": 64,

        // color to use for lighting bounces. if specified, this
        // is used instead of averaging the pixels of the image.
        "color": [255, 128, 64]
    }
surface flag description
light surface emits light, use 'value` for intensity
slick surface is slick like ice
sky surface is sky
warp surface is liquid
trans33 33% translucent
trans66 66% translucent
flow its flowing like water, also add CURRENT_ content to describe direction
nodraw don't draw
hint hint for BSP poral
skip reject in BSP proccess
solid (implicit)
window window
contents description
aux
lava touching will hurt
slime touching will hurt
water can swim in it
mist looks solid, but can be shot and walked through
playerclip players cannot walk through
monsterclip only solid for AI
current_0 flow direction
current_90 flow direction
current_180 flow direction
current_270 flow direction
current_up flow direction
current_down flow direction
origin can be used only on brushmodel, sued to set bmodel origin
monster DON'T USE
corpse DON'T USE
detail shoud be on decorative brushes
translucent surf is transparent
ladder player can climb it like it's ladder