Invalid solid structure?

trees

L2: Junior Member
Apr 1, 2017
80
39
I'm doing some preparation for the 72hr jam, trying to figure out how to make this piece of geometry I have in mind. There's going to be a control point on a roof, surrounded by angled windows of sorts. I've used the vertex tool to make a piece of the windows, but it's causing a problem in the Alt+P dialog, saying it's an invalid solid structure. Picture here:
http://imgur.com/a/YzYhy

Also, trying to clip the brush into smaller parts (to make window frames) causes some of the vertexes to move off grid.

Any ideas what's causing the problem?
http://imgur.com/a/YzYhy
 
Sep 28, 2016
109
61
From the pictures it's a little hard to tell but invalid solids are usually created when you accidentally make a concave brush. I would try to make the shape with the clipping tool first (i.e. starting from a rectangular brush) and making sure that you use cuts of easy to work with ratios. The vertex tool makes it very easy to create difficult and invalid geometry so I would try to avoid it if possible.
 

Da Spud Lord

Occasionally I make maps
aa
Mar 23, 2017
1,339
994
The vertex tool is powerful, but it's also really easy for someone who doesn't know what they're doing to create an invalid structure, which is why it's best to avoid it where possible until you're comfortable with Hammer and you're ready to learn advanced stuff. I'll try my best to explain what I've learned from playing around with it, but I can't get any screenshots ATM because I'm not on my computer, and my knowledge may be incomplete or wrong, so feel free to take what I say with a grain of salt.

There are two ways to create an invalid solid with the vertex tool: either creating a concave solid, or creating a solid with an invalid face. A concave shape is a shape with a part that collapses into itself. Here's a picture:
concavevsconvex2d.jpg

The shape on the left is a concave shape because it has a part of it that collapses in on itself. The shape on the right is convex, which is the opposite of concave- it has no parts that collapse in on itself. In geometric terms, concave shapes have at least one internal angle that is greater than 180 degrees, while every internal angle in a convex shape is less than or equal to 180 degrees. If you translate these shapes into the 3D world of Hammer, the shape on the left would be invalid, while the shape on the right would be perfectly valid. Luckily, this problem can usually easily be remedied by cutting your concave solid into 2 or more convex solids. This problem is also easier to avoid in the first place.

Creating a solid with an invalid face is the more difficult problem to avoid. An invalid brush face is one that Hammer cannot figure out what plane it is on (if you've studied planes in geometry you'll know what I mean); in other words, the brush face is not flat. When I say flat, I don't mean it has to line up to the grid. I mean that if you were to take the brush face and line it up to the grid, it would be entirely flat, with no curves or anything. This problem can usually be avoided with two techniques: selecting and moving multiple adjacent vertices together, and using caution and foresight when using the vertex tool. Always ensure your brush faces are flat. It can be difficult to find or fix an invalid brush face without looking closely at each brush face individually, which is why it may be better to just delete the invalid solid and recreate it with the above tips in mind. Additionally, triangular brush faces cannot be invalid, so you may find those useful if you can't seem to vertex manipulate a brush without making it invalid.

This page on the Valve Dev Wiki talks about what I've just talked about in more complex terms.
 

trees

L2: Junior Member
Apr 1, 2017
80
39
Thanks for the replies, they've been helpful! I didn't actually know this thing about concave/convex brushes. However, I'm still having trouble visualizing how exactly my brush is concave... On cp_gorge last point there's windows in the ceiling with brushes that are pretty much the same shape as mine, yet they seem to be valid?

Look, I'll upload the .vmf file. If someone could have a quick look and see if they can make the brush work, I'd be grateful.
http://s000.tinyupload.com/index.php?file_id=62410321919038084918

The problem's basically this. If you vertex edit this off-grid corner up to the brush intersection/whatever, it becomes an invalid solid. Then if you open alt+P and click 'fix problem', it pops off grid again.
http://imgur.com/a/cn5ds
 

Da Spud Lord

Occasionally I make maps
aa
Mar 23, 2017
1,339
994
Thanks for the replies, they've been helpful! I didn't actually know this thing about concave/convex brushes. However, I'm still having trouble visualizing how exactly my brush is concave... On cp_gorge last point there's windows in the ceiling with brushes that are pretty much the same shape as mine, yet they seem to be valid?
Like I said, there's multiple ways a brush can be invalid- having a concave brush is only one of a few ways you can create an invalid brush.

Look, I'll upload the .vmf file. If someone could have a quick look and see if they can make the brush work, I'd be grateful.
http://s000.tinyupload.com/index.php?file_id=62410321919038084918
I won't be getting back from my trip until tomorrow, but I'll take a look at it tomorrow or Sunday if nobody else does.

The problem's basically this. If you vertex edit this off-grid corner up to the brush intersection/whatever, it becomes an invalid solid. Then if you open alt+P and click 'fix problem', it pops off grid again.
http://imgur.com/a/cn5ds
Try selecting other, adjacent vertices and moving them as a group instead of moving one vertex individually- moving a single vertex individually will almost always result in an invalid solid, the second type I mentioned (unless you're dealing with triangular brush faces).

If that doesn't work, just delete and recreate the brush. Try to make sure it doesn't go off-grid in the first place.
 

trees

L2: Junior Member
Apr 1, 2017
80
39
Yeah, I tried remaking the brush. It was still invalid, but seems like lowering the CP platform ~32 hu and making the slope less steep fixes it. Weird. Maybe I'll just have to work around that.
 

Tumby

aa
May 12, 2013
1,084
1,192
The problem is that the arch tools round their vertices to be on the 1-grid. By making an angled brush that connects two differently sized arches you are bound to get a non planar surface.
When you lower the height difference, hammer won't notice this problem as easily and during the compile it will just try to somehow fix it [which can cause some vertices to go to unexpected places]
The best option is to clip the brush into two triangles. After all, a triangle literally can't be non planar.
 

trees

L2: Junior Member
Apr 1, 2017
80
39
The problem is that the arch tools round their vertices to be on the 1-grid. By making an angled brush that connects two differently sized arches you are bound to get a non planar surface.
When you lower the height difference, hammer won't notice this problem as easily and during the compile it will just try to somehow fix it [which can cause some vertices to go to unexpected places]
The best option is to clip the brush into two triangles. After all, a triangle literally can't be non planar.

This is like, way over my head, but thanks for the explanation! :D
I wonder what's so different about the windows on cp_gorge then? Aren't these brushes non-planar too (if I understand that word correctly)?
http://imgur.com/a/O2kSG
 

Da Spud Lord

Occasionally I make maps
aa
Mar 23, 2017
1,339
994
This is like, way over my head, but thanks for the explanation! :D
I wonder what's so different about the windows on cp_gorge then? Aren't these brushes non-planar too (if I understand that word correctly)?
http://imgur.com/a/O2kSG
Those windows are likely made of multiple brushes.
 

Tumby

aa
May 12, 2013
1,084
1,192
There is an even more difficult method of making valid circular structure that you wouldnt even begin to understand if you dont know what "planar" means.
Planar, btw, means that a set of points are all on a perfect plane. Just because you make a plane from 4 points doesn't mean that they are all truly on a plane. Hammer will show you a surface but if you look at it from the right angle you might start to see things getting weird.

Here the other method if you are interested:
https://tf2maps.net/threads/roundhouse.20580/
 

iiboharz

eternally tired
aa
Nov 5, 2014
857
1,291
Brushes by default are made of quads, try making your surface out of tris. (A shape with 3 sides, not 4.)
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
Hmm, I'm not sure what went wrong here. In theory, a slanted trapezoid where the upper corners are on the same level and the lower ones are also on the same level should always be planar, no matter what else is going on with it. Shouldn't matter how the dome is rotated, how many sides it has, etc.
 
Sep 28, 2016
109
61
You only need three triangles to make a trapezoid, but four could also work:
UmZbxRL.png


Pocket, since he used the vertex tool he probably accidentally moved one corner out of the plane, especially since it's not axis-aligned.