c-d-a / io_export_qmap

.map exporter for Blender
GNU General Public License v3.0
84 stars 18 forks source link

Feature Request - Export Brushes from disjunct surfaces in one Mesh #6

Closed MoritzJT closed 1 year ago

MoritzJT commented 1 year ago

When exporting terrain to TriSoup Brushes it becomes very hard for blender to handle more than a few thousand individual meshes.

Since backfacing pyramideon extrusion costs a lot more .bsp filesize and collision planes - I've decided to go with TriSoup for terrain extruded on Z and snapped to grid otherwise.

When exporting this mesh I have to split up each of these brushblocks by using separate by loose parts. This process alone takes about half an hour.

I was wondering if it's feasible to have the exporter create brushes from discjunct convex surfaces inside the mesh - skipping the split by loose parts workflow - however not in a sense that the plugin overtakes this process, but can avoid it alltogether - saving on time.

c-d-a commented 1 year ago

In Blender, you can "Mesh -> Split -> Faces by edges", then extrude, then flatten on Z, flip the normals, and then finally split by loose parts. Unless you're hitting your RAM limits, this should take about a minute all in all (need about 10 gigs to split up 16k faces). It's a bit of extra effort, but you remain fully in control, whereas I'm not sure how the exporter should decide where to put the flattened verts, or along which axis to extrude. I don't suppose you intend to flatten the verts by doing a 16k-brush clip operation afterwards?

I think that this is, overall, a valid use case, and I could at least match obj2map by offering extrusion - along normal or optionally along Z. Still, you should clarify if this is what you meant, as I don't see this taking half an hour manually.

c-d-a commented 1 year ago

I have added more export options in https://github.com/c-d-a/io_export_qmap/commit/c319b8359c83f51d29c9abc7ea76461d9f4b051e & https://github.com/c-d-a/io_export_qmap/commit/d25a6e0dd157492cf9c1bafaf617ee292eabadca I'm going to assume I got the idea with terrain right and close this. But it occurred to me that you may have meant automatic decomposition into convex shapes. That's beyond the scope of the exporter, but you may be interested in this instead: https://github.com/andyp123/blender_vhacd

MoritzJT commented 1 year ago

Thank you again for that impressive last update! The new variant really makes quite a few steps so much quicker already.

Can you provide an example of a nurbs object in blender giving valid export topology? I've not yet managed to export a nurbs object.

c-d-a commented 1 year ago

There was a bug preventing export of patches with the grid set to anything other than zero, now fixed.

Other than that, the rules are the same as when creating a patch in Radiant: odd number of points in both directions, must be higher than one (i.e. a cylinder is at least 3 points high). Patches with fixed subdivision (patchDef3) are only expected in Doom 3 format maps, I think.
The NURBS tooltip in the addon's export dialog has some tips as well, about 3x3 order, ticking Bezier and Endpoints, and about weights. Blender assigns custom weights for circle points, but every point of a patch has equal weight, so these won't be preserved.

Examples: nurbs.zip blender netrad