Dev:Ref/GoogleSummerOfCode/2005/Sketch Based Modeling

提供: wiki
移動先: 案内検索

Welcome to my [[1]]|blog|at|Blender's|wiki.|If|want|to|follow|my|progress,|you|should|probably|be|reading|this|bottom|to|top.|Just|a|suggestion.|Also,|start|by|following|the|link|to|the|original,|[[2]].


BACK AND FORTH - 26 Jul 2005

Following my (flowing) design document, I added a "Sketching mode" to View3D. So cool to see your changes work! Even added an icon, modified menus, etc. Well, things have changed and now there's no need for that mode. I'm working on a Sketch object now, as Ton suggested. The good thing is that thanks to my CVS problems, I didn't commit the changes. The bad is that SIGGRAPH is coming close, and I'm not in shape at all... Well, more tomorrow.


DESIGN DOCUMENT - 23 Jul 2005

Here is the design document for my sketch-based modeling project in Blender. This is an evolving document. Please come back for updates. Comments and constructive criticism are always welcome (I know, figures would help; I'll add them ASAP).

1- Introduction. What to expect.

A simplified edition mode that can be used with Tablet PCs and similar pen-based devices. Of course, the mouse could be also used, but only one button will be useful (that can be also helpful for Macs and other one-button mouse users). The limited nature of this user interface presents the need for:

  • Reduced sketch-based edition functionality
  • Minimum set of interface elements


The first point represents the restrictions imposed by the sketching interface: It is impossible to offer the same functionality that we obtain with a more complex interface while still keeping the system simple. This results in our modeling scheme, where the user draws a wireframe model of the object, and the system completes the job by generating the surface indicated by the wireframe.

Second, given that the focus of the system is on simplicity and ease of use, as few interface elements as possible should be used. Only two or three buttons should be necessary to change the interpretation of the movements of the mouse, whether it is line drawing, model rotation or model edition.


2- Workflow. How does it work?

When using he sketching system, the user will focus on creating a wireframe model, or network of curves, representing the object to be created. To do this, the current window must be a 3D view, and the new "Sketching mode" must be in use. In order to simplify the experience, when in Sketching mode, every model edition takes place within a bounding sphere around the 3D cursor.

Following the Blender tradition, modeling is an iterative process with three main steps: Creation/edition of the network of curves and its parameters, generation of the surface and visualization of the model.

In the window header there will be three mutually exclusive buttons that alternate between the three sketching submodes: Sketch creation, rotation and sketch edition. Depending on the current submode, the system interprets the movement of the pen in different ways. Next, let's see this in detail.

2.1- Sketch creation mode

Curves drawn in this mode can be of three types. Type A curves don't connect any points of the sketch. They are assumed to be in a plane parallel to the screen, and have a depth determined by the user. The depth is indicated through a sliding bar in the window header, where the center of the bar represents the depth of the 3D cursor, and the extremes are the closest and furthest depth of the bounding sphere around the cursor.

Type B lines start or end in an existing line of the sketch, but one of their extremes is free. These curves receive the depth of the point they are connected to. Only certain points in an existing curve can be used as an endpoint of a new curve, and they are called junction points, or more shortly, junctions. We will see these later.

Type C curves connect two existing points of the sketch. The depth of the curve (of which we only know its 2D projection and the depth of its endpoints) is calculated minimizing the curvature as explained in the reference paper (http://www.ics.uci.edu/~pablo/articles/EGsketch.pdf).

We mentioned junction points without explaining what they mean. A junction point is a point in a curve where other curves can start or end. Initially, only curve endpoints are junctions. The user can create new junctions by simply pointing (single, non dragging click) at the desired position of the curve. A dragged click is considered a line drawing.

2.2- Sketch rotation mode

Few useful networks of curves can be drawn completely without changing the point of view. Thanks to the simplifying assumtion that all sketches lie within a bounding sphere around the 3D cursor, rotations are simple within this framework. When in rotation mode, any pen dragging will cause a spherical rotation of the sketch, facilitating the inspection and further modification of the model.

2.3- Sketch edition mode

Finally, no modeling system would be complete without the possibility of edition. In our case, edition can be performed on vertices and curves. First, the user selects a vertex or a curve by clicking on them. Next, the user draws a line. If the selection is a vertex, the line represents the displacement of the vertex in a plane parallel to the screen, much like current vertex translation. If the selection is a curve, the line represents the new curve position. It is to be decided whether moving a curve should also move its endpoints or not.

3- Implementation. What's done? What's to be done?

3.1- Tasks

  • Design of data structure representing network of curves.
  • Creation and edition of a network of curves.
  • Automatic computation of normals at vertices.
  • Propagation of normals along curves using SLERP.
  • Surface generation and conversion to Blender mesh.

3.2- Existing code

Currently, I have code from a prototype to draw the network of curves. This needs to be adapted to Blender. Similarly, the skining (surface generation) algorithm is also written, although I'm honestly not proud of it, and I would rewrite it completely for integration. Please refer to the paper below for details on this algorithm.

3.3- Existing Blender code

The tasks will involve creating a new mode for the 3D window, a new fundamental data structure for the network of curves, and integrating the surface generation code, that takes a network of curves into a mesh. Therefore, my work will be mostly concentrated on the following parts of the ./source/blender subtree (besides additional newly added files):

  • src/header_view3d.c makesdna/DNA_.h
  • blenkernel/intern/sketch.c
  • blenloader/intern/write(and read)file.c
  • src/drawview.c, src/drawobject.c
  • etc.


4- Other ideas.

Again, for further details, please refer to [[3]] describing the fundamentals of the prototype that I attempt to improve here.

Time permitting, I think it should be feasible to prepare a video tutorial as an introduction to the sketching system I'm building. It would be the perfect complement to a modeling tool that facilitates the first steps with Blender.



STATUS - 18 Jul 2005

It's been a while and I still don't have anything to show. Well, that's written in my proposal, if you check the link bellow. My progress is in two fronts: Learning Blender as a user, and re-thinking the way the sketching would be done with my system.

In the first front, I'd like to thank the creators of the video tutorials for their time and effort. They're really great, and if you haven't seen them yet, go ahead and check them out. They're worth your time.

Second, the design of the sketching. Well, different people understand different things when they hear the word "sketching". On common approach to this problem is habing the user draw a 2D wireframe model, and the program reconstructs it. Although this is the most appealing to most people, it's limited in its possibilities (for example, there is no efficient way of calculating the face models in less than exponential time, for models with handles). The second approach, which is the one I'm taking, is sort of a hybrid between traditional 3D modeling and the 2D approach. You model everything by drawing wires, but these are curves in 3D. This way, rotations are allowed to draw different parts of the model, and some benefits of using a computer (as opposed to a piece of paper) can be exploited. The problem with this approach is that the drawing process is not as natural as with the pure 2D way, but I expect this not to be such a burden. Once I have it running, we'll be able to tell.


LET'S GET STARTED - 03 Jul 2005

Hello everyone, I will post my progress developing my Blender SoC project here. Meanwhile, you can check [my proposal here].