Stream: brlcad

Topic: NMG nurbs


view this post on Zulip starseeker (Apr 27 2025 at 02:18):

Hey @Sean , question - would it be possible to move whatever minimal subset of data structures are needed for bspline input into the bspline primitive implementation, and deprecate nurbs support from libnmg? Since we can read old bsplines into breps, and that's the new direction, I'm thinking we might want to put together a plan for how we might be able to simplify the code.

view this post on Zulip starseeker (Apr 27 2025 at 02:20):

As it stands I'm not really able to work effectively with the libnmg code, and it would be nice to do something about that long term, but from 30,000 feet it looks as if the first step would be to phase out the nurbs logic (or migrate anything we don't already have to libbrep, if there is anything value add there) so it's easier to work with the planar/polygon logic.

view this post on Zulip starseeker (Apr 27 2025 at 02:22):

One of the things I'd really like to do would be to replace the NMG boolean algorithm with Manifold, deconstructing to triangles for the booleans and reassembling polygons after the evaluation, but that's a tall order right now :-/

view this post on Zulip Sean (Apr 28 2025 at 07:33):

@starseeker Biggest issue I can think of is that the bspline conversion to OpenNURBS has some problems, often doesn't work. It was a quick and dirty demo. Ray tracing and conversion only sometimes works, if that particular model was luckily encoded in a particular way expected.

I wouldn't think it makes sense to chop away at libnmg unless the long-term plan is to keep it. Otherwise, that's just going to potentially introduce bugs in cases that are currently working. They'll of course be unexpected too, and likely discovered well after the damage is done.

view this post on Zulip Sean (Apr 28 2025 at 07:42):

I'd like long-term plan to be driven by numbers, conversion statistics. If we establish (and ideally expand) a CI conversion corpus, then nmg's replacement or enhancement will be apparent.

I'm doubtful manifold will produce a better result any time soon, just from the geometry theory perspective (we will have already thrown away surface intersection information at the time of boolean eval), but if/when the numbers show vastly superior conversion statistics, that would easily justify a decision. The same issue holds with stripping the nurbs boolean eval logic. It's large and complex, and potentially replaceable by manifold, but I know from a theory perspective it will likely be inferior -- it's value is more in cases that fail as a backup method. Same should hold true for nmg, but it all of course depends. We can likely contrive examples in support of either direction -- hence my inclination to let it be data-driven, user-centric.

view this post on Zulip starseeker (Apr 28 2025 at 10:22):

Hmm. Maybe a good student/gsoc project topic would be to get robust bspline->brep conversion working.

view this post on Zulip starseeker (Apr 28 2025 at 10:23):

Compared to the raytracing part of NURBS I would expect that to be a lot more tractable, since its a data translation problem rather than an analytic problem.

view this post on Zulip starseeker (Apr 28 2025 at 10:23):

If the long term plan isn't to keep libnmg that's another discussion, since it is deeply embedded in things like the individual primitive tessellation routines.

view this post on Zulip Sean (Apr 28 2025 at 14:30):

starseeker said:

Hmm. Maybe a good student/gsoc project topic would be to get robust bspline->brep conversion working.

Possibly. That'd likely require someone with 4+ years CS background, not terribly common. And not just a coding issue, have to understand what the data represents (e.g., should the knots be replicated or not? what about the starting and ending cv's?).

view this post on Zulip Sean (Apr 28 2025 at 14:32):

starseeker said:

If the long term plan isn't to keep libnmg that's another discussion, since it is deeply embedded in things like the individual primitive tessellation routines.

Kind of was making the opposite argument -- personally, see little value aiming to purge libnmg long or short term. I think we should keep/maintain/improve it (at least foreseeable future). I just wouldn't be terribly opposed if the stats for an alternative were compelling or if manifold takes over more of its feature space.

libnmg has significant value in my perspective both from a theory and implementation perspective, but undeniably complex code. It takes a LOT of mental effort to get it all in context to make meaningful improvements. Easy to make a faulty assumptions that makes things worse (Richard). We've already tempted fate repeated with mods that only resulted in less end user capability (typically bugs and added failures that we discovered later).

view this post on Zulip starseeker (Apr 28 2025 at 23:00):

That's basically what I was hoping to do - replace the nmg boolean with Manifold's. There are some features the Blender folks are interested in related to tracking face IDs and such that might be very useful when it comes to reassembling an NMG from the triangle boolean output, although I've not experimented with it myself.

However, since the libnmg nurbs capabilities are (in my mind anyway) not where new development should be aimed, I'd still like to phase them out have have libnmg just be a polygon/planar focused library with libbrep taking on the nurbs responsibilities.


Last updated: May 23 2025 at 00:54 UTC