Tutorial: Skewing textures in Hammer Last edited 11 years ago2013-10-08 19:58:00 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.

This article was converted from a previous version of TWHL and may need to be reviewed

  1. The formatting may be incorrect due to differences in the WikiCode processing engine, it needs to be revised and reformatted
  2. Some information may be out of date
  3. After the article is re-formatted and updated, remove this notice and the Review Required category.
  4. Some older tutorials are no longer useful, or they duplicate information from other tutorials and entity guides. In this case, delete the page after merging any relevant information into other pages. Contact an admin to delete a page.
If you’ve ever been in a situation like for example having to skew a wall in a particular direction so that it follows an elevation in the floor, you’d probably have to rotate the wall texture and end up with something like this:
User posted image
This can be okay for some occasions, but doesn't really look that good. What do you do if you want the wall texture to run parallel (either vertically or horizontally) with the wall textures next to the skewed brush? You might think it's impossible, which it practically has been, but I’ve discovered a rather simple trick to achieve this using a couple of tools found in Hammer that I suspect are mostly overlooked: Align To View and the Camera tool.

What you need to do is select the Camera tool (Shift+C) and in the 2D Top viewport (in this particular example, if the brush is oriented differently, e.g. with the face you want to manipulate facing upwards, you might have to use another viewport) and place the camera itself along one edge of the brush and as many units away as the brush is long (which in this case is 256 units) and have the camera point 45 degrees towards the opposite edge (check the Top view in the screenshot if you don’t understand what I mean). It is a good idea to downsize the grid to 1 and zoom in and check that the camera is aligned correctly, as it snaps to grid 1. Then, in the 2D Side viewport (again, in this particular example), you will have to place the part of the camera tool that “points” (the red line) at the middle point of one edge of the brush, and the camera itself between the middle point and the lower point of the opposite edge (i.e. a quarter of the total length). The easiest way to find these points is to enter vertex manipulation (Shift+V) with the brush selected, then while in vertex manipulation you select the Camera tool again. Confirm that the camera is placed exactly correct by downsizing the grid to size 1 and zooming in.
User posted image
The next step is to go into the 3D viewport (careful not to move the camera around), enter Texture Manipulation (Shift+A), select “Align To View” from the lowermost drop-down list, and then click on the face you wish to skew. You should get something like this, with the texture being upside down:
User posted image
This is easily fixed by flipping the texture 180 degrees and hitting “Fit”.
User posted image
You can also (if you look very carefully) notice that the skewed texture is actually flipped the wrong way horizontally - this can be a problem in certain cases, like if you use a texture similar to the one I’ve used in the following screenshot:
User posted image
This can actually look quite cool, but if the effect is undesirable and you want to avoid having to flip all the adjacent walls horizontally so that they match the texture of the skewed wall, you will have to, before going through the technique I’ve now described, flip the skewed wall horizontally, then just do everything from the opposite direction:
User posted image
Then you should end up with a correct perspective (obviously you need to flip it back once you're done).
User posted image
And that’s it! Now, don’t ask me why you have to have the camera tool pointing in a steeper angle than the brush is skewed to get a correct angle on the texture, as common sense might suggest that the camera should point at the same exact angle, but this technique does require a bit of trial and error; it’s not always obvious where or at what angle you will have to place the camera and the red line “pointer” (if you have a steeper angle on the skewed brush, for instance, you will also have to have a much steeper angle on the camera than in the example in this tutorial), but with persistence you can achieve greatness the likes of which has been previously unknown to mankind (or something along those lines), like the handrails on this spiral staircase I created:
User posted image
Thanks for reading, hopefully someone will find this useful.

21 Comments

Commented 11 years ago2013-10-10 01:32:27 UTC Comment #100952
Got only three words : This is awesome
Commented 11 years ago2013-10-12 01:05:37 UTC Comment #100953
:o
Commented 11 years ago2013-10-15 16:03:57 UTC Comment #100954
Very useful
Commented 11 years ago2013-10-22 19:00:49 UTC Comment #100955
HOW could I have forgotten about this technique?!! (T_T)
Thanks for the tutorial!

Also, I prefer to ALWAYS align textures to face, because when players draw decals on walls, they otherwise will be distorted.
Commented 11 years ago2013-10-25 09:36:15 UTC Comment #100956
wow. wow. wow. wow.
bravo
Commented 11 years ago2013-11-29 08:36:19 UTC Comment #100957
AWESOME! Thank you! I did not know about the "align to view" option! Now I can skew whatever texture w/o having to make a new texture and use a series of wall panels or use rotated textures and wall brushes with slanted ends (to get the textures to line up).

Awesome looking spiral staircase, too.
Commented 10 years ago2014-02-08 03:44:07 UTC Comment #100958
Nice skills!
Commented 10 years ago2014-02-09 19:53:25 UTC Comment #100959
awesome
Commented 10 years ago2014-02-09 19:54:38 UTC Comment #100960
5 stars
Commented 10 years ago2014-02-22 07:39:24 UTC Comment #100961
I think this is fantastic. Whether you came up with this yourself or is aggregate information from different sources, it's amazing that this can be done. I used to think the "align to view" option was completely useless.

** only because I don't quite understand the instructions for camera placement.
Commented 10 years ago2014-05-05 04:06:23 UTC Comment #100962
I remember about an year ago, i wasted about ~2 good weeks trying to do something similar without success. I've read somewhere that it's possible to achieve this by editing the texture straight from the source file (.rmf/.map).

Thanks for the tutorial, it'll be of much help.
Commented 10 years ago2014-06-16 01:49:28 UTC Comment #100963
News for me. Thank you for great tutorial.
Commented 10 years ago2014-06-21 03:24:47 UTC Comment #100964
This tutorial is garbage. I am an extremely experienced mapper (7+ years experience) and have never used the Align to View tool. This is the most frustrating, non-userfriendly tutorial I have ever had the misfortune to try to decipher. I have spent at least three hours over the past few months trying to comprehend what you are trying to say in this tutorial, and failed. Not only does the align to view function completely destroy the scale of the textures, but it DOES NOT WORK! Please make a video tutorial instead. No one is going to understand this.
Commented 10 years ago2014-06-21 03:42:25 UTC Comment #100965
Here's a picture of my attempt, that appears to look exactly the same as in your screenshots (from what I can see from those tiny compressed jpegs), that completey and utterly fails:

http://nightfire.no-ip.org/img/hammeraligntoviewproblem.png
Commented 10 years ago2014-06-21 04:40:12 UTC Comment #100966
"No one is going to understand this" - funny, seeing as you're the first one I've come across that didn't understand it. Still, sorry it didn't work for you. I'd help you out but your url got blocked my Malwarebytes, maybe try uploading to imgur or similar instead?
Commented 10 years ago2014-06-21 04:43:57 UTC Comment #100967
Also, the tiny images are a limit of this site, so not my fault. Can't get them bigger. The tutorial is also available (with larger images) here: http://forums.svencoop.com/showthread.php/41242-Skewing-textures-in-Hammer
Commented 10 years ago2014-06-29 00:01:43 UTC Comment #100968
Can you please submit a false positive to malwarebytes. I have sent them a message multiple times and they still haven't removed it from their list. There is nothing malicious about my site. If you could make a video tutorial that would be fantastic. Maybe it is my version of hammer, but I literally duplicated your exact block with everything, and it didn't work.
Commented 10 years ago2014-08-07 11:01:33 UTC Comment #100969
There is an even easier way to flip the texture to the other direction by simply just putting a negative before the number.
Commented 9 years ago2015-01-12 03:15:54 UTC Comment #100970
It only works with the exact same brush as in this tutorial.
Commented 8 years ago2016-06-08 16:22:51 UTC Comment #100971
There has to be a better way to do this. Maybe edit the .map file in notepad? I remember bruce saying something about that.
Commented 2 years ago2022-10-22 12:19:26 UTC Comment #104864
What's the formula to do this to trapezoidal faces (e.g. Ames room)?

edit: to answer my own question: unfortunately it's not possible due to how the texture coordinate system works. it only has 2 axes and a vanishing point needs at least 3. It might be possible to coax it with a lot of subdivision and triangulation.

You must log in to post a comment. You can login or register a new account.