Jump to content
The Dark Mod Forums

Recommended Posts

Posted
Yes, that's why it's a hack. If you want both a rotation and a scale, you're going to have to multiply the matrices yourself (!).
The trick seems to be to first rescale manually and then rotate using the DR tools in the normal way.

[EDIT] As you were. The above is only true for 90 degree turns.

 

Hmmmmmm... could DR be made to calculate it? :) Then there'd be "official unofficial" support for scaling.

Posted

That's just what I was thinking earlier SD when I was wondering how to calculate it on a calculator. I'm considering doing a short wiki on rescaling with do's and don'ts once I've learnt a bit more about it. I've wasted hours on this when a few sentences on the wiki would have been enough. My wrought iron gates look great now and without this rescaling I would have to do something with brushes and patches. I consider this immensely important.

Posted

There are plenty of tools around that can multiply matrices. I use xmaxima (a free (GPLed) algebra solver), but you need to be comfortable with purely text-based input, and you have to learn the syntax and the quirks. There are probably other tools out there that are easier to use.

 

What do the DR devs think about supporting model scaling within DR? It sounds like a very useful tool. I'm thinking of a design like this:

 

- Instead of rotate operations affecting the D3 "rotation" spawnarg directly, they affect a "rotate_matrix" spawnarg (that name is purely an example).

- A "model scale" tool affects a "scale_matrix" spawnarg (again, the name is an example).

- When either of the above spawnargs are changed, DR automatically multiplies these matrices and sets the "rotate" spawnarg to the result.

My games | Public Service Announcement: TDM is not set in the Thief universe. The city in which it takes place is not the City from Thief. The player character is not called Garrett. Any person who contradicts these facts will be subjected to disapproving stares.
Posted

Yesterday I found a usefull application for the matrix scaling. :) I felt that the quilt and ink model was to small, and so I applied a factor of two to it, which makes it look right IMO. Since it is only decorative, it doesn't matter if it can not be collided with properly. :)

Gerhard

Posted
Yesterday I found a useful application for the matrix scaling. :) I felt that the quilt and ink model was to small, and so I applied a factor of two to it, which makes it look right IMO. Since it is only decorative, it doesn't matter if it can not be collided with properly. :)

Pray tell. Does it convert the model file or is it a calculator for use in DR?

Posted

Not sure what you mean by that. :) I simply changed the rotation key in DR.

 

It's pretty easy for simple values:

you set the key rotation to some value

1 0 0 0 1 0 0 0 1

 

1 0 0

0 1 0

0 0 1

 

 

The ones are the diagonal of the matrix and represent x, y, z, so if you want to scale an item, just set this values to a factor. If you want to have it double the size set it to 2, if you want it half the size, set it to 0.5. You get the idea. Of course you can scale only on one axis so if you want to scale only along the Z axis, leave the others at 1 and only change this one value.

The only drawback is that the collisionmodel is not scaled. So you can use this only on objects where the player doesn't collide with, or where it doesn't matter, like with the ink glass in my case.

You can use it on any object (at least models), even if they have collision models, it's just that the collision will not work as expected. It will still take place at the original size. I tried it with a wooden plank, and trippled it in length, but when I walked into the plank I could walk through 2/3 of it, before the collision stopped me. Visually you can still use it though. So for rafters, roofs, etc. you can still apply it.

 

Not sure about patches. If you want to use it with brushes, you probably have to convert them to func_static, apply the rotation, and then convert them back to brushes. Haven't tried though, so it might not work.

Gerhard

Posted

Firstly, you said you found a 'useful application'. I assumed you meant a program but now I see you meant literally just an application of the principle. You see, the other day I found an application (a program) that converts models from one format to another and can perform certain optional changes such as scaling. I tried it but it failed on the two tests I tried so I didn't pursue it. So that was the first thing that came to my mind when you said 'application'. :)

 

The other thing I was saying about a calculator is because with some (all?) models, eg, the wrought iron gate, if you rescale then rotate to an angle you need in the game then the scaling goes wrong in all but 180 degree turns. For example, I set the gate to triple thickness and double height with rotation 1 0 0 0 3 0 0 0 2 but when I then turn it to say 90 degrees it is something like three times too wide. It's probably transferring the depth value to the width I guess. The rotation value now shows 0 3 0 -1 0 0 0 0 2 which I don't understand. Alternatively, if I rotate it first to say 22 degrees and then try to rescale it I am faced with 0.927184 0.374607 0 -0.374607 0.927184 0 0 0 1 and I haven't a clue how to rescale it. I was hoping a set calculation could work it out.

 

Objects like the larger plank are easily fixed with an nodrawsolid brush of the collision size you want. Not so easy to make them smaller. Is there a way to remove the effective collision of any model in DR? I wanted to remove the collision from the wishing well and replace with some unrendered collision brushes. The reason is, many a fan mission has included access or escape via a well but this model will not permit the player to enter it even though it looks big enough - I didn't try from below though. The alternative is to build a well from brushes/patches but it's a shame to have a nice model like that which cannot be used for this purpose.

Posted

Given you have the existing model rotation matrix

a b c
d e f
g h i

and you want to scale it by x, y and z, you just multiply the matrices:

a b c	 x 0 0	 a·x b·y c·z 
d e f  ·  0 y 0  =  d·x e·y f·z
g h i	 0 0 z	 g·x h·y i·z

Basically, you scale the first column by x, the second by y and the third by z.

Posted

Not sure I've understood this. I create a gate, rotate it 45 degrees so its rotation values are

  0.707107 0.707107 0
-0.707107 0.707107 0
 0		0		1

 

I want to make it 8 times thicker which is the Y value so multiply each of the middle column to get...

  0.707107 5.656856 0
-0.707107 5.656856 0
 0		0		1

 

But don't seem to have done it right as the result is clearly wrong.

 

(sorry did the above off line in Courier New and it lined up correctly but somehow the code tags move it out of line)

Posted

I take the values frmo your above example:

0.927184 0.374607 0
-0.374607 0.927184
0 0 0 1

 

Now suppose you want to scale it 8x on the X axis, 4x on the Y axis and 2x on the Z axis:

(0.927184*8) (0.374607*4) (0*2)
(-0.374607*8) (0.927184*4) (0*2)
(0*8) (0*4) (1*2)

 

Yields:

7.417472 1.49868 0
-2.996856 3.708736 0
0 0 2

 

To add to the confusion, you can also mirror the axis, by changin the sign on the given axis. :)

 

One thing you have to take care of is, that you probably can not rotate the model anymore after this. You have to always use the original matrix, that you started with, for the actual rotiation, and then multiply the scaling factor back in. You can simply create a new key as a backup, and copy the original values there for this.

Gerhard

Posted

I don't see why a matrix-based scaling tool for models should not be possible, although Greebo would know more about the implementation details. It would be advisable to have some sort of caveat though to ensure that mappers realised the issues relating to collision models (maybe a popup dialog the first time the model-rotation tool was activated, or something).

Posted

I think such a tool is possible, although it might be quite some work. I'm not entirely convinced that this tool is for everyday use (return on investment) and additionally it seems to break the rotation manipulator.

Posted

I think for some things it's definitely usefull. Scaling small models into biggers or vice versa, or make more generic models into bigger/smaller version.

Gerhard

Posted

Yeah, in T2 I rarely put any object in the game without considering its size. A group of bottles of only 2 or 3 types can be made into a dozen - a couple of squat fat bottle, tall thin, etc. I reckon a forest can be made from only 10 tree models using tall and thin, thick and small, huge, tiny, coupled with rotation, slight leaning and careful lighting the player would have to be consciously looking for duplication to notice. Different sizes of plates, tables, statues, pillars, foliage, there is no end to the useage to multiply one model seemingly into several.

 

But don't be shocked if the calc goes wrong. I have not been able to get it right. My original calc produced the wrong result and I've just typed in Sparhawk's numbers and though the gate scale looks about right it is no longer rotated at the same angle as a normal size test gate rotated the same amount. Maybe I'll try again tomorrow.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • JackFarmer

      "The Year of the Rat." 
      😄

      Al Stewart must be proud of you!
      Happy testing!
      @MirceaKitsune
      · 1 reply
    • datiswous

      I posted about it before, but I think the default tdm logo video looks outdated. For a (i.m.o.) better looking version, you can download the pk4 attached to this post and plonk it in your tdm root folder. Every mission that starts with the tdm logo then starts with the better looking one. Try for example mission COS1 Pearls and Swine.
      tdm_logo_video.pk4
      · 2 replies
    • JackFarmer

      Kill the bots! (see the "Who is online" bar)
      · 3 replies
    • STiFU

      I finished DOOM - The Dark Ages the other day. It is a decent shooter, but not as great as its predecessors, especially because of the soundtrack.
      · 5 replies
    • JackFarmer

      What do you know about a 40 degree day?
      @demagogue
      · 4 replies
×
×
  • Create New...