News: Celebrating over 10 years serving the creative community

Author Topic: Skewing textures in Hammer  (Read 9828 times)

kaffikopp

  • Roach
  • *
  • Posts: 12
Skewing textures in Hammer
« on: September 28, 2013, 05:59:19 AM »
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:



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.



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:



This is easily fixed by flipping the texture 180 degrees and hitting “Fit”.



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:



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:



Then you should end up with a correct perspective (obviously you need to flip it back once you're done).



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:



Thanks for reading, hopefully someone will find this useful.
« Last Edit: September 28, 2013, 06:10:44 AM by kaffikopp »

Alex

  • For Hire A
  • Gman
  • *
  • Posts: 2057
Re: Skewing textures in Hammer
« Reply #1 on: September 28, 2013, 10:53:49 AM »
I did not know there was an "align to view" button. All this time I've been manually rotating textures D:

D3ads

  • Baby Gargantua
  • ******
  • Posts: 432
  • Stoj! Opasna Zona!
    • Moddb Profile
Re: Skewing textures in Hammer
« Reply #2 on: September 28, 2013, 12:48:50 PM »
Alex, were you also individually texturing each face when it repeats? I was until I found out about the apply texture + values button this year... :bang:

Wow... who would have thought such a simple procedure would once again create very effective results- excellent work!

About that handrail staircase... there's such a complicated spiral staircase in the interior of my building, see here;



A tutorial on how you managed to achieve that so well and how I can effectively use it to recreate the above structure would be greatly welcomed!

Alex

  • For Hire A
  • Gman
  • *
  • Posts: 2057
Re: Skewing textures in Hammer
« Reply #3 on: September 29, 2013, 11:26:54 AM »
Alex, were you also individually texturing each face when it repeats? I was until I found out about the apply texture + values button this year... :bang:
I don't know about any of this stuff :[

Honestly I generally just used "align L/R/Top/Bottom". Time to look into stuff I guess.

SPRKH

  • Cry of Fear Team
  • Big Momma
  • *
  • Posts: 703
Re: Skewing textures in Hammer
« Reply #4 on: September 29, 2013, 07:37:19 PM »
Why not put the camera below the geometry? Might project the texto.re correctly in one go.

kaffikopp

  • Roach
  • *
  • Posts: 12
Re: Skewing textures in Hammer
« Reply #5 on: September 29, 2013, 07:57:25 PM »
Why not put the camera below the geometry? Might project the texto.re correctly in one go.

Not quite sure what you mean, could you be more specific?