Framed Art
An Introduction to TDM's Framed Painting System
By Geep, October, 2021
The Basics
To add a framed "oil" painting to your FM using DR, right-click and select "Create Model..." to bring up the "Choose Model" dialog. Then either search for “painting” or navigate to models/darkmod/decorative/wall/ and look for "painting…".
From the tree listing, select a particular size model (discussed in the next section), then expand the alphabetized list of available art image "skins". Selecting a skin allows you to inspect it in the dialog’s view pane as shown. If you just see wood boards, you’re looking at the backside; fly around to the front. (See the skins with the "_torn" suffix? Don't select them... they're implementation devices for the lootables discussed further below.)
Available Models
Under decorative/wall/painting… are the models listed in the table below, here from largest to smallest. Frames can accommodate portrait or landscape art by simple rotation on the wall. An exception are the two "desktop" models, which are tilted and have a stand, and have a specified orientation. The "round" frames are actually oval. (There are also "…_tearable" variant models, which you should generally ignore; again, they're mainly used to implement lootables.)
This convenient system of multiple sizes predates the ability of DR to easily rescale a model. You can now use the latter to create additional sizes if required.
Informal Size Name | Model Name | External Size, h x w | Art Size, h x w |
---|---|---|---|
Large | painting01_l | 104.2 x 96.8 | 94.9 x 65.4 |
Medium | painting01_m | 84.1 x 58.0 | 63.0 x 39.4 |
Original | painting01 | 56.1 x 38.7 | 42.0 x 26.1 |
Round, Original | painting_round | 56.0 x 40.0 | 46.0 x 30.0 |
Round, Small | painting_round_s | 36.0 x 28.0 | 28.0 x 20.0 |
Small | painting01_s | 32.0 x 23.0 | 24.0 x 15.0 |
Miniature | painting_minature | 16.0 x 12.0 | 12.0 x 8.0 |
Desktop, Portrait Mode | painting_desktop_vertical | 16.9 x 12.0 | 12.0 x 8.0 |
Desktop, Landscape Mode | painting_desktop_horizontal | 13.1 x 16.0 | 8.0 x 12.0 |
Sizes are the approximate dimensions in DR units when in portrait orientation (except painting_desktop_horizontal is landscape).
Regrettably, miniature is mis-spelled as "minature" in TDM's formal object names here.
For the desktop frames (whose models are under .../decorative/, not .../decorative/wall/), the dimensions given are with frame and canvas rotated into the vertical plane, i.e., untilted. Kickstand ignored.
In the round frames, art is visibly stretched, along the narrower frame direction.
Random Paintings
For quick decoration of a wall, entities are available that will randomly choose the art within the frame, but just for the 3 largest rectangular frames. See "Create Entity..." then Static/Decoration/Paintings/. Choose the entity for the orientation you want ("hor" or "ver") and frame size: large, medium, or (implied) original.
Lootable Paintings
These entities incorporate essentially the same models and skins as above. Use "Create Entity..." and choose one of the relevant classnames found under Loot/Static (see the table below). With the entity created and selected, open the Entity Viewer, add the spawnarg "skin" with some dummy value, then select that to get the "Choose Skin" viewer. (You will need to filter out the collision texture to see the art in the viewing pane.)
As with every type of loot entity, there is a default loot value that you can change.
When a miniature or desktop painting is looted, it disappears from the game, and a grouping of 3 "mini" paintings is shown as the inventory icon.
With a larger painting, the looted frame remains behind, and a rolled canvas appears in inventory. The looted frame shows wood boards with little bits of canvas where the art had been. If you'd rather have a see-through hole where the art had been, change the value in the "replace" spawnarg, e.g., from "atdm:empty_painting_medium" to "atdm:removed_painting_medium". (But "removed painting..." is only defined for the 3 largest size frames.)
Informal Size Name | Class Name |
---|---|
Large | atdm:loot_painting_large |
Medium | atdm:loot_painting_medium |
Original | atdm:loot_painting |
Round, Original | atdm:loot_painting_round |
Round, Small | atdm:loot_painting_round_small |
Small | atdm:loot_painting_small |
Miniature | atdm:loot_painting_minature_wall |
Desktop, Portrait Mode | atdm:loot_painting_minature_desktop_vertical |
Desktop, Landscape Mode | atdm:loot_painting_minature_desktop_horizontal |
(There are also "…_tearable" variant models of all sizes except miniature and desktop.)
Bonus Model
There’s an additional "ornate" frame, that (as of TDM 2.09) just offers one skin, but can use any TDM painting skin, provided you alter the skin’s definition to include that model. The model's gold frame is indeed ornate and created geometrically, superseding whatever framestyle would otherwise supplied by the skin itself. This model is optimized for portrait orientation, including mounting hardware on the back and a slight tilt. The back also has more intricate texturing and modeling.
Informal Size Name | Model Name | External Size, h x w | Art Size, h x w |
---|---|---|---|
Ornate | ornate_frame01 | 58.4* x 40.5 | 39.9* x 24.5 |
The sizes given for the vertical dimension are with the slight tilt. Without tilt, that dimension would be slightly greater.
Implementations
Models & Skins that Combine Art & Frame
TDM's painting models expect a skin with underlying square factor-of-2 textures (diffuse, normal, and specular). These textures each combine the art area with a 1D-tileable linear painting-frame sample. At right is a diffuse-texture example. The art here is portrait oriented. If it were landscape oriented, the frame sample would still be at the right edge, but the art would be rotated 90 degrees.
Nowadays, the diffuse texture would always 512 x 512, with the art taking up 512 h x 400 w, an aspect ratio of 1.28:1 or equivalently about 1:0.78 . The specular and normal (bump) maps, at lower resolution, deliver the surface topology of a particular frame, while treating the art as simply flat with a coarse canvas-like grain.
As a model, the frame itself is basically 4 perimeter flats with a depressed central rectangle. As already stated, the front side detailing of the frame (and more subtly the art) is provided by the bumpmap. The backside is simply a flat plane with wood planks and no hanging hardware. Of course, models for the round and desktop frames are more involved.
Lootable Paintings
When a loot painting is frobbed, it calls script "frob_loot()". This retains the calling entity's attributes, then calls "frob_item()", which does the standard lootable actions of
- deleting the calling entity from the game;
- adding to the loot count;
- displaying the specified inventory icon, in this case either guis/assets/hud/inventory_icons/painting_rolled_icon or .../loot_icon_mini_paintings.
If the calling entity was of miniature or desktop size (which display loot_icon_mini_paintings), we're done.
Otherwise, frob_loot() instantiates a new entity given by the "replace" spawnarg, in the same place and angles that the original caller had been. By default, this new entity is the appropriate size of "atdm:empty_painting...", which uses as its model the appropriate size of "..._tearable" and as its skin the original caller's skin name with "_torn" appended.
Skin, Material, & Definition Files
Skins for framed paintings are included in tdm_models_decls01.pk4/skins/...
tdm_decorative_wall.skin generally campaign.skin for dead1, dead2 materials (painting_dead*.dds files)
Materials associated with skins for framed paintings are included in
tdm_models_decls01.pk4/materials/tdm_model_decorative_wall.mtr
Definitions for loot painting entities, including after-frob empty-frame entities, are included in
tdm_defs01.pk4/def/tdm_loot.def
Underlying Image File Locations and Naming Conventions
Existing painting texture images may be found within tdm_models02.pk4 …
In dds form: /dds/models/darkmod/props/textures/
painting*.dds merrypainting*.dds
In other forms: /models/darkmod/props/textures/...
painting*_d_ed.jpg painting*_local.tga
Texture filenames in general follow this TDM naming convention, though early textures less so:
- Suffix _d means "Diffuse map"
- Suffix _s means "Specular map"
- Suffix _local means "Bump map" aka normal map
- Suffix _d_ed means "Diffuse for Editor Preview"
The standard painting filenames appear as named sets, reflecting not their artistic content, but instead their history of incorporation into TDM core assets. Just looking at the diffuse ones, and inferring names for the sets and for individual items giving skin names. It is likely that "M" & "L" sets were introduced at the same time as the Medium & Large size painting models, and at that time may have distinguished between 256 x 256 and 512 x 512 DDS files. But now (at least for the core asset DDS) all the DDS are 512 x 512. So really, skins from any of these sets can be used with any size "painting01…" frame model.
File Resolutions
As mentioned above, the diffuse .dds are 512 x 512 x 32 bits. They all contain
- The art in the leftmost 400 pixels (x positions 0-399)
- A vertical sample of the frame in the rightmost pixels.
In older FMs, you may encounter lower-resolution versions of the diffuse files. In a 256-wide image, the art takes up 200 pixels (0-199), the frame 57 pixels.
The .tga bumpmaps (aka normal maps) are 256 x 256. The specular .dds maps are 128 x 128 x 32-bit. Editor jpgs are generally 256x256, 24-bit, rarely 512x512, 24 bit. If not present, the editor uses the dds.