# Question about Uaxis and Vaxis

Discussion in 'Mapping Questions & Discussion' started by Fede22, Apr 1, 2012.

1. ### Fede22L1: Registered

Messages:
17
Positive Ratings:
4
I've been working on this project recently:

It's basically a program that writes a randomly-generated city to a .vmf file. I don't know if the software itself is useful, but the idea was to learn about the vmf file structure and to see if it was easy to create random maps without the user doing anything.

The only problem I have right now is that I still can't understand how the uaxis and vaxis settings in the side{ } sections of the vmf file work. If anyone here knows how they work, please reply here so that I can continue with the project (the idea would be to add more "types" of buildings, with different shapes).

If I manage to understand well every section of the vmf file format, I could work on something TF2 related. :thumbup:

2. ### aaYMLVL100 YM

Messages:
7,099
Positive Ratings:
5,920
Since I have JUST finished writing a simlar program I know all about them.

They define the x (u) and y (v) basis vectors of the texture in 3D space. If u is [1 0 0 0] it means the x axis of the texture will face the positive x direction of the real world. (The final digit is simply an offset).

So if you have a face with normal (0 1 0) (a face in the xz plane facing +y) you will want to set the u and v axis to two vectors that are orthogonal to your face AND to each other(I think they can be non-orthogonal to each other but for 99.9% of cases they must be) so you'll want something like [1 0 0 0] for u and [0 0 1 0] for v.

If you wish to rotate the face's texture, you must perform a rotation around the face normal. This keeps the u and v separated by the same amount and simply points them in different directions.

If you wish to scale a texture up in one axis only, apply a transform to both u and v that is simply a scale along that axis, the 0.25 defines the overall x/y scale but scaling the u and v axis can perform a shear to the texture, this is that 0.1% of times.

Here I have assumed you understand basic maths like the scalar and cross product as well as definitions of stuff like orthogonal, If you don't get anything I'll point you in the right direction.

3. ### Fede22L1: Registered

Messages:
17
Positive Ratings:
4
Thanks for the answer, I'll check what you wrote and try to see if I can apply myself :wow: