Question about Uaxis and Vaxis

Fede22

L1: Registered
Aug 24, 2009
17
4
I've been working on this project recently:

http://forums.steampowered.com/forums/showthread.php?t=2630761

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:
 

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
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.
 

Fede22

L1: Registered
Aug 24, 2009
17
4
Thanks for the answer, I'll check what you wrote and try to see if I can apply myself :wow: