# Resizing Models

**Note: This article is largely obsolete. Model scaling is available in Dark Radiant 2.2.1 and higher. See Model Scaling**

**Further details: http://forums.thedarkmod.com/topic/18586-darkradiant-220-pre-release-testing/page-2#entry400283**

*addition by stgatilov (Jan 2020)*

The **rotation hack** approach described in this article is not supported by the game engine. It is known to cause numerous problems, including:

**Culling**: When object is partially off-screen, it suddenly disappears.**Physics**: Collision and physical interaction with other objects is broken. For instance, a dead guard on a hacked carpet goes crazy.**Shadows**: Nearby surfaces suddenly become wrongly lit/unlit. Usually happens only at specific viewer locations.**Illumination**: Materials look differently. I.e. brighter/darker than they look on normal objects.

Therefore, better use DarkRadiant feature to scale models.

*written by Fidcal*

Resizing models is generally not recommended but I do it a lot. It works fine with many models but there are a few fixes needed.

- This method does not work with any AI or corpses.
- It does not work with moveables or movers. (I am unsure about movers - it might be OK if they are symmetrically resized, eg, all dimensions doubled.)
- It does not work with
*all*static models anyway. So you have to try it on a particular model then check it in-game to see if it looks and works correctly. It's a hack. This is how I do it:

Do not rotate the model first. If you have then first delete the rotation property. Otherwise the numbers might be too complex to deal with easily (try it and see!)

Give the model this property:

**rotation 1 0 0 0 1 0 0 0 1**

That mean unrotated scale normal. (a quick way to get the above from UNrotated is rotate 45 degrees then back again in top view. - edit - this might not work in later versions of Dark Radiant)

The 1's are the scale so double all sides would be 2 0 0 0 2 0 0 0 2
Or half width double height might be 0.5 0 0 0 0.5 0 0 0 2
Note that these are *world* oriented so if you need to rotate the model later you should anticipate that and change the side that *will* be turned that way after you rotate it! (experiement and undo and you'll see soon see what I mean. If you make a long table even longer then rotate it then now it is not longer but 'fatter'!)

Once you've done the above then you can rotate the model if necessary subject to what I said above.

The collision model is now 'wrong' (it's still the original size) so give the model the property solid 0. Now you and AI can walk through it so build a nodraw solid brush(es) inside roughly the shape (there are nodraw solid textures for different materials so pick the right one eg, nodraw_solid_wood so it sounds correct when impacted.)

The shadow will be 'wrong' (it's still the original size). Set the model noshadows 1 so it has no shadow. If you want a shadow then make the inner brush to be a real material like wood.

If there is a texture specular map (shinyness) then it won't scale so the texture might go unnaturally dark, almost black. Avoid those. But many models work fine.

*Addition by Flanders 9-11-2009*

If you are familiar with matrix calculation than this might be useful if you want to use the rotation spawnarg for arbitrary transformations.

The notation that is used with the rotation spawnarg is that of a 3x3 transformation matrix like this one on the left:

[ 1 0 0 ] [ x ] [ x ] [ 0 1 0 ] [ y ] = [ y ] [ 0 0 1 ] [ z ] [ z ]

The transformation matrix transforms the model coordinates into a new set of coordinates, so if you want to scale a model use it like this:

[ 1 0 0 ] [ x ] [ x ] [ 0 2 0 ] [ y ] = [ 2y ] [ 0 0 0.5 ] [ z ] [ 0.5z ]

For reflections use a negative scale value.

For rotations use one of these:

Around the x-axis:

[ 1 0 0 ] [ 0 cos(a) -sin(a) ] [ 0 sin(a) cos(a) ]

For a rotation of 90 degrees that gives:

[ 1 0 0 ] [ x ] [ x ] [ 0 0 -1 ] [ y ] = [ -z ] [ 0 1 0 ] [ z ] [ y ]

Around the y-axis:

[ cos(a) 0 sin(a) ] [ 0 1 0 ] [ -sin(a) 0 cos(a) ]

Around the z-axis:

[ cos(a) -sin(a) 0 ] [ sin(a) cos(a) 0 ] [ 0 0 1 ]

If you want to scale and rotate a model in an arbitrary way, scale and rotate the model separately, get the right matrix for scaling first, then delete the rotation spawnarg and get the right matrix for rotation. Multiply these two matrices to get the combination of the two transformations.

Example: I want to widen and flatten a model so I use this for scaling:

2 0 0 0 1 0 0 0 0.5

Now I want to rotate it 45 degrees around the z axis:

I delete the rotation spawnarg to get the model back in it’s original size, I use Modify > rotate and scale and rotate it 45 degrees around the z-axis:

0.707107 -0.707107 0 0.707107 0.707107 0 0 0 1

Multiply them like this:

[ 2 0 0 ] [ 0.707107 -0.707107 0 ] [ 1.414 -1.414 0 ] [ 0 1 0 ] x [ 0.707107 0.707107 0 ] = [ 0.707 0.707 0 ] [ 0 0 0.5 ] [ 0 0 1 ] [ 0 0 0.5 ]

And enter the result in as the rotation spawnarg:

1.414 -1.414 0.000 0.707 0.707 0.000 0.000 0.000 0.500

This gets me a wide and flat model rotated 45 degrees.