利用者:Dan w/soc2011
Interim Documentation Preliminary Draft Re-topology Tools
目次
- 1 Introduction
- 2 User Documentation
- 3 Grease Pencil to Mesh Tool
- 4 Mesh Retopology Tool Enhancements Including BMesh Semi Automated Topology Generation, Step-Building and Modifying
- 4.1 Abstract
- 4.2 Deliverables
- 4.3 Tools
- 4.3.1 Semi Automated Tools
- 4.3.2 Improve and polish tool
- 4.3.3 Point Build Tools
- 4.3.4 Extend Tools
- 4.3.4.1 <extrude line into quad polygon by parallel edge> LMB
- 4.3.4.2 <extrude line into quad polygon by drag direction orientated edge> shift + LMB
- 4.3.4.3 <extrude vertex into line by dragging> ctrl + LMB
- 4.3.4.4 <create quad polygon by dragging from vertex> shift + ctrl + LMB
- 4.3.4.5 <remove element> alt +LMB
- 4.3.5 Loop / Ring Tools
- 4.3.6 Additional basic tools as required
- 4.4 weekly progress report 1 27/05/2011
- 4.5 weekly progress report 2 03/06/2011
- 4.6 weekly progress report 3 10/06/2011
- 4.7 weekly progress report 4 17/06/2011
- 4.8 weekly progress report 5 24/06/2011
- 4.9 weekly progress report 6 01/07/2011
- 4.10 weekly progress report 7 08/07/2011
- 4.11 weekly progress report 8 15/07/2011
- 4.12 weekly progress report 9 22/07/2011
- 4.13 weekly progress report 10 28/07/2011
- 4.14 weekly progress report 11 05/08/2011
- 4.15 weekly progress report 12 12/08/2011
- 4.16 weekly progress report 13 19/08/2011
Introduction
The following document is an interim draft of ongoing development of re-topology tools and enhancements for blender bmesh, as part of Google Summer of Code 2011 and during that 13 week period.
User Documentation
The following is an interim guide with regard to use of new retopology tools.
Grease Pencil to Mesh Tool
The new grease pencil to mesh tool is a utility to supplement the existing grease pencil tools. The tool converts the active grease pencil marks into a bmesh type mesh.
The tool is inspired by Ideasman_42's work with grease pencil and mesh generation. It is re-written to be accessed by the gui, and to be higher speed using b-mesh operators written in C rather than the existing python demo script. The internal workings also differ, creating a tool that behaves differently.
The tool is accessed from the tools menu at the bottom of the menu with the grease pencil draw and erase tool buttons.
The logic for the tool is simple, but allows the user to create verticies, edges and faces using various different types of mark / gestures.
When two grease pencil strokes intersect, a vertex is created. When a stroke is intersected multiple times, edges link the intersection points. When edges form a loop, the loop will be filled with faces.
Mesh Retopology Tool Enhancements Including BMesh Semi Automated Topology Generation, Step-Building and Modifying
Dan Walters
Abstract
Mesh re-topology tools have developed in recent years, pushed by their particular value in relation to mesh sculpting. They are now a basic requirement in any pipeline involving high poly count sculpting. The process of creating a new mesh based on the form of another represents a change of use or purpose (often a lower poly mesh for texture baking). Editing topology is very useful when improving a meshes ability to animate. They are time saving and artist enabling tools.
I propose a concise suite of mesh retopology tools for Blender BMesh, building upon the existing tools. While Blender already offers an extensive suite of tools for creating and modifying meshes that will soon be improved by the release of BMesh, the proposed retopology tools are to focus on work flow and use. The intention is to make these functions more accessible to the user, and empower the artist with new and faster methods of common retopology tasks.
They are to focus on three main areas; semi-automated, creating and editing. Semi automated tools generate parts of meshes from relatively few mouse gestures and input such as slice joining. Creating tools are to include step building by creating vertices, lines, ngons, extending by dragging vertices to make lines, lines to make polygons, enhanced paint functionality to create polygons based on 2d screen gestures. Editing involves tools for working with rings and loops and refactoring lines, polygons and the flow of a mesh.
These tools rapidly speed up the process through intuitive user interface and automated process, unloading the mindless part of retopology tasks to the application rather than the user and empowering the artist with new ways to create.
Deliverables
Tools are to use a 2d screen space engine to handle the editing process, unless otherwise indicated such as grease pencil related tools. This2d screen engine is to be created as a new code module or adapted from existing code as required. All tools are to reuse this 2d screen space engine for handling all mouse input and gestures unless specified.
Mesh editing such as cutting, slicing, inserting loops and rings is to reuse existing functionality in the Blender source or new code modules as required.
An optional deliverable feature is edit preview / real time generation. With a previewing system, the mesh would be double buffered and the user could see the effect that clicking will have when hovering over with the mouse. For example, with the insert loop tool, hovering over a line will show how a loop would be inserted by showing the new previewed loop lines in a different colour. This would assist in making the tools easy to understand and quick to master.
While this tool list is long, I consider it a realistic feature set for a 13 week program as many tools use existing code or proposed new modules in different ways Note that many of the non-automated tools are optional deliverables as they primarily offer a second interface to existing functionality.
All tools are to provide tool tips (mouse over text) that explain key shortcuts and briefly how each mode works. Shift, Ctrl, Alt and combinations should all be used so that an advanced user can use the tools with ease.
Tools
<select surface target> Button to allow the user to select the object to be drawn onto. Option to sample all objects in scene Option to draw onto grid
Semi Automated Tools
<create polygons based on slice>
Drag lines to define where slices should go. Drag final line that passes through previous slice lines to define how slices should be connected. Creates a cylinder that is shrunk fit to slices. Has number of sides setting. http://www.3d-coat.com/uploads/pics/rtp_slices.gif
This is to be achieved by recording mouse gestures in screen space. As gestures are added, logical conditions are checked. In this case, the logical condition of checking if a line crosses another. In this case, the first strokes are used to create intersecting meshes and intersections are found. The center of the intersections is determined and rays traced out at set equal angles perpendicular to the axis of the slice. The points of intersection with the target mesh indicate the vertices and a mesh is generated. This code is to be based on the etch a ton feature, which achieves similar operations with bones.
<mesh from grease pencil tool>
Based on ideasman_42 grease pencil to mesh script, add mesh generation from grease pencil strokes.
Lines are drawn to screen in paint mode, stored in stroke buffer (lists of screen positions). On user command, strokes are intersected to generate points of intersection which represent vertices. A simple vertex weld is performed to merge close together vertices. This threshold is in screen space rather than world space so scales well and prevents vertices from being created indistinguishably close together. These vertices are joined by lines by ordering them along their strokes in order to generate connection information. A simple search function then finds where polygons should be created. This description to be amended more closely follow existing grease pencil mesh script by ideasman_42 (which is a very awesome script) rather than replace.
Examine potential for real time mesh generation from grease pencil (interactive)
Improve and polish tool
optional feature - ngon from grease pencil shape (not from intersections)
<extend from line as a strip>
Click and drag from a line. A strip of quads are created by continuously creating quads per interval when dragging. Requires interval length setting. http://www.polyboost.com/Images/Gifs/PolyStrips.gif
As the mouse drags the edge, the logic checks if the line has been dragged a greater distance than the threshold value. If this is true, the logic creates a quad between the starting line and new dragged line position, and resumes calculating the drag operation from the new quad edge. This continues until the mouse is released.
The tool will be able to operate in two modes (LMB or ctrl + LMB) where the new edges are either parallel to the starting edge or orientated to follow the direction of the mouse movement.
<create bordering quad strip>
This tool allows creating a strip of polygons by dragging / painting with mouse a bordering edge along the side of a strip of polygons. These polygons are automatically extruded up to the edge.
This tool requires a strip of polygons with an edge on one end that is perpendicular to the strip of polygons. By clicking on that vertex that is offset from the strip of polygons and dragging, a stroke will be drawn on to the screen. Quads will be created by extruding from that strip of polygons up to the stroke. Using this method, strips of quads can be created rapidly.
<refactor loop flow>
This tool allows adjusting the positions of vertices on a loop based on a mouse stroke.
User clicks on a line and drags. On mouse down, the programmed logic determines the loop the user is manipulating. As the user drags the stroke, front facing vertices snap to that stoke as the mouse pointer passes through their bi-normal.
The following tools are mostly existing tools that are to be provided with a different ui in order to make them more accessible for refactoring tasks, which requires a different work pipeline and flow to normal modeling. As a result, they are lower priority than the above tools, and optional deliverables depending ease of progress on the above.
Point Build Tools
Click Point Build Tool button to activate.
All point building tools to draw on to surface as defined by target surface.
Most of the following functions are already available elsewhere in Blenders tool suite. The purpose of the following is to make them more accessible using a single simple tool centered on artist workflow.
<create ngon> LMB
Click on vertices to define ngon. RMB or click back to first vertex to complete ngon. Tool already implemented elsewhere. New interface allows faster use with other tools. Possible preview support.
<create line> shift + LMB
Click on vertices to connect with lines. First click defines starting vertex. Subsequent clicks connect line between two most recent clicks. Tool already implemented elsewhere. New interface allows faster use with other tools. Possible preview support.
<create line by dragging> shift + ctrl + LMB
Drag mouse to create 2 vertices and a line between them. Mouse start and end positions used for vertices. Possible preview support.
<create vertex> ctrl + LMB
Click in the scene to create a vertex. Tool already implemented elsewhere. New interface allows faster use with other tools. Possible preview support.
<remove element> alt +LMB
Click on vertex or line or ngon to remove that element
Extend Tools
<extrude line into quad polygon by parallel edge> LMB
Click and drag line to extrude into a quad. Dragged edge is parallel to starting line.
<extrude line into quad polygon by drag direction orientated edge> shift + LMB
Click and drag line to extrude into a quad. Dragged edge is oriented based upon the mouse drag direction.
<extrude vertex into line by dragging> ctrl + LMB
Extrude a vertex into a line. Click on a vertex and drag.
<create quad polygon by dragging from vertex> shift + ctrl + LMB
Drag from a vertex that has two edges connected to it to create a new quad. http://www.polyboost.com/Images/Gifs/Border.gif
<remove element> alt +LMB
Click on vertex or line or ngon to remove that element
Loop / Ring Tools
<insert loop> LMB
Allow inserting a loop by clicking on a point on a line.
<adjust loop position> shift + LMB
Interpolate the loop position within its ring by dragging the mouse.
<adjust loop extrusion> ctrl + LMB
Move the loop in and out of its surface plane based on its vertex normals Will create ridge or seam.
<remove loop> alt + LMB
Removes a loop
Additional basic tools as required
Focus to be kept to completing and polishing few tools rather than half implementing many. Semi-Automated tools list (see top) to take priority.
weekly progress report 1 27/05/2011
Reviewed own GSoC application
Added application time plan into personal calendar
Set up building blender with SCONS
Checked out avocado branch
Contacted mentor regarding BMesh source
Set up building blender with CMAKE in order to use visual studio IDE for editing and debugging
Began reviewing code, BMesh specific, starting with tool operators
weekly progress report 2 03/06/2011
began work on grease pencil to bmesh tool
broke down task into following:
create a gui button, link to tool
retrieve the selected grease paint object
retrieve the splines associated with the grease paint object
prepare the splines (clean co-linear, etc)
iterate over the splines, creating intersections
iterate over the vertices, deleting if the vertex connects to 2 or less edges, single pass
perform any necessary mesh cleaning, removing duplicated faces, etc.
partial implemented some of the above in code, detailed and noted challenges and issues on others
weekly progress report 3 10/06/2011
added UI element to Object Tools, Grease Pencil Section
implemented UI element behavior
added corresponding hook and callback functions to ui element
added grease pencil crawling code to access active stroke data
investigated bmesh operators and how to build a bmesh
planning / designing the stroke data to bmesh pipeline, looking at how to avoid artifacts and generate cleanest possible mesh, most direct flexible method
weekly progress report 4 17/06/2011
implemented mesh primitive function in mesh library
implemented bmop (excluding provision for passing spline data)
reviewed and discussed with ideasman the gpencil to mesh script
weekly progress report 5 24/06/2011
added retopology ui group to objects menu
added retopology extend button
added source ui hook
continued with bmop for gpencil tool
weekly progress report 6 01/07/2011
made incremental commits
fixed infinite loop bug for certain spline condition
intersection searching
commited basic ui elements for retopo tools
added basic hook and new file to contain tools
vertex insertion code for point of intersection
gpencil to bmesh tool now generates bmesh format vertexes and edges from gpencil splines but needs vertex culling and faces
weekly progress report 7 08/07/2011
very intense uni week, last 3 days of lectures, 12 hour sessions
"extend tool" c hook
planned extend tool mechanics
investigated element selection
weekly progress report 8 15/07/2011
catching back up with the lost week from last weeks lectures
investigated selection
extend tool selection on invoke
extend tool construct new geometry on invoke
attempted vertex welding although unsuccessfully. will email my mentor off list
weekly progress report 9 22/07/2011
reviewed own progress following mid term
reviewed project plan
liazed with mentor over revising priority of each tool planned
arranged regular meetings
continued with extend and mesh from splines tool
weekly progress report 10 28/07/2011
irc meeting with mentor
reviewed progress
discussed project plan
further developed spline to mesh tool to incorporate vertex welding
studied loop cut / knife tools
evaluated and continued to progress with extend tool
weekly progress report 11 05/08/2011
had two meetings with mentor
planned and began development on new tool
build tool, task list as follows
add section to ui - done add button to ui - done add operator - done add operator declaration - done register operator - done add event function - done add mouse down event code block - done add global array of verticies add init function to zero vertex array add vertex to global array project ray into screen along mouse create exit function create bmesh object from vertex array (bmop) zero vertex array
splines to bmesh tool:
fixed vertex welding by using a different operator
marked intersection verts for weld operation
began unwanted vertex and edge removal
commited some finished changes after separating code out
weekly progress report 12 12/08/2011
redesigned and revised spline to bmesh algorithm to remove unwanted vertices
my original design worked by converting the splines to bmesh verts and lines, then inserting intersections, welding, and then removing the unwanted verts and edges. The revised design makes much more sense and runs much faster - it ignores all points except intersections, generating the intersections along a spline as verts and linking edges between. Once this is complete, a simple weld completes the operation.
algorithm now allows more flexible creating of geometry, can add vertices along lines, etc. A lot more intuitive as the user realizes that intersections mean vertices. This opens up a lot of flexibility within the way the tool can be used
implemented use of edgenet fill bmesh operator - although currently unsucessfully
spent a lot of time working on debugging why edgenet fill isnt working for me without success.
have not met mentor this week as he has been at siggraph
proceeded with implementation of build tool, including tool framework and scene depth projection
weekly progress report 13 19/08/2011
bmesh retopo build tool:
added tool verticies register (struct and object)
added init function to initialize data
developed modal function to act on relevant event, access screen coords, developed some of the screen to world coordinate projection code
added some framework for modal logic
still working on this
have not managed to get hold of my mentor this week. I have spent considerable time debugging my face filling code to no avail and unsure exactly what the problem is. Other than this, the grease pencil to mesh tool is ready and complete
I have had to give more time to uni work this week to responsibly meet my submission deadlines.