Game Development Community

The thee points that define a plane

by Adib Murad · in Constructor · 04/05/2007 (5:00 pm) · 3 replies

Just saw Constructor announcement. Since I've been out of GG for a while, I made a search thru the blogs and found this old entry:

http://www.garagegames.com/blogs/985/10765

The CSX features table has this footnote:

[2] - Brushes whose vertices (...). The first three vertices are used to calculate the face's new plane and it is this plane that is saved.

Did ancient CSG gods answer my modelling prayers?

Let me see if my English is enough to explain it clearly. In every CSG modelling tool I tried so far there is a flaw when a brush is all made of surfaces not parallel to either XY, YZ or XZ.

Try to model a donut in Hammer, for example. It will be made of many brushes, right? Each brush is a "slice". Make it big as a character would walk thru the hole and place it standing up, as if it was a car tire. Now export it to Torque, press F9 and look the alignment of the brushes.

There will be misalignments, no matter how carefully and snapped to grid you modelled them. Once I modelled a fast food restaurant that looked like a giant burger. The roof was a sandwich bread, made of just one brush (half a sphere). The brush exported successfully, but many of its surfaces didn't touch themselves correctly.

In Hammer you don't even need to export to Torque: just open the donut RMF file you made. The model looks perfect. Now save it and open the generated MAP file. You'll see alignment flaws between brushes, caused by the surfaces that don't belong to any orthogonal plane.

Apparently these softwares make a bad choice of the three points to define these non-orthogonal surfaces, loosing precision and causing misalignments between brushes that kill your model.

If you open the MAP file in notepad, find the messed planes' definitions and re-define them by three of their vertices, this MAP will generate a perfect brush in Torque!

So, when I read "the first three vertices are used to calculate the face's new plane" I almost wheeped like a little girl. Many things will be possible if I got it right. Did I?

#1
04/05/2007 (5:17 pm)
It does indeed use 3 vertices from the face. I beefed up the code quite a bit to try and make sure that the 3 vertices it picks are 3 of the best (not too close together for example).

I've been able to export some pretty complicated .map's and get them back in nearly perfect form every time =)
#2
04/05/2007 (5:19 pm)
If the donut image is not clear enough, imagine a giant ring made of stone, like a tire of The Flintstones' monster truck. Imagine it's thicker at the border and thinner at the center. And it's standing up, like lying against a wall.

Now, go to Hammer, put the brushes together, export it and take a look in-game. Misalignments...
#3
04/05/2007 (5:23 pm)
Wow, the man is quick to answer!! Thanks a lot, Matt.

Now, the waiting... Surely will try it out and post what I can get about this thing.

Again, congrats.