wfowler1 / jbn-bsp-lump-tools

Just a goofy tool for messing with Nightfire BSPs. For all intents and purposes this is a dead project preserved here after Google Code shut down. The origins of the BSP decompiler project and LibBSP can be traced back here.
5 stars 2 forks source link

Decompiler is broken: Recycled planes #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The map decompiler is working almost perfectly. This is the single biggest bug 
in the current decompilation system and the greatest problem with making the 
thing work, by far.

The problem is the game engine doesn't care which direction planes are facing 
in a brush, but the map editor does. This allows the map compiler to reuse 
planes backward, saving the cost of extra planes but making the decompiling 
process that much more complicated. These reused planes cause problems when 
trying to recreate brushes with culled faces or brushes which had faces on the 
outside of the map. The solution is simple in concept but much harder in 
practice.

Given any three unique non-collinear points P, Q and R, these points can define 
a plane (P, Q, R). What the decompiler does is finds three points which defines 
the plane as given in the BSP (as a unit normal and distance D). The 
decompiler's current algorithm works for any plane which is used frontwards. 
But if the plane is used backward, the map editor treats the solid as if the 
plane wasn't there at all. What must be done is to detect if the plane is used 
backward in the context of the solid, and to flip it around. Flipping a plane 
is easy, given plane (P, Q, R), reorder the points to be (P, R, Q).

Original issue reported on code.google.com by wfowl...@mscd.edu on 30 Jun 2011 at 5:55

GoogleCodeExporter commented 9 years ago

Original comment by wfowl...@mscd.edu on 30 Jun 2011 at 6:38

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r18.

Original comment by wfowl...@mscd.edu on 13 Jul 2011 at 12:33

GoogleCodeExporter commented 9 years ago
It seems this may still be an issue, but only for maps compiled with our 
compilers. Gearbox maps decompile fine.

Original comment by wfowl...@mscd.edu on 24 Jul 2011 at 7:48

GoogleCodeExporter commented 9 years ago
If I found actual vertices of the solid (rather than simply points on the 
planes) I could intersect all the planes and make sure each one contributes to 
the solid, and if one of them doesn't then one of them needs to be flipped.

As a side effect, the coefficient option would be rendered obsolete. It would 
make the process take much longer, of course, but in an ideal world it would 
give effectively 100% decompile accuracy without any of the problems with 
invalid solids we have now.

Original comment by MofoMan2...@gmail.com on 13 Aug 2011 at 6:14

GoogleCodeExporter commented 9 years ago
Plane fixer works with planar decompile option on. Marking fixed.

Original comment by wfowl...@mscd.edu on 22 Apr 2012 at 8:42