The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

So... anyone use Hammer?

whuppinswhuppins Registered User regular
edited March 2008 in Help / Advice Forum
I've been using the Source SDK's Hammer tool to try to get into building maps for Team Fortress 2. I've got most of the basics down, thanks in large part to Valve's wiki. I'm now moving into slightly more complicated territory, and I need some specific questions answered that aren't covered in any documentation or tutorial I've come across. There's a community for nearly everything, so I assume there's a community for people who use Hammer. I just can't find it. Can someone tell me where I can find an active forum-based community of Hammer users to get some of my questions answered? Thanks.

...Oh, by the way, here's the actual question I'm trying to get answered. If anyone can help, feel free to PM me (though I'm sure I'll have many more questions in the future, which is why I'm trying to find the best place to ask them instead of randomly asking here):
In terms of basic world geometry, what's the best way to do a trench or canal that has non-uniform width? I'm trying to do a river that meanders through a plain, only I don't want it to have a boxy "U" shaped cross section, or to only flow at right angles.

More detail:
Here's what I've done so far to build the water: I started with a triangular prism. Like the following, only upside-down so it's 'pointing' downward:
1145490259.gif

I then used the vertex tool to arrange the X/Y values of the two triangular faces into more 'organic' angles. Then I created a copy of the prism and attached the copy to the end of the original by arranging its three triangular 'end' vertices so that they matched up perfectly with the first piece's vertices. Awesome MS Paint rendering:
trench.gif

Using a triangular prism means that the trench doesn't actually have a 'bottom' to stand on, but it also means that I'll always be able to seamlessly attach each new segment's back face to the previous segment's front face (I know, having no flat surface on the bottom gets really wonky during gameplay, but that's not the problem I'm trying to solve just yet). The four vertices of each 'side' will usually have completely different X and Y values, so the engine will have to 'crease' the sides diagonally instead of being able to draw a clean, flat quadrilateral surface across all four vertices. This is a little ugly but otherwise fine with me, since I'm going for a more natural look anyway. If, however, it's not generally fine with the engine (I think this is the crux of my problem -- see below), please let me know that forcing a face of an object to deform in such a way in order to accommodate its four vertices is 'bad form'.

Note that in all cases, I'm not changing any Z values. I wanted to start simple with a trench of a constant depth and the documentation tells me that the top surface of all water objects must be completely flat. By locking in all Z values, I can ensure that the 'top' face of each segment will never deform in the way that the 'sides' are allowed to do. As far as I can tell, I should be able to manipulate the Z values of the two 'bottom' vertices to vary the depth without affecting the flatness of the water surface, but as I said, I'm trying to get some simpler stuff working before moving forward.

So, I have this twisting, turning, yet seamless water object -- flat top face, no gaps, not even any overlapping volume as far as I can tell -- and I can't quite figure out where to go from here. I first assumed that I could just drop the river object into a solid rectangular 'floor' of appropriate depth, and then use the Carve tool to carve the floor to match the river. However, I soon found that it wouldn't work. The deformed, creased 'sides' of each segment will not carve properly; I end up with jagged gaps of empty space on the shoreline between the end of the water and the start of the ground. I gave the wiki another look this morning and it appears to be an acknowledged fact that the Carve tool isn't reliable beyond basic structures -- specifically, you'll rarely get the result you want when trying to carve with an object that's had its vertices messed around with or has other irregularities.

This is essentially where I'm stuck. I have a feeling that one or more of three things is messing me up:

1 - There is a tool or function that works a lot better for what I'm trying to do (subtracting one volume from another) than Carve.
2 - There is a way to seamlessly attach irregular segments that doesn't result in 'creased' surfaces or is otherwise less messy in general.
3 - I'm approaching the whole process of creating a river/trench (build river, then drop into land) from the wrong direction to begin with.

If anyone can give me some advice, I'd be very appreciative.

whuppins on

Posts

  • wakkawawakkawa Registered User regular
    edited March 2008
    The best way is to just use displacements. Build one section of a U based trench, then just keep copy and pasting it, each time skewing the 3 boxes to make it bend around a bit. When you are done doing that, select all the faces that are show and turn them into displacements. I've made a couple of river maps this way, so Ill post some examples when I get on my own computer.

    Also, never use the carve tool.

    wakkawa on
  • whuppinswhuppins Registered User regular
    edited March 2008
    wakkawa wrote: »
    The best way is to just use displacements.

    Okay, I admit up front that I really don't understand displacements very well. Based on some reading, it seemed like they would be relevant -- I was totally expecting the first response to mention them -- but I couldn't really put my finger on how they'd help. For one thing, my (very limited, I'm sure) understanding of displacements is that they're just there to do random tiny deformations on a flat surface for a more natural texture. I don't see how this would apply to my situation directly, though. I'm OK with long stretches of flat surfaces for my body of water, as long as each of those surfaces can change size and direction every few feet. I don't need the surfaces themselves to be bumpy.
    wakkawa wrote: »
    Build one section of a U based trench, then just keep copy and pasting it, each time skewing the 3 boxes to make it bend around a bit.

    I get the idea here; I think it's basically what I've been trying to do as described in the OP. The thing about "skewing 3 boxes" kind of loses me, though -- what you mean by "boxes", if you're talking about literally using the Skew command as opposed to re-sizing, moving vertices, etc... but at any rate, this is where I ran into my first problem: However you're twisting up your water segments, how do you get each segment to snap neatly onto its surrounding segments? In my experience, there have always been gaps and jaggy protruding parts of my water object at the joints because you're trying to mash together two completely different shapes. How does one overcome this? In my case I had to simplify by not messing with Z-axis values and using a triangular cross-section. It seems I'm not getting how you're actually supposed to build your trench.
    wakkawa wrote: »
    When you are done doing that, select all the faces that are show and turn them into displacements. I've made a couple of river maps this way, so Ill post some examples when I get on my own computer.

    Thanks, I would love it if you could show me some examples. I know that it's hard to explain most of this stuff using only words. As I've mentioned before, I don't really 'get' displacements yet so I can't understand how making the edges of my segments bumpy can help them connect seamlessly to each other, but obviously I'm missing something so I look forward to seeing what you're able to do with them.
    wakkawa wrote: »
    Also, never use the carve tool.

    OK, I have to ask about this because it brings up a separate, though related, question that I feel like I really need to have explained to me before I try anything else in Hammer. Even before I read this sentiment echoed by the wiki and other sources, I understood that the 'shattering' effect caused by most carves makes it undesireable as a design rule. I understand; I agree. However, the concept of carving solves a problem that I don't currently know any other solutions to: How to place solid object A into solid object B, removing the excess volume from B in the process. Like, let's say that I get all the stuff from above worked out. I have a beautiful river object, floating out in space in Hammer. I have a 20-foot-thick 'floor' on my map, and I want to place the river in the floor so that their volumes do not overlap and there are no gaps between the two: the one is perfectly contoured to fit the other. How else do I do something like this if not with carving (and yes, shattering my floor into a million pieces in the process)?

    whuppins on
  • wakkawawakkawa Registered User regular
    edited March 2008
    yeah Im really bad at explaining things, so heres a couple pics I hope make it clearer.
    before:
    k1.jpg
    after(with water):
    k2.jpg

    What I did was made 3 boxes, 2 making the sides, and one lower to make the bottom. I then copied and pasted these box a couple times using the shift click drag to make sure they are on the same height.

    Then I just skewed them by selecting them, then clicking them again. will make the selection bars either rotate, move, or skew. I did this to a couple of them, but you can only do that so much before it just doesn't look right anymore.

    So I just use the vertex thing and moved them myself making sure that all the vertex were touching. This is really important for displacements.

    After I shaped the box trench, I selected all of the top faces (only the ones you want to be part of the trench and can see) with the texture selection tool. On that box that shows up, go to displacements and hit created. I used a displacement of a power of 3. After they were created, and while they were still selected, hit the subdivide thing. This will smooth them all out with each other.

    Thats pretty much it. Its probably better if you just hit up the wiki for the displacements. and lots of experimentings.

    The carving thing, you are just going to have to plan ahead for that kind of stuff. Break your floor up into equal sized boxes instead of one huge one. This way, you can just delete the boxes where you rriver is going to be, then vertex move the surrounded boxes to fit it.

    finished map doing these things:
    k3.jpg
    though I wanted my river kinda straight

    EDIT: there is some really bad grammar in this post. I'm not going to fix it because its hilarious.

    wakkawa on
  • whuppinswhuppins Registered User regular
    edited March 2008
    Hmmm... thanks for the help; I'll have to spend some time digesting that info.

    In the meantime, can you clear something up for me? I think part of my problem has been that I've been approaching this the wrong way. I've been wanting to start by building the river itself, a 'snake' of water objects, and then mashing that into a flat land object somehow.

    By looking at your pictures, it seems that your approach is to dig a trench through the land object first, then bring up a huge rectangular block of water at the correct height so that it 'floods' the low, dug-out areas of the land. You allow for a large amount of overlap between the water block and the non-trench land areas, but that's OK because the player will only see solid ground in these areas anyway. Is that accurate? That's fundamentally different from my method, and I can see why it would be the preferred method.

    So do I have that part right at least? Dig a canal in the ground first, then drop a big block of water in, and don't worry about doing any carving, manual or otherwise. Am I on the right track?

    whuppins on
  • wakkawawakkawa Registered User regular
    edited March 2008
    yeah thats pretty much right. You can have multiple blocks of water so there isn't as large of an overlap, as long as you align the water textures and have the blocks all the same height. A lot of weird shit starts to happen when multiple water squares aren't on the same level.

    The one big block might be bad performance wise, but I really haven't noticed.

    EDIT: Also, instead of using carve, try the clip tool to break up large blocks.

    wakkawa on
  • SeguerSeguer of the Void Sydney, AustraliaRegistered User regular
    edited March 2008
    I've done a little bit of work in Hammer, and the shattering from carve can be limited by first cutting out a straight section of where the shattering will occur. This limits the shatter to the straight edge that you've deliberately cut.

    For example:

    Take a large square. If you want a circle hole in it and use the carve tool to do so the shattering effect will extend all the way to the edge of the square. If you instead create a smaller square that encompasses the circle before carving, and cut that out from the large square, you end up with the larger square being 4 rectangles (without crappy vertices) and a small square that gets shattered.
    HammerCarveShatterEffectLimiting.jpg

    Seguer on
  • wakkawawakkawa Registered User regular
    edited March 2008
    Thats actually really really bad to do that. You have those triangles intersecting each other, so when you compile your map they will all be split into even smaller pieces. It might also have some problems when you compile, cus the lines aren't aligned to the grid.

    try making your cricles like this:
    k4.jpg

    The carve tool is just really, really bad.

    Also, I would recommend reading about func_details for these kind of things too. They make a huge difference in performance and compile times.

    wakkawa on
  • SeguerSeguer of the Void Sydney, AustraliaRegistered User regular
    edited March 2008
    Really? Booo, that's how I got taught D:

    Seguer on
  • infofcerinfofcer Registered User regular
    edited March 2008
    Interlopers was a pretty good forum community back when I mapped on a regular basis. Haven't been there in awhile but it still looks pretty active.

    infofcer on
Sign In or Register to comment.