How to get (almost) perfect texture rotations

A Tutorial for Half-Life

How to get (almost) perfect texture rotations for brush faces in Hammer 3.5 using Blender

This tutorial applies to the Hammer Editor 3.5

UPDATE: I have removed the old tutorial since it was totally dispensable. Read the comments by 3zzzTyle for further information about this topic.

Aligning Textures on edges works by selecting the neighboring face and then pressing ALT while applying the selected texture to faces. In almost every case this will apply the correct rotation, scale and shift.



In cases where this doesn't produce the expected result, try switching the texture alignment of the face to "Face" instead of "World" and it might work perfectly after all.

Posts

  • ToTac avatar
    ToTac Joined 5y ago
    Offline
    240 points Ranked 17098th
    5y
    It's defnitely good to know a lot of ways how to do this. However I will have to go through the math stuff a lot of times until I get it and in most cases I would rather go with the automatic texture alignment or Blender. But still good to know ofc. Thank you a lot for explaining!
    Bananite
  • Lord Canistra avatar
    Lord Canistra Joined 10y ago
    Offline
    12,102 points Ranked 382nd
    20 medals 1 legendary 3 rare
    • 1st Place - 2016 Winter Mapping Contest Medal icon
    • 6 years a member Medal icon
    • 2nd Place - Beneath the Dust Mapping Contest Medal icon
    • Returned 1000 times Medal icon
    • Reached 1,000 Points Medal icon
    • Reached 2,500 Points Medal icon
    5y
    Yep, something as simple as arc aligned to one of major planes can be textured in matter of minutes. Here I have 3 arcs, 16 segments each. Top sides have their texture coordinates copied from inner (as in, inner respective to arc) side planes of the same brush. Calculating required angle on your own isn't that hard, though. Lets make some basic brush and shift one of its ends to an arbitrary position. Now we have lost the desired alignment of the texture on top side (naturally, on bottom side as well). To calculate required texture rotation angle, I draw a selection rectangle in such way that one of longer edges of our distorted brush will lie on diagonal line of that selection (Take a look at the top view projection). Next, I use dimensions of this selection (as shown in the bottom status bar) - 352 x 192 Hammer units - to calculate tangent of the angle between longer edge of our brush and X axis. Why X axis? Because brush edges were aligned in a parallel manner to this axis before vertex manipulation. Finally comes the time for some math. Tangent equals length of side opposite to corner of triangle divided by length of side adjacent to it. The corner we're looking at is corner made by edge of brush and X axis - again, looking from top 2D projection. So the tangent will be 192 / 352 = 0.54545454... or 0.(54) for short. Now it's matter of using inverse function, arctangent to get the angle itself. Using any calculator (in my case, Windows calculator) will suffice. It's a common practice to use radians instead of degrees in scientific software, Windows calc being no exception. Therefore, it gives answer of 0.497105741... - the right angle expressed in radians. To convert it to degrees, which VHE uses, simply multiply this number by 180 and divide by pi (3.14159 should be enough). After that, you should end up with value of 28.48 degrees. Here we go, works like a charm. As a finishing touch, you might want to do something about texture scale, since top side of the brush is a bit "thinner" when viewing from top - because of the way we sheared one end before. The most fast way to do so is to use "Fit" button in texturing window and manually copy the smaller value in X/Y scale fields to bigger value, like that. Good luck & feel free to include anything in this tutorial if you found it useful.

    9.7

  • ToTac avatar
    ToTac Joined 5y ago
    Offline
    240 points Ranked 17098th
    5y
    You know, what you just mentioned is exactely what I was looking for in the first place. It's the first time I hear about it and apparently it couldn't be easier. Although, I played around a bit and it does not seem to work for absolutely any situation (just some crazy stuff with distorted/rotated brushes) but of course it is still way easier and faster for 99% of Goldsource mapping. So, thanks a lot for mentioning! Let's just use my method as an emergency alternative then :D
    Bananite
  • Lord Canistra avatar
    Lord Canistra Joined 10y ago
    Offline
    12,102 points Ranked 382nd
    20 medals 1 legendary 3 rare
    • 1st Place - 2016 Winter Mapping Contest Medal icon
    • 6 years a member Medal icon
    • 2nd Place - Beneath the Dust Mapping Contest Medal icon
    • Returned 1000 times Medal icon
    • Reached 1,000 Points Medal icon
    • Reached 2,500 Points Medal icon
    5y
    Peculiar. But why not use the magical Alt + RMB combination in VHE to apply texture and its alignment from selected face? It can work wonders even with the most twisted geometry. In this case, you could apply texture and alignments from sides of arcs to their upper faces for similar results. I might make another tutorial on that topic if there are none around.

    9.7

    • Agree x 1

Embed

Share banner
Image URL:
HTML embed code:
BB embed code:
Markdown embed code:

Credits

Author
ToTac
ToTac Joined 5y ago
Offline
240 points Ranked 17098th

Submitter

ToTac avatar
ToTac Joined 5y ago
Offline
240 points Ranked 17098th

ToTac
Creator
Sign up to access this!
Sign up to access this!
Sign up to access this!

Game

Sign up to access this!

Category

Details

Difficulty Level
Beginner Difficulty

Attributes

Share

  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • Share on Google+

Stats

  • 4,811 Views
  • 4 Posts
  • 5y Submitted
  • 1y Modified

Scores

87 bScore
9.7 Rating

1 voter

Sign up to access this!

More from Submitter

bcp.crwdcntrl.net tracking pixel