Need utility that will merge equal/coplanar brushes


(Chruker) #1

Hello

I’m looking for a utility that will read a .map file and merge all brushes that are equal/coplanar into larger brushes and thus reducing the total brush amount.

I’ve made a large open terrain with easygen, which contains a large valley floor which - for now at least - is perfectly level. But since easygen generates its brushes with equal x/y size, a lot of these could easily be merged into larger once. However I don’t want to do this manually over and over again, each time the terrain changes.

So now I’m looking for a utility that’ll detect and merge all of these brushes, so that the number of brushes can be lowered.

Does anybody know if there exist such a tool?

I have also tried VandalL’s HL2HM terraineditor: http://www.splashdamage.com/forums/viewtopic.php?t=2949&highlight=hl2hm which seems to do wonders with its assimilation of coplanar brushes, but it’s missing the possibility to import maps so I can adjust my map around its buildings. It actually produced the same terrain with similar details as easygen, but only using about 1/4 of the amount of brushing that easygen generates.


(sock) #2

Try saving your terrain into a test map. Compile it with q3map2 (-meta option) and then convert the BSP back into a .MAP file again.

The meta option can be very good at reducing lots of small polys into bigger polys. I’m not 100% sure if this will help, but its worth a try because the whole process could be automated with batch files.

Sock
:moo:

EDIT: Typos


(Chruker) #3

I tried with the following bat file:


@ECHO ON
SET Q3MAP2_EXE="E:/Q3MAP2/q3map2.exe"
SET ET_PATH="G:/Games/Wolfenstein - Enemy Territory/"
SET MAP_PATH="C:/Documents and Settings/My Real Name/Documents"
SET MAP_NAME="test"

%Q3MAP2_EXE% -bsp -v -game et -fs_basepath %ET_PATH% -meta %MAP_PATH%/%MAP_NAME%.map
PAUSE
%Q3MAP2_EXE% -convert -v -game et -fs_basepath %ET_PATH% -format map %MAP_PATH%/%MAP_NAME%.bsp
PAUSE

The .bsp and new map file is created, but the amount of brushes in the terrain entity is exactly the same as in the original.

q3map2 was version 2.5.11


(sock) #4

You really need to talk to yndar about the meta option (infact me too) but according to the q3map2 manual it does this …

http://www.shaderlab.com/q3map2/manual/bsp.htm


meta
Creates meta surfaces from brush faces. This is a very useful switch. It decomposes brush faces into their component triangles, and makes a bsp more efficient by:
1. combining surfaces.
2. removing coincident verts.
3. lowering the surface + vert count across the map.
The BSP -meta command will no longer merge triangles into a large surface that causes lightmaps to become lower resolution (higher samplesize). This is a BIG change from previous Q3Map2 versions because you can VERY easily create a map that has 150+ lightmap pages and fail to light. Use _lightmapscale with care now.

I’ve tried it too in some test maps and it seemed to do very little for me as well. I’m sure it use to work, but I’ve probably got some parameters wrong or I’m not fully understanding the working of the feature. (Either is possible)

Try suggesting the idea on the q3map2 forum here at SD. You may not get a rapid response because of xmas but if its possible that the meta option can help then ydnar will be able to tell you.

http://www.splashdamage.com/forums/viewforum.php?f=8

Sock
:moo:


(MuffinMan) #5

hmm if you think of some sort of a csg-merge on all available brushes i could think about writing such a thing - so did i get you right? given enough interest i would set it on my todo-list (which is unfortunately quite long…)


(Chruker) #6

I’m still looking for an existing utility to do those merges, but during xmas I have created an application that will create an optimized .map file from a heightmap image. It lowered the brush count, while the terrain kept its detail level, however it wasn’t optimized enough. Therefore I have to add some approximations so that it also merges brushes which have a similar slope. Also have to do some bugfixing.

The application I made was created in php (I know :-)) so it runs horribly but it works. But now I’m trying to create something similar in c++ - that one will read a .map file instead, import the terrain vertexes and try to create an optimized version of the terrain entity.

MuffinMan >> Was it you who were trying to make a php application for development of maps? Sort of a cvs system for map files?


(MuffinMan) #7

yes and i am still working on it, after all i have almost some sort of working version of it now - loads and loads of work left though - anyway the basic functions are there - would you by any chance like to help? time is short and the project is bigger than i thought in the beginning (just as always) :bump:


(SiliconSlick) #8

The compressbrushes() function from my (Quake1) bmp2map
program does something like that. You might
be able to write a quick utility using it as a base
(provided you can program in C and can write
a quick .map parser to read the brushes in).

See the compressbrushes() function at:

http://bmp2map.sourceforge.net/archives/bmp2map6.c.txt

SiliconSlick


(Davros) #9

why dont u import your terrain into easygen, show flat triangles and then delete them. you can get flat triangles to be drawn a different color and then use a keyboard shortcut to remove them. once in radient all you have to do is add a brush to the hole in the terrain