Author Topic: The models have too many vertices  (Read 8690 times)

yousuck

  • Posts: 3
  • Turrets: +0/-0
The models have too many vertices
« on: August 11, 2010, 07:00:51 pm »
The majority of trem models have too many vertices (points where edges connect). Some have even what seems like double, or worse. I'm betting this is what could be causing some performance issues with Trem.

To find out what I mean:

Get Blender 2.49b

Get http://johnny3d.promail.ca/blendermd3.zip to import/export md3 files. Extract the files to the .blender/scripts/ folder.

Now you'll have to use a pk3 extractor like Pakscape on windows, something else if on Linux.

I suggest pulling out the md3s from the model/buildables or /players/human_base folders and putting them into the .blender folder.

Open up Blender. Right click the square (it's actually a cube looking down from the top), and hit the delete key and click delete. Same with the light (the circle to the upper right) and the camera (pyramid in the lower right, you may have to zoom out with numpad - to see it)

File, import, Quake3 (.md3), and it starts in the .blender folder, so if you put your files right there, open one. For the turret or human, you need to start with the base, then the middle, then the highest

You'll have to zoom out with numpad -. The numpad controls the camera in Blender.

Nothing should be selected, if it is hitting the a key twice should fix it (select all, deselect all). Now right click the model once, hit tab to toggle object/edit mode, then hit a.

Now if you hit w, and left click on remove vertices, it'll remove a LOT of them. Removing vertices from the human legs removes 91 extra vertices. Just the human torso removed 101 duplicates. Battery pack removed like 10, and armor removed a whopping 34, which was likely one or two entire duplicates.

Another way to see the duplicate vertices, is start grabbing at them by holding right click in edit mode, and then moving them around (you can release right click after they start moving).

If you've grabbed a bad vertex, it may be only connected by ONE LINE to an important vertex, or it may move a face, but the face actually has edges that don't connect. (This is a little complicated to explain. If you took two same size triangles, and overlapped one of the edges, that's different than making a diamond and cutting across it. In the previous case, moving one of the vertices of the triangle wouldn't change the other triangle, 6 vertices that aren't completely connected, while with a diamond with a line across it, only 4 vertices would make the whole shape change if you moved one vertex. The latter, diamond way, is more beneficial for models, as it prevents light issues and visible "surface decoupling" from happening, as well as simpler.)


Note, I can't seem to export the models back to Blender (out of place, no textures, no animations), but they'll load in other MD3 games, like Sauerbraten. Does Trem use some sort of horrible bastardization of the md3 format?

freezway

  • Posts: 196
  • Turrets: +10/-12
Re: The models have too many vertices
« Reply #1 on: August 11, 2010, 07:30:53 pm »
Wow, I didn't realize they had so many dup. vertices..... Wait, where are you getting the md3's? If I look in the data pk3's I only find .cfg's!
« Last Edit: August 11, 2010, 07:48:57 pm by freezway »

Sex

  • Posts: 9
  • Turrets: +7/-3
Re: The models have too many vertices
« Reply #2 on: August 11, 2010, 07:48:13 pm »
MD3 mesh faces are split where the uv map splits and sometimes the modeller wants creases to make sharper edges. The result is duplicate vertices and faces that aren't connected.

freezway

  • Posts: 196
  • Turrets: +10/-12
Re: The models have too many vertices
« Reply #3 on: August 11, 2010, 07:49:30 pm »
So, do they have a purpose?

yousuck

  • Posts: 3
  • Turrets: +0/-0
Re: The models have too many vertices
« Reply #4 on: August 11, 2010, 08:18:02 pm »
I'm trying to get an old model of Blender (version 2.43). It appears the scripts may be far-outdated, and certain commands/whatever aren't the same as the current stable Blender. (2.49)

Hopefully that might fix some issues. (I tried importing&exporting an md2 from a different game - and got errors, so the scripts are likely old).

CreatureofHell

  • Posts: 2422
  • Turrets: +430/-126
    • Tremtopia
Re: The models have too many vertices
« Reply #5 on: August 11, 2010, 10:44:40 pm »
I'm betting this is what could be causing some performance issues with Trem.

You can't be serious...Tremulous plays on almost any machine and now you say there are performance issues?
{NoS}StalKer
Quote
<Timbo> posting on the trem forums rarely results in anything good

Fox One

  • Posts: 19
  • Turrets: +6/-0
    • recursiveloop.oi-share.com
Re: The models have too many vertices
« Reply #6 on: August 12, 2010, 01:50:36 am »
The duplicate vertices are a necessity of the MD3 format, unfortunately, because the format does not have any other way to store seam information. Seams are used to mark where the 3D mesh surface is split into individual UV map sections. If you want to see how this is working, after importing a model, split your 3d window into 2 and then switch the second one to UV/Image Editor mode. In the 3d window, tab to Edit mode and then select however much of the model you want. You will see the UV map sections appear in the UV/Image Editor window.
Another interesting fact, as was also mentioned before, is that the game engine automatically attempts to smooth continuous mesh areas, so any edges that share vertices will be shaded as if they are rounded or smooth. If you absolutely want a sharp edge in a certain area of the model, you have to make that edge a seam.
In Blender, if you are creating a new MD3 model, you do not have to physically split the model into the UV sections that you want. You can use Ctrl+E > Mark Seam. The exporter script will translate any marked seams into separate edges (with duplicated vertices).
But basically, yeah, it's an unavoidable requirement for duplicate vertices to exist in MD3 files.
It should be also be noted that a difference of a couple hundred vertices is not really enough to affect performance on any relatively modern (within the past decade) machine. Thousands of vertices might make a difference, but more likely performance issues are caused by special shaders that cover large areas or whole models and use multiple combined layers.
Quote from: yousuck
Note, I can't seem to export the models back to Blender (out of place, no textures, no animations), but they'll load in other MD3 games, like Sauerbraten. Does Trem use some sort of horrible bastardization of the md3 format?
Assuming you mean that you tried importing the models into Blender, then exporting them to new *.md3 files, "out of place, no texures" sounds like file path trouble, probably because you didn't set the proper relative file path during your export. The animations were not included because, if you want to export an animated md3, you must do so from the last frame of the animation; use the left/right arrow keys (while in the 3d window in Object mode) to move through the frames stored in the model.

Also, I believe the import/export scripts in the Xreal trunk ( http://xreal.svn.sourceforge.net/viewvc/xreal/trunk/xreal/blender/ ) are the most up-to-date. I used them during the Spitfire creation process, so they work just fine.
« Last Edit: August 12, 2010, 02:07:23 am by Fox One »
"Give me the liberty to know, to utter, and to argue freely according to conscience, above all liberties." ~John Milton, Areopagitica


Stannum

  • Posts: 336
  • Turrets: +108/-321
Re: The models have too many vertices
« Reply #7 on: August 13, 2010, 10:55:27 pm »
The duplicate vertices are a necessity of the MD3 format

"Duplicate" verts are required for any model format that has a single texcoord per vertex.
Blue © 2004 Natural Selection.

gimhael

  • Posts: 546
  • Turrets: +70/-16
Re: The models have too many vertices
« Reply #8 on: August 14, 2010, 06:18:03 am »
And even if the model format supported it, you'd have to split these vertices for OpenGL anyway.