From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

GSoC 2011 Proposal: Improving Blender's Retopology Tools

Name

Meiyi Alice Li

Email / IRC / WWW

Email: li.alicem@gmail.com

Additional Contact Info

Phone: (416) 493-7838


Synopsis

The current retopology tools in Blender suffice for creating a new low-poly mesh, however the process can be quite time consuming. Due to the somewhat "spontaneous" nature of retopologizing, users need to be able to create faces (quads and triangles) and add loops quickly and easily. Therefore, it is necessary to provide a set of tools that allow users to draw vertices that naturally snap to the underlying surface, create a variety of meshes easily and quickly, and finally, quickly add loops to the mesh.



Benefits to Blender

Not all modelers are scientists and it's unintuitive for many artists to create a model polygon by polygon. The proposed tools will allow them to sculpt their model and then easily create a low-poly mesh (using the retopology tools) for animation and rendering.
The pen tool will save modelers time by automatically creating faces as new vertices are created.
Polishing the gpencil_retopo tool originally developed by Cambo will allow modelers to create a mesh by drawing a series of intersecting lines/strokes and join existing vertices to the mesh created by the lines drawn.
The guide stroke tool will save time when creating a low-poly mesh over tubular forms.
As well, enhancements the visibility of the retopologized mesh will satisfy a need that has been long present in the Blender community.
These tool enhancements will mainly allow users to save time, but also to improve work-flow and use the tools in a way that is more intuitive to artists.


Deliverables

With help from Jonathan Williamson, determined priority of tool development:
  • Pen tool: A tool to help users quickly draw polygons. As new vertices are drawn, faces are automatically created thus saving modelers the time of having to select the edges and then fill the face.
  • gpencil_retopo (polished): Create mesh and add faces based on intersecting strokes that are drawn.
  • Guide strokes tool: Create cylindrical mesh that snaps to the underlying model with number of loops determined by number of strokes drawn by the user.
  • Improve visualization of retopologized mesh: Toggle backface culling when xray is on so that backfacing polygons are not shown.


Project Details

Pen Tool: Functionality will be based on what is seen in these videos that were specified on the Blender GSoC 2011 ideas page: http://www.luxology.com/common/qt/LuxQT.aspx?u=http://video.luxology.com/modo/301/video/PenTool.mov&w=1280&h=780 and http://www.topogun.com/media/videos.htm

  • If at least 3 vertices are connected to the selected vertex, create new quads with each new vertex extruded.
  • Heuristic of implementation:
Figure 1
1. The behavior of quad creation is similar to extruding an edge
2. Given that v1 is the new vertex drawn by the user, it is only connected to one other vertex by an edge, v0
3. v0 can be connected to any number of vertices, only 2 are shown in figure 1, of those vertices v0_1 and v0_2 determine which has the least displacement form v1 (in this case it's v0_1).
4. Extrude new vertex from v0_1 with same displacement as v1 from v0, then create polygon
  • Documentation for bmesh assures me that queries made on a vertex is possible, therefore finding vertices connected to v0 by one edge should be straightforward. Link: http://wiki.blender.org/index.php/Dev:Source/Modeling/BMeshDocMirror
  • Allow snap to nearest vertex, such that if cursor is within a certain distance from an existing vertex and LMB is clicked, an edge is created (if loop valid, maybe use mesh_looptools.check_loops, a polygon is created) as opposed a new vertex.
  • Allow snap to nearest edge: a new vertex is created on an edge thereby "splitting" that edge in two. New polygons are generated as necessary (second half of second video).


gpencil_retopo: Building upon the currently existing gpencil_retopo tool developed by Cambo.

  • Currently a new object is created for both the strokes drawn and the new mesh generated, even when in edit mode: give users the option to create a new object or add the newly generated mesh to an existing mesh
  • Implement joining AND generating mesh from strokes: determine where an existing vertex and stroke intersect, use that existing vertex when generating the edges and polygons of the new mesh


Guide Strokes Tool: Builds on the paint stroke tool to allow user to determine number of loops and then creates the cylindrical mesh, snapping all vertices to the surface of underlying model.

Detailed diagram of functionality (created by Jonathan Williamson): https://dl.dropbox.com/s/j0upv9fy3t552gy/guide_strokes_tool.jpg
Heuristic of Implementation (big thanks to LetterRip):
  • Strokes generated by user are all on one plane.
  • Calculate intersection of strokes and cast a ray towards the underlying mesh.
  • Use continuous embedding code from etch-a-ton to determine center of underlying mesh at each horizontal "slice".
  • Allow user to input number of vertices per slice.
  • Cast a ray from center of high-poly mesh "outward" along the plane created by the horizontal slice and the casted ray at angles determined by the number of vertices the user has specified.
  • Vertex created where cast ray intersects with high-poly mesh. Group new vertices from each slice, use ShrinkWrap modifier to shrink vertices to nearest surfacepoint on the high-poly mesh (target). Link: http://www.blender.org/documentation/blender_python_api_2_56_4/bpy.types.ShrinkwrapModifier.html#bpy.types.ShrinkwrapModifier.wrap_method
  • After this has been done with each "slice", create polygons with existing vertices (using lofting?).
2nd Heuristic of Implementation:
  • Use user strokes and cast ray determining center of high-poly mesh.
  • Determine vertices closest to the "slice" plane in the high-poly mesh and calculate circle of best fit (looptools.py).
  • Given number of vertices specified, create cylindrical mesh with a loop at each level where vertical user stroke intersects horizontal strokes.
  • Shrinkwrap cylindrical mesh to high-poly mesh.

Improved visualization of retopologized mesh: Allow backface culling in xray mode. Some past workarounds: http://homepage.ntlworld.com/rallen/cull.py.txt and http://blenderartists.org/forum/showthread.php?143717-Blender-2.5-Development-Updates/page141

A quick search of algorithms for backward culling mostly results in going vertex by vertex which can be very slow depending on the complexity of the mesh. I found an interesting paper on a faster method of implementing backwards culling which might help overcome this problem:
http://portal.acm.org/citation.cfm?id=253314


Project Schedule

I always give myself a bit more time than I think it will take for me to program to implement things on a project - I've had my overly-zealous densely packed development schedules come back to bite me on numerous occasions. So I've given myself plenty of time in this proposal to ensure that everything I have proposed can be delivered.

I find it easier to keep track of my code by being very organized so I will be working on the documentation for all of the 12 weeks, I'll also be keeping a developer's blog (mainly for my own reference).

I have no other commitments this summer so I will be able to put in 40 hours a week, maybe a bit more to reach the deadlines I've set out for myself.


April 8th to May 23th: Familiarize myself with Blender code base, read documentation and submit a few patches to get a sense of the development process.

Week 1: Work on automatically creating a face once four new vertices have been drawn. Then move on to creating a face and a vertex with each new vertex drawn (behavior similar to extruding an edge).

Week 2: Create new quad with newly drawn vertex given 3 existing vertices (pen tool, second video).

Week 3 and 4: Drawing vertex on existing edge thereby changing the configuration from "vertex-edge-vertex" to "vertex-edge-newvertex-edge-vertex" and automatically creating the new faces at the same time.

Week 5 to 5.5: Polishing gpencil_retopo

Week 5.5 to 6:: Implement using gpencil_retopo tool to join existing mesh.

Week 7 to 9: Develop "guide strokes" tool.

Week 9 to 11: Improve visibility of retopogized mesh.

Week 12: Clean up and finalize documentation and code. Create tutorials for new tools.


Bio

I am 21 years old, currently in my 3rd year studying Computer Science at the University of Toronto. I was in Business for a year but then switched into Computer Science because I love computer graphics and noticed that for some of those jobs you also needed to know how to program. Thus began my love affair with programming and all things related. I probably would've started earlier had I known back when I was 12 and tinkering with HTML that being a programmer was possible for me (the idea of becoming a programmer to me was inconceivable mostly because it wasn't even on my radar).

I've been using Blender for about 3 months now. I have experience with Python (3 years), Java and C (2 years), HTML, CSS, Javascript, AJAX, and PHP (for about a year). I've written a photo-editing program in Python, worked on a team of 6 to make mobile game in Java, and a wrote simple CGI server in C.

Most recently I've finished up a project creating making an online database for a professor in another department. Unforeseen technical issues resulted in me having to change the database management system 3 times and therefore rewrite a lot of my code. This initiated my obsession with detailed planning, commenting and documentation. Link: http://lemurdatabase.wishfulli.com (note: it was finished April 1st, therefore it holds very little data. The bulk of the work was in the database editor for the administration.)

Although I'm still relatively new to this field, I'm a fast learner. I've only recently discovered open source software, I'm itching to contribute to a project (I'm on openhatch.org a lot as of late), and I would love the opportunity to develop for Blender for GSoC 2011.

Code samples:
Simple CGI server code (C): http://www.wishfulli.com/server.html
Simple function for calculating page numbers (Python): http://www.wishfulli.com/pages.html

Some of my Blender models:
http://www.wishfulli.com/flower1.jpg
http://www.wishfulli.com/house2.jpg
http://www.wishfulli.com/wippagoda.png
Last one is a work in progress of a Chinese temple/pagoda place, used environmental lighting for a quick shot (I get a lot of noise when I use it).


Acknowledgements

Huge thanks to Jonathan Williamson, Nicholas Bishop, and especially LetterRip for all their help and patience.