VERC: Combining Brushes with a Text Editor Last edited 2 years ago2022-09-29 07:54:16 UTC

Have you ever had a bunch of brushes, and wanted to combine them all into 1? Unfortunately, this is not an option in Worldcraft, BUT it is possible with a text editor as long as the brushes, when combined, would make a convex object!

So first lets define what a convex object is in terms of a .map. A convex object can be stored as the intersection of many 2d planes in 3d space, which is exactly how brushes are stored in .map format. In order for this trick to work, the combination of all your brushes MUST be convex. Think of it like this: if you can draw a line that passes through the object more then 2 times, then the object MUST be concave and you cant combine the brushes.

If, however, the combination yeilded would be convex, then you can proceed.

So lets say you made this really nifty thingamajig out of a ton of triangular prisms, and you want to turn it all into 1 brush because having multiple brushes is giving clipping errors or some other rubbish that is known to occur with such things.
User posted image
The first thing you do is to take your thingamajig and put it all into a separate map so that it is easier to browse the .map file, and so that if you mess up, it wont ruin your entire map.

Now take it and cover it all with a single texture, the name of which is distinguishable. I like to use aaatrigger because the aaa catches my eye easily when perusing planes in notepad. It should look something like this:
User posted image
Now go around in 3d, and apply the origional texture to every OUTSIDE face, but not the inside faces! the outside should look like this:
User posted image
Whereas the inside should look something like this:
User posted image
Now export to .map, which can be comprehended in text format.
User posted image
Now right click on the .map file, and select "open with" (or just "open" if you have not associated the file type already). It will bring you to a list of programs to open it with. Select "notepad" from the list. The dialog may look like this depending on your OS:
User posted image
When you open it, what you see should look something like the following minus the highlighting. Every line with AAATRIGGER is a plane that we dont want, so delete it! The separations between different brushes are marked using the { brackets }, and since we want it all to be 1 brush, we must delete these as well.
{
    "classname" "worldspawn"
    "classname" "worldspawn"
    "sounds" "1"
    "MaxRange" "4096"
    "mapversion" "220"
    "wad" "sierrahalf-lifevalvehalflife.wad;"
    {
        ( -256 224 0 ) ( -256 256 32 ) ( -128 224 128 ) AAATRIGGER [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -192 352 0 ) ( -256 224 0 ) ( -128 224 128 ) -1OUT_RK5 [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -192 352 0 ) ( -256 256 32 ) ( -256 224 0 ) AAATRIGGER [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
        ( -256 256 32 ) ( -192 352 0 ) ( -128 224 128 ) AAATRIGGER [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
    }
    {
        ( -192 352 0 ) ( -256 320 64 ) ( -128 224 128 ) AAATRIGGER [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -224 384 160 ) ( -192 352 0 ) ( -128 224 128 ) -1OUT_RK5 [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -224 384 160 ) ( -256 320 64 ) ( -192 352 0 ) AAATRIGGER [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -256 320 64 ) ( -224 384 160 ) ( -128 224 128 ) AAATRIGGER [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
    }
    {
        ( -192 352 0 ) ( -288 288 64 ) ( -224 384 160 ) AAATRIGGER [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -352 384 32 ) ( -192 352 0 ) ( -224 384 160 ) -1OUT_RK5 [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -352 384 32 ) ( -288 288 64 ) ( -192 352 0 ) AAATRIGGER [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
        ( -288 288 64 ) ( -352 384 32 ) ( -224 384 160 ) AAATRIGGER [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
    }
    {
        ( -288 288 64 ) ( -192 352 0 ) ( -256 224 0 ) AAATRIGGER [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -288 288 64 ) ( -352 384 32 ) ( -192 352 0 ) AAATRIGGER [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
        ( -192 352 0 ) ( -352 384 32 ) ( -256 224 0 ) -1OUT_RK5 [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
        ( -288 288 64 ) ( -256 224 0 ) ( -352 384 32 ) AAATRIGGER [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
    }
    {
        ( -320 192 96 ) ( -256 288 64 ) ( -256 224 0 ) AAATRIGGER [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -256 224 0 ) ( -256 288 64 ) ( -352 384 32 ) AAATRIGGER [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -320 192 96 ) ( -256 224 0 ) ( -352 384 32 ) -1OUT_RK5 [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -352 384 32 ) ( -256 288 64 ) ( -320 192 96 ) AAATRIGGER [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
    }
    {
        ( -224 320 64 ) ( -352 384 32 ) ( -320 192 96 ) AAATRIGGER [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
        ( -224 320 64 ) ( -224 384 160 ) ( -352 384 32 ) AAATRIGGER [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -352 384 32 ) ( -224 384 160 ) ( -320 192 96 ) -1OUT_RK5 [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -224 320 64 ) ( -320 192 96 ) ( -224 384 160 ) AAATRIGGER [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
    }
    {
        ( -224 384 160 ) ( -320 192 96 ) ( -224 256 32 ) AAATRIGGER [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -128 224 128 ) ( -224 384 160 ) ( -224 256 32 ) AAATRIGGER [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -128 224 128 ) ( -320 192 96 ) ( -224 384 160 ) -1OUT_RK5 [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
        ( -320 192 96 ) ( -128 224 128 ) ( -224 256 32 ) AAATRIGGER [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
    }
    {
        ( -320 192 96 ) ( -256 224 0 ) ( -224 320 64 ) AAATRIGGER [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -224 320 64 ) ( -256 224 0 ) ( -128 224 128 ) AAATRIGGER [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -320 192 96 ) ( -224 320 64 ) ( -128 224 128 ) AAATRIGGER [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
        ( -128 224 128 ) ( -256 224 0 ) ( -320 192 96 ) -1OUT_RK5 [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
    }
}
So, once this is done, we get a much nicer plane by plane definition of our one intended object, which should look something like the following:
{
    "classname" "worldspawn"
    "classname" "worldspawn"
    "sounds" "1"
    "MaxRange" "4096"
    "mapversion" "220"
    "wad" "sierrahalf-lifevalvehalflife.wad;"
    {
        ( -192 352 0 ) ( -256 224 0 ) ( -128 224 128 ) -1OUT_RK5 [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -224 384 160 ) ( -192 352 0 ) ( -128 224 128 ) -1OUT_RK5 [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -352 384 32 ) ( -192 352 0 ) ( -224 384 160 ) -1OUT_RK5 [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -192 352 0 ) ( -352 384 32 ) ( -256 224 0 ) -1OUT_RK5 [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
        ( -320 192 96 ) ( -256 224 0 ) ( -352 384 32 ) -1OUT_RK5 [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -352 384 32 ) ( -224 384 160 ) ( -320 192 96 ) -1OUT_RK5 [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
        ( -128 224 128 ) ( -320 192 96 ) ( -224 384 160 ) -1OUT_RK5 [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
        ( -128 224 128 ) ( -256 224 0 ) ( -320 192 96 ) -1OUT_RK5 [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
    }
}
Now all that is left to do is save the .map, exit notepad, and open it up in your editor of choice!

Here is what the tutorial thingamajig looks like in worldcraft once completed:
User posted image
If yours didnt come out correctly, then EITHER,
1: Your objects, when combined, make a concave object.
OR
2: You didnt texture correctly: an inside face was textured as an outside face, so you have redundant plane definitions since it didnt get deleted, or an outside face got textured as an inside face, so you deleted a necessary plane definition.
OR
3: You screwed up somewhere in notepad/wordpad.
This article was originally published on Valve Editing Resource Collective (VERC).
The archived page is available here.
TWHL only publishes archived articles from defunct websites, or with permission. For more information on TWHL's archiving efforts, please visit the TWHL Archiving Project page.

Comments

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