Them nurboid thingy's

  • Stephen Parry

    Stephen Parry - 2016-10-06

    Talking to you guys puts me in the (for me) unusual place of being completely outclassed on the maths and programming front,but I am hoping I can get somwhere with this with your help.

    I am working on the vector rendering plugin. In addition to just trying to do some simple version related fixes to the existing codebase, I am also trying create a new version with some new ideas e.g. a new approach to generating the SVG representation of the trimesh facets. Instead of requesting a render mesh to a specfied tolerance, I want to try and project the actual shape of each facet into 2D, fitting beziers to the curved profile of the facet. This along with clever use of gradients should drastically cut the polygon count and deliver an accurate render (I hope!). This would be fine if I understood the maths. What is the mathematical representation the trimesh uses please? Any hnts on how I might fit a quad or cubic bezier to the projected facet?

  • Luke S

    Luke S - 2016-10-07

    You may not be as out-classed as you think, at least by me. I'm at the level where I need to look up anything beyind basic algebra.

    Both Peter and Petri are better at math. (Peter does it for a living, I believe)

    On to Triangle Mesh:

    The underlying math for a trimesh depends on what smoothing method is being used. Per notes in the source, an interpolating mesh generally follows this paper,
    and an approximating mesh This one.

    (Warning! PDF downloads!)

    The aproximating mesh, in particular, is a generalisation of b-splines. This means that you cannot take a single face or edge in isolation and calculate a smooth version. Instead, you need the surrounding mesh data as well.

    I have not spent a lot of time on the math and concepts, but it may actually be simpler to generate a rendering mesh, and then run over that mesh, and generate a new, simplified set of vector curves to represent it.

  • Stephen Parry

    Stephen Parry - 2016-10-07

    Thanks Luke, helpful as always! That was one of the approaches I was considering. It requires creating less dependencies between the main code and the vector part. Thanks for the links, I'd not found those. I'll let you all know how I get on.

  • Peter Eastman

    Peter Eastman - 2016-10-07

    it may actually be simpler to generate a rendering mesh, and then run over that mesh, and generate a new, simplified set of vector curves to represent it.

    That's exactly what I'd do. Trimeshes are subdivision surfaces. That means the shape is entirely defined by the rules for subdividing it. The limiting surface that it converges to will often not be any kind of polynomial surface. So your best bet is just to subdivide enough that you get a pretty high resolution version of the surface, then fit splines to that at whatever level of accuracy you require.

  • Pete

    Pete - 2016-10-08

    One more comment on the subdividing (a bit out of topic, I admit):

    What I have noticed is that when the subdivision medhod is Approximating you can grind the curves/surfaces into dust and get a relly smooth outcome. It'd probably be relatively easy to fit mathematical presentations into that.

    With the Interpolating subdivision, each round of subdivision seems to "overshoot" or "undershoot" the location of the subdivided points, depending on the angles and distances before it. In many cases this tends to produce a more or less bumpy result and you can not really help it. Some time ago I had a look at ways of doing something about it in the case of curves, but it seems that all the ideas that I could come up with would have some downsides to them. (Eventually I probably forgot about it, when I thought I was beginning to get somewhere...)

    I'm not saying it would be impossible, but finding a "fool proof" alternative intepolatin method without having to at least select between a few different methods turned out not to be that simple, starting with having to make the decision or at least set some limits to, how it should behave in any given situation.

    Having said that, vector graphics should provide interesting possibilities, not just in rendering pictures but also for example in converting graphics into CNC data (I assume sometimes somebody would want to do that...)

  • Peter Eastman

    Peter Eastman - 2016-10-08

    That's the reason approximating surfaces are much more widely used than interpolating ones. In the literature, this property is known as "fairness": basically, the interpolation should never create new features that weren't present in the original control mesh. Approximating surfaces can guarantee that, but interpolating ones can't.

  • Pete

    Pete - 2016-10-08

    basically, the interpolation should never create new features that weren't present in the original control mesh.

    And it still does.... Somehow, after writing the above I managed to produce an example, that surprised myself too... I can't post that piece just now. I have things to do.: Go soak myself in the sauna, go listen to a band, get drunk, suffer the hangover.... But after that maybe ;) (= I need to make sure it's repeatable)

  • Stephen Parry

    Stephen Parry - 2016-10-09

    Problem is that, if you are dealing with a dimensional accurate representation of a real world object, interpolation is much more useful, because the surface will pass through points you have actually measured or defined.

  • Pete

    Pete - 2016-10-09

    To that we'd need some kind of a CAD-module. Some ideas were discusse a few years ago, but that'd take some programming, that nobody has done so far. ....

    Actually I think, what actually would do the job is somethong that could be called eg. "True Geometry Object" (TGO) or "Accurate Geometry Object" (AGO), where there would not be any smoothing methods, but the rendering meshes would be generated directly into the mathematical surfaces.

    With simple objects (like an extruded shapes) that'd probably be even easy. The objects would then be rendered basically as primitives. Then of course for anything with proper editing capabilities it would become a massive project. For example just making corner fillets would easily become a huge jungle of special cases....

  • Peter Eastman

    Peter Eastman - 2016-10-09

    To some extent we already have that. All the primitives like spheres and cylinders work like that. Also, interpolated smoothing is somewhat more useful with spline meshes than with trimeshes. But of course, those are much more limited in what they can represent. If you want to represent arbitrary shapes and interpolate your control mesh and have a very smooth surface... as far as I know, that's an unsolved problem.

  • Pete

    Pete - 2016-10-09

    All the primitives like spheres and cylinders work like that.

    Yes. My point exactly :) Those priciples could be recycled (I think) into an object that could be 'engineered' to the user's needs.

  • Luke S

    Luke S - 2016-10-12

    @Pete the issue is that this gets to be mathematically difficult. Lots of number crunching. For a mathmatically perfect surface, you might be able to generate an object put together out of fairly simple curves. The trick is to be able to calculate a ray intersection reliably in just a few steps. I suspect that it would be posible with a surface generated from a quadratic curve, but not much more than that.

    Some of the things that you and Stephen seem to be looking for (ability to have both a fair, predictable surface and points set to very specific, precise dimensions) might be bet by a mesh of quadratic or cubic Bezier Patches. I started working on such a thing a while ago, and just lost steam on it.

    Anyone interested?

  • Pete

    Pete - 2016-10-12

    @Pete the issue is that this gets to be mathematically difficult. Lots of number crunching.

    I'd expect that and probably it'd not be necessary to use the mathematically correct surfaces for rendering every time but that'd be a nice option to have available. Assuming a CAD-like approach, the starting point would have to be based on straight lines and circle arches, which should make life a bit easier for a while.

    I had a look at some alternative curve smoothing methods around the time when we were looking for that bump in animation, but all ideas I could come up with had some kind of a problem in some cases. Bezier curves/surfaces seem to make a good candidate but they need to be defined differently form what currently is available in AoI code...

  • Peter Eastman

    Peter Eastman - 2016-10-12

    Bezier curves have their own issues. Strictly speaking, they're also approximating curves, but they interpolate every third control point. So they stay closer to the control mesh, but it's challenging to position the extra handles to give a specific precise shape. Also, they're only C1 continuous (compared to C2 for approximating curves), so they don't look as smooth.

    But the really big issue is that they're splines rather than subdivision surfaces. That means it's a lot harder to handle arbitrary topologies with them.

  • Luke S

    Luke S - 2016-10-13

    Been doing a little bit of research. There are a few papers out there that discuss improved versions of butterfly and Loop subdivision. They specifically talk about getting fairer surfaces from sub-optimal control meshes (non-uniform triangle sizes and long, narrow triangles)

    I think that to use any of it, I would have to put in about as much time as a college student is supposed to spend on a semester's worth of math classes, and even then, I would have to back-port AOI's unique 'variable edge hardness' settings.

    I did not mean to imply that a Bezier mesh would be a great general purpose mesh. There may be some modeling tasks where it is easier to use, though.

    If I'm understanding things correctly, a composite cubic Bezier does not even guarantee C1 continuity, though it would be easy enough to enforce with a simple constraint on opposite pairs of control points. Its also possible to evaluate such a curve for C2 continuity, but constraints to enforce it would mean that tweaks to a control point will propogate to at least the neighboring two segments. I'd have to play with that one.

    Topolgically, one would fit the patches together as if they were quad faces.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks