PDA

View Full Version : Merging polys by hand


Daedalus
11-10-2002, 09:47 PM
The vertex editor in UEd1&2 is crap. You can only move vertices, but not delete any, so you can't merge polys together.

I don't understand why terrain made with TerraEdit consists of so many triangle polys, or why the 2D shape editor in UEd produces so many triangle polys on round shapes.

I mean if you have a 1 square poly (shape) then you don't need to split it into 2 triangle polys. At some certain situations you have to, but not all the time imo. And in some situations it is totally unnecessary.

If you don't know what I'm talking about then import these 2 following brushes into your map:

</font><blockquote><font size="1" face="Verdana, Arial">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">Begin PolyList
Begin Polygon
Origin -00192.000000,+00064.000000,+00000.000000
Normal +00000.000000,+00000.000000,-00001.000000
TextureU +00000.000000,-00001.000000,+00000.000000
TextureV -00001.000000,+00000.000000,+00000.000000
Vertex -00192.000000,+00064.000000,+00000.000000
Vertex +00192.000000,+00064.000000,+00000.000000
Vertex -00128.000000,-00064.000000,+00000.000000
End Polygon
Begin Polygon
Origin +00168.000000,+00056.000000,+00016.000000
Normal +00000.000000,+00000.000000,+00001.000000
TextureU +00000.000000,-00001.000000,+00000.000000
TextureV +00001.000000,+00000.000000,+00000.000000
Vertex +00168.000000,+00056.000000,+00016.000000
Vertex -00168.000000,+00056.000000,+00016.000000
Vertex -00112.000000,-00056.000000,+00016.000000
End Polygon
Begin Polygon
Origin -00128.000000,-00064.000000,+00000.000000
Normal +00000.000000,+00000.000000,-00001.000000
TextureU +00000.371391,-00000.928477,+00000.000000
TextureV -00000.928477,-00000.371391,+00000.000000
Vertex -00128.000000,-00064.000000,+00000.000000
Vertex +00192.000000,+00064.000000,+00000.000000
Vertex +00128.000000,-00064.000000,+00000.000000
End Polygon
Begin Polygon
Origin +00168.000000,+00056.000000,+00016.000000
Normal +00000.000000,+00000.000000,+00001.000000
TextureU +00000.371391,-00000.928477,+00000.000000
TextureV +00000.928477,+00000.371391,+00000.000000
Vertex +00168.000000,+00056.000000,+00016.000000
Vertex -00112.000000,-00056.000000,+00016.000000
Vertex +00112.000000,-00056.000000,+00016.000000
End Polygon
Begin Polygon
Origin +00192.000000,+00064.000000,+00000.000000
Normal +00000.000000,+00000.894427,+00000.447214
TextureU +00000.000000,-00000.447214,+00000.894427
TextureV +00001.000000,+00000.000000,+00000.000000
Vertex +00192.000000,+00064.000000,+00000.000000
Vertex -00192.000000,+00064.000000,+00000.000000
Vertex -00168.000000,+00056.000000,+00016.000000
Vertex +00168.000000,+00056.000000,+00016.000000
End Polygon
Begin Polygon
Origin -00192.000000,+00064.000000,+00000.000000
Normal -00000.596285,-00000.298142,+00000.745356
TextureU +00000.666667,+00000.333333,+00000.666667
TextureV -00000.447214,+00000.894427,+00000.000000
Vertex -00192.000000,+00064.000000,+00000.000000
Vertex -00128.000000,-00064.000000,+00000.000000
Vertex -00112.000000,-00056.000000,+00016.000000
Vertex -00168.000000,+00056.000000,+00016.000000
End Polygon
Begin Polygon
Origin -00128.000000,-00064.000000,+00000.000000
Normal +00000.000000,-00000.894427,+00000.447214
TextureU +00000.000000,+00000.447214,+00000.894427
TextureV -00001.000000,+00000.000000,+00000.000000
Vertex -00128.000000,-00064.000000,+00000.000000
Vertex +00128.000000,-00064.000000,+00000.000000
Vertex +00112.000000,-00056.000000,+00016.000000
Vertex -00112.000000,-00056.000000,+00016.000000
End Polygon
Begin Polygon
Origin +00128.000000,-00064.000000,+00000.000000
Normal +00000.596285,-00000.298142,+00000.745356
TextureU -00000.666667,+00000.333333,+00000.666667
TextureV -00000.447214,-00000.894427,+00000.000000
Vertex +00128.000000,-00064.000000,+00000.000000
Vertex +00192.000000,+00064.000000,+00000.000000
Vertex +00168.000000,+00056.000000,+00016.000000
Vertex +00112.000000,-00056.000000,+00016.000000
End Polygon
End PolyList[/code]</blockquote><font size="2" face="Verdana, Arial">^This brush I've created with the 2D shape editor in UEd (Extrude to Bevel), part of a UT1 prefab mesh. It consists of 8 polys (4 squares and 4 triangles). The 4 triangles in that brush above (the ones with the 3 vertices only) are total unnecessary for my purpose and just waste space and render time (in game).

Since there's no option or tool to edit this, I deleted the 4 triangles and merged them together into squares, saving 2 polys in effect and keeping my geometry clean. I did this with a simple text editor.

Here's the optimized brush:

</font><blockquote><font size="1" face="Verdana, Arial">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">Begin PolyList
Begin Polygon
Origin -00064.000000,-00192.000000,+00000.000000
Normal +00000.000000,+00000.000000,-00001.000000
TextureU +00001.000000,+00000.000000,+00000.000000
TextureV +00000.000000,-00001.000000,+00000.000000
Vertex -00064.000000,-00192.000000,+00000.000000
Vertex -00064.000000,+00192.000000,+00000.000000
Vertex +00064.000000,+00128.000000,+00000.000000
Vertex +00064.000000,-00128.000000,+00000.000000
End Polygon
Begin Polygon
Origin -00056.000000,+00168.000000,+00016.000000
Normal +00000.000000,+00000.000000,+00001.000000
TextureU +00001.000000,+00000.000000,+00000.000000
TextureV +00000.000000,+00001.000000,+00000.000000
Vertex -00056.000000,+00168.000000,+00016.000000
Vertex -00056.000000,-00168.000000,+00016.000000
Vertex +00056.000000,-00112.000000,+00016.000000
Vertex +00056.000000,+00112.000000,+00016.000000
End Polygon
Begin Polygon
Origin +00064.000000,+00128.000000,+00000.000000
Normal +00000.298142,+00000.596285,+00000.745356
TextureU -00000.333333,-00000.666667,+00000.666667
TextureV +00000.894427,-00000.447214,+00000.000000
Vertex +00064.000000,+00128.000000,+00000.000000
Vertex -00064.000000,+00192.000000,+00000.000000
Vertex -00056.000000,+00168.000000,+00016.000000
Vertex +00056.000000,+00112.000000,+00016.000000
End Polygon
Begin Polygon
Origin -00064.000000,+00192.000000,+00000.000000
Normal -00000.894427,+00000.000000,+00000.447214
TextureU +00000.447214,+00000.000000,+00000.894427
TextureV +00000.000000,+00001.000000,+00000.000000
Vertex -00064.000000,+00192.000000,+00000.000000
Vertex -00064.000000,-00192.000000,+00000.000000
Vertex -00056.000000,-00168.000000,+00016.000000
Vertex -00056.000000,+00168.000000,+00016.000000
End Polygon
Begin Polygon
Origin -00064.000000,-00192.000000,+00000.000000
Normal +00000.298142,-00000.596285,+00000.745356
TextureU -00000.333333,+00000.666667,+00000.666667
TextureV -00000.894427,-00000.447214,+00000.000000
Vertex -00064.000000,-00192.000000,+00000.000000
Vertex +00064.000000,-00128.000000,+00000.000000
Vertex +00056.000000,-00112.000000,+00016.000000
Vertex -00056.000000,-00168.000000,+00016.000000
End Polygon
Begin Polygon
Origin +00064.000000,-00128.000000,+00000.000000
Normal +00000.894427,+00000.000000,+00000.447214
TextureU -00000.447214,+00000.000000,+00000.894427
TextureV +00000.000000,-00001.000000,+00000.000000
Vertex +00064.000000,-00128.000000,+00000.000000
Vertex +00064.000000,+00128.000000,+00000.000000
Vertex +00056.000000,+00112.000000,+00016.000000
Vertex +00056.000000,-00112.000000,+00016.000000
End Polygon
End PolyList[/code]</blockquote><font size="2" face="Verdana, Arial">^This edited brush is the same like the first one, but with one exception: the 4 triangle polys are deleted and merged into 2 square polys, resulting in a total polycount of 6 now. images/icons/smile.gif

Compare those 2 brushes, if you like, and import them into your map. Paste each of the blocks above into a file, call them prefab1.t3d and prefab2.t3d for example. Then in UEd click on menu "Brush/Import..." to import each of the brushes. Your red builder brush will be replaced each time. Use Perspective view to see their vertices and nodes, you can see how those 2 brushes differ. Oh, and don't worry about the rotation (it's the same brush).

So much for this demonstration. I really miss an option in UEd or a tool with which you can merge polys together. Doing this by hand on such small brush like that above costed me so much time. Now imagine I'd need to edit a terrain brush consisting of 2000+ polys. IMPOSSIBLE! images/icons/frown.gif

Some smart programmer should code a poly editor which visualizes t3d exported brush files and lets the user move/delete vertices and nodes... THAT'S the definitive tool I'm waiting for.....

Bean
11-10-2002, 10:17 PM
with triangles, maybe they were anticipating the future hardware wise?
in software, i can see how the merged brush can be rendered faster. less polys on screen = better frame rate because of less cpu transform ( which is slow to begin with).

for the new engine, static meshes (hardware brushes) need the polys split into triangles to be useful/work. so, if you create something in the 2d editor, and later convert to a mesh, it will work correctly.
this really is all moot since bsp is rendered MUCH faster nowadays because of the changes to the bsp structure (bsp doesnt occlude, which in turn each poly doesnt need to create a dozen portal cuts, in turn doesnt need to calculate the player's frustrum, etc...).

Daedalus
11-10-2002, 11:41 PM
Well, I admit that there won't be much difference in frame rate when you use the first brush or the edited one. But if you use the first brush then your polycount will raise +8 each time when you add/subract it into your world or a fragment of a bigger static mesh. But the edited brush raises your polycount by +6 only (the absolute minimum).

I came to the conclusion that when I first create myself some reasonable, clean prefab brushes - with polycount as minimum as possible - and later use them to add/subtract my world with it or to use them as fragments for creating static meshes then I will end up with faster maps. That's the whole idea.

I believe that you could make static meshes - consisting of 600+ polys for example - make a lot faster by merging triangles into squares or by unsplitting squares and deleting the triangles. Some of the jobs can be done with deintersecting in UEd, but the rest needs to be done by hand.

The optimized mesh could have 300 or less polys then. Imagine how fast your maps would render in that case, even in software mode. And your static mesh would look the same as before in game.

It's a hard job creating high-detailed geometry with less polycount as possible and with preventing BSP holes to a maximum degree at the same time. Special tools could make this job easier and quicker, however.

[ 11-10-2002, 11:48 PM: Message edited by: Daedalus ]