Monthly Archives: May 2015

On face selection pipes and beziers …

General :

Sometimes the things that seem easy turn out to take a long time. In this particular instance drawing nice lofted tapering pipes that follow B├ęzier curves. Wont go in to much detail as it is long and tedious but it took about 3 days to get that working properly. Problems with non convex polygons and other issues are not as simple as it would seem to resolve. This is a bit of a long post and I have been putting bits in to it for a few days.

Questions:

Yes you can make your own objects now via the editor window but no documentation is available yet! Yes you can save your projects to. No you cannot do user registration just yet. Accounts however can be requested.

At a few presentations I have done now people have asked me what the difference is between a parametric system and a procedural system. Here is the definition for those who asked at my last one. My answer is that one of these is a system and the other is a way of addressing that system.

“Procedural modeling is an umbrella term for a number of techniques in computer graphics to create 3D models and textures from sets of rules. L-Systems, fractals, and generative modeling are procedural modeling techniques since they apply algorithms for producing scenes.”

That is what we are doing here. Using small bundles of rules to build things!

Now a procedural modelling system may present either a classic in-scene interface involving sketches and drawing tools -or- it may present a parametric interface that consists of primarily skeuomorphic tools that are geared towards specific higher level tasks. The design pressure tends to lead to a bit of both but seldom just one or the other dominates the user experience completely.

Makertron:

When developing a procedural modelling system the temptation is always to step in to the scene with tools and to eschew the parametric approach. Last week I was thinking about individual face selection. Consider two objects in a 3D scene. Say a tea pot spout and the surface of the body of a tea pot. You want to join the two together by selecting a face on the teapot and attaching the spout to that point. In a traditional cad tool you would define a sketch plane. Then you would draw a profile in that sketch plane. Constrain it. You might draw other planes that contain a curve. Then you might apply a lofting function of some kind. In a good well developed tool with a decent legacy behind it this can all work very nicely. This is the kind of task that naturally leads to scene driven in-scene tools. While it is easy to procedurally define for example a bicycle frame. It would appear at first glance to be not so easy to deal with objects on a point by point basis or on an implied solid basis.

So what might we do in a procedural fashion that performs the same task?

What might we do that doesn’t involve entering the scene at all?

One way is to provide dynamic projection through a model on to a 2D plane so that you can interact with the points projected in to that plane in a canvas.

Consider a sphere with a plane cutting through the Centre like so.

Sphere_intersection

Your projection will ultimately consist of a point where every single polygon passes a line through the plane.

In your canvas you now in essence have a 2D drawing task easily addressable by various widget approaches. You can move points. Bind other points to them. Track points as they move. Then when you have performed your operations you can transport that association back out in to changes in the scene. Note how this begins to sound like you are just reinventing a part of the scene itself in another scene. You have merely taken a slice of the scene. That starts to sound like sketches. Note that it is implied that you would reach in to the scene in some way and move the plane or perhaps interact with it with parametric inputs. As you did so wherever objects in the scene passed through that plane would project in to your 2D canvas and that it would update accordingly. Following on from this you could then interpolate between points to dock to points on the model that were sub vertex and select those to. You could also do interesting operations with unions and subtractions and intersections this way.

So to explore this idea I wrote a plane intersection parser that is now available in the Makertron. If you define a plane within the json code it will give you back a 2D canvas to manipulate in various ways. You can overlay it with a bezier as a point guide. Bind a point so it will be followed. You can pick projected vectors out of a canvas.

And you know what. Once I had written this tool I realized it was the wrong way. This is the wrong approach to these problems. Wrong. Deeply wrong!!!

This is at the core of choosing a different way. Pretty much everything you might want to do is in the scene or involves interaction in the scene. Or does it really? The reality is pretty much every interaction you have with a scene also involves an interaction with a set of widgets that drive that scene. This is the elephant in the room with all scene based modelers. Draw a circle in a sketch in Solidworks. Behold the sudden appearance of the parametric dialog majesty! Since the 1970’s CAD tools have followed a drafting legacy and rightly so. The metaphors are all here. Dimensions. Sketches. Constraints. The purpose of these tools was not to assemble complete finished models for output to production but to provide clear drawings and dimensional information for translation in to DRAWINGS for production. Drafting is a skilled and time consuming job. The tools are heavy. The learning long.

So what does the procedural looking alternative look like?

Firstly you don’t have to reach in to the scene at all. The thinking changes here. What is a collection of points on a model?

It is a list. As a list you can select locations on a model in any number of ways. Distance based or simple indexing. To find things in a model it really isn’t necessary to understand the solid nature of a model. What it intersects with. What it does not intersect with. All you need to understand is that it has another nature and that it can be addressed that way. In a procedural world everything has an abstraction beyond the scene. Everything is data and everything is code and is bound by rules. Everything is ultimately approachable as a structure. As a list.

So for example the parametric alternative here is simple and elegant. Two thumb wheels. One thumb wheel moves up through each segment of the sphere highlighting as you go. The other rotates radially picking a point on that segment. You can find any point on the sphere in a second. No clicking or hunting required with the mouse.

And then as we go down this path it gets even more interesting. Do we really need to always bind objects at all. Well not always. Unlike the bicycle example the tea pot demo has no bindings at all. Objects merely float and where they union each other intersections or joins are created as appropriate.

Things just keep getting simpler and simpler. Oh wait no they do not! And in further adventures this happened NEXT …

—————— The Ungodly Bezier Of Doom ———————-

Here are some images from the past few weeks of a long bug filled csg nightmare saga that has ultimately concluded with something solid.

tea_pot

tea_pot_kill

teapot

tricky_problem

Drawing smooth Bezier path pipes.