Rescaling, Resizing, Models in Dark Radiant
Note: This article is largely obsolete. Model scaling is available in Dark Radiant 2.2.1 and higher.
written by Fidcal
Size matters! With some restrictions, most models (not AI) can be rescaled in three directions independantly in Dark Radiant. This provides for a large amount of extra variety and realism without needing extra models of different dimensions. Bowls, Plates, books, pictures, and plants do not exist in a limited size in the real world so why not vary them? How tall is a candle is like asking how long is a piece of string. Some furniture such as shelf units and tables can be stretched in one or all directions (watch that texture though), and an almost endless list of other objects can add interest to your game. A statue can be a statuette and vice versa. A building can become a doll's house; in fact most objects can be reduced to playthings for a nursery. The only limit is your imagination - so enlarge it!
Method of Rescaling Models
How is it done? There is a rescaling value included in the rotation property (not to be confused with the rotate or angle properties.) There is a problem if rotation itself is needed as well as rescaling so study the #Rotating Rescaled Models section before proceeding with it.
Put simply, the rotation property default values are 1 0 0 0 1 0 0 0 1 where the first, fifth, and ninth (the '1's in the default values) are the XYZ rescale values. As you can see in the default they are all a scale of 1. It is not simple once rotated so generally only rescale the unrotated model then rotate after if needed (see #Rotating Rescaled Models section.)
The XYZ are absolute map directions so changing Y for example will affect the North/South length (top and bottom of the grid in Dark Radiant) no matter which way the object is conceptually facing. Just change the value of the 1 to that needed where 2 is double the length and .5 is half. Examples:
1 0 0 0 1 0 0 0 2 = the object is double the height. Nothing else is changed.
2 0 0 0 2 0 0 0 2 = the object is double the size in all directions.
.2 0 0 0 .2 0 0 0 .2 = the object is only one fifth scale in all planes.
Rotating Rescaled Models
I don't pretend to understand the rotation values I only report some observations:
- Rescaling ALL lengths equally then rotating should be problem-free.
- Rotating 180 degrees should be problem-free no matter what lengths are rescaled or how.
- Rescaling a length not in the plane of rotation should be problem-free, so a table of lowered height that is turned sideways against another wall should be fine. Tip it over though and there is likely to be distortion of the shape.
- Rescaling and rotating (other than 180 degrees) in the same plane is likely to produce shape distortion. It might be slight if the rotation and/or the rescaling are small but it will be there.
- It should be possible to calculate any scale with any rotation but it is just not obvious so anyone who can provide a means then please post it here!
The collision model is not created for the rescaled model so this method is not suitable for moveable items. In addition, objects, AI, and the player would pass right through a static rescaled model. Not only is this (usually) unrealistic but it can sometimes be fatal to the player character. If you really need some kind of phantom object then also add the property noclipmodel 1 and this seems to cure the sudden death problem.
But in most cases where you do need solidity, put your own unrendered brush(es) inside the model's volume using the texture : common > nodrawsolid to make the model seem solid. Consider not bothering for some items such as inaccessible objects out of reach of all activity.
Do not be too easily tempted to think that small items like a book on a table do not need any 'solidity'. True, if the player climbs on the table then the book's lack of solidity might not be noticed but try placing another object such as a candlestick holder on top of the book and it will sink through it to the table top.
When a model is rescaled then its texture is rescaled with it so take care to examine the texture is not ridiculously stretched. An outline of a large, inacessible, gargoyle, hidden in shadows, is not so critical as a table of three times its normal length! Probably reducing the size of models is generally 'safer' but be aware in all rescaling of the problem and examine the results!
You may get a problem with a wrong shadow - more likely if the model is reduced. In particular test moving around near the rescaled model using the player light. I saw rectangles of shadow surrounding objects with the player light even when the room light shadow looked reasonable.
If there is a problem then add the property noshadows to the object with a value of 1 and then you will get no shadow at all. If that looks odd consider a concealed brush behind the object to cast a shadow.
RPGista proposed the following: you can give a model the "inline" "1" spawnarg and recompile the map, it will appearently turn a model into world brush triangles. It can have certain side effects (changing the smoothing groups, for example), but might be worth a shot.