I've been working on a program that derives brushes from VMF files, and in order to avoid having to find this information yourself, I decided to put it all together. Bear with me if any of this information is incorrect as I still haven't finished my program yet.
Now you'd think the brushes would be stored as the vertices for each face, but they actually aren't. Instead, Valve decided to store the faces as infinite planes derived from 3 selected vertices on each face.
Here's the algorithm I have thought up that determines the vertices of each face. All the in between math is done by normals, which must be computed in the correct order, cross products, and solving sets of equations with two variables.
[t]https://dl.dropboxusercontent.com/u/43307106/vmf2/1.png[/t][t]https://dl.dropboxusercontent.com/u/43307106/vmf2/2.png[/t]
[t]https://dl.dropboxusercontent.com/u/43307106/vmf2/3.png[/t][t]https://dl.dropboxusercontent.com/u/43307106/vmf2/4.png[/t]
I dont know how much I can help you out with this, or find a use for it myself, but I did notice that you said concave faces, and surely you mean convex faces?
[QUOTE=Shirky;41232067]I dont know how much I can help you out with this, or find a use for it myself, but I did notice that you said concave faces, and surely you mean convex faces?[/QUOTE]
This wasn't really for help. More just as a resource, and yea I meant convex, not concave. I haven't brushed up on my geometry in some time but I'm figuring it out.
I actually wrote all this up really quick just to show it to a friend, and since I already had it, I thought I might as well post it here.
Care to post the code you're using to get from [I]"plane" "(x[SUB]1[/SUB] y[SUB]1[/SUB] z[SUB]1[/SUB]) (x[SUB]2[/SUB] y[SUB]2[/SUB] z[SUB]2[/SUB]) (x[SUB]3[/SUB] y[SUB]3[/SUB] z[SUB]3[/SUB])"[/I] to a table / two-dimensional array of all the vertex coordinates for the solid?
[QUOTE=Mozartkugeln;41253753]Care to post the code you're using to get from [I]"plane" "(x[SUB]1[/SUB] y[SUB]1[/SUB] z[SUB]1[/SUB]) (x[SUB]2[/SUB] y[SUB]2[/SUB] z[SUB]2[/SUB]) (x[SUB]3[/SUB] y[SUB]3[/SUB] z[SUB]3[/SUB])"[/I] to a table / two-dimensional array of all the vertex coordinates for the solid?[/QUOTE]
Still working on it I'm afraid.
[QUOTE=Terrenteller;41286434]Not to steal your thunder, but I've solved this problem a few months ago. Have some poorly documented code.[/QUOTE]
No thunder stolen. This is a resource to help people.
I can't believe how similar your code is to mine though. What libraries did you use?
GLM for vector math and Qt for everything else.
[url=http://www.riintouge.com/temp/Currently55.jpeg]Picture[/url]
Finally finished MY program, at least the planes to mesh part of it. I still may need to optimize it more.
Also, I put comments in it, unlike Terrenteller! :v:
[url]http://pastebin.com/fW94NimL[/url]
[img]http://puu.sh/3tY1G.png[/img]
Sorry, you need to Log In to post a reply to this thread.