利用者:Miyagix/GSoC'17/Reports

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

Reports


Few links
Blender Artist Thread
Link to my branch


Hello readers,
Here is the short report and updates of what I have been doing in the given week. In this GSoC project, my goal is to create a Clip brush and a Topograb brush along with implementation of contour brush (if sufficient time is there).
Possible Modification: Functionality of Topograb Brush might be replaced by Connected Face functionality so that this feature can be used by other brush also.

Week 1:

The first task that I have taken is to create Clipping brush.
Most of the time in this week was used to read documentation and figuring about algorithms that I will be using in clipping brush. Clipping brush will require change in vertex configuration, deleting and adding vertex and their projection schemes.
Letterrip (Tom M) has provided me some previous commits of last year GSoC student who was making this clipping brush using silhouette stroke method. I also went through it and it gave me a few hints.
Here, the first algorithm that I have though was to select the vertices inside the projection area of brush and delete that. And then create and series of vertices along the edge of projection of brush and connect it with the mesh. Extrude this series of vertices inside the mesh until it hits a mesh face. Perform same algorithm there.
But at the end of week I figured that vertex is difficult to delete in sculpt mode. Only dynamic topology does it so either I have to change the algorithm for clipping or use dyntopo with it.
Also, I learned a lot about blender sculpting operations.
Commits:
Added UI for Clipping Brush

Week 2:

After week one, I learned a lot about blender code but in this week I learned even more. Here, after finding that first algorithm is difficult and may need dynamic topology mode, I thought maybe I should think of some other techniques.
The next algorithm I have I thought of using was to push the vertices lying inside the brush projection to the edge of the brush. If this is done on side of the mesh, it would create a clip but if it is done inside of the mesh region, it will create a flat surface or face on the projection area.
I knew this won’t work as expected but I thought that this is worth a try. I tried this algorithm and this was creating the clip as expected.
Also, UI part for clip was completed in this week.
Demo Image:

Clip Brush Method One Implemented

At the end of this week I was suggested to start with Topograb brush first as it would be a little easier compared to the clipping brush.
Commits:
First try for Clip Brush
First working model of Push vertex method for Clip Brush.

Week 3:

After implementing this method in Clip brush, I modified few thing still this algorithm was not work. I guess I must implement that first algorithm (deleted and adding vertices method) using dynamic topology mode. It will be taking some time to implement so I shifted myself to Topograb brush implementation first as it will be taking less time.
Tom M has provided me with some doc related to proportional editing and other related stuff and I found it useful. To implement this brush, I had thought of an algorithm which is as follow:
As stroke starts StrokeCache will store initial central vertex index and all vertex index connected to it. Now, while stroking, each vertex which is to be modified will be checked whether that vertex is connect to the central vertex or not. If it is connected than the deformation through the brush will be applied.
I started creating functions like to_topo_grab_brush and topo_init function to implement this brush.
Here, Tom M suggested me that, instead of going for a new brush, If I can make a ‘Connected Face’ option below ‘Front face only’ Option in tool bar it would be better. Using this optiono, we can apply this Topograb connected face feature in other brush also. I started with TopoGrab in this week.
Commits:
Final Implementation of Push Vertex Method
Topograb Brush Initialization

Week 4:

This week was a busy week as most of the work related to Topograb brush has been done.
I have implemented final version of Topograb brush and it is working fine.

Topograb Brush Demo
Link to my branch

There are still a few changes to be made to make its operation faster and to reduce memory consumption and leakage and I would be doing that in a day or two. Also, there is some problem with symmerty which I will be fixing in coming days.
Expected changes(Optional): Instead of making it a brush, I would create it as an option in different brush (of course after consulting with Letterrip and Hackerman that in which brush it can be added) so that they could that brush in Topograb mode. That would help user to use that brush in specific parts of connected mesh.

Commits:
First Working version of Topograb
Working version: Update 1
Working Version: Update 2

Week 5:

Finally, 1st evaluation period has arrived. This week was going to be an evaluation phase hence mostly I tried to remove bugs in my work till the date. The Topograb was working fine in normal mesh mode but while using symmetry option there was no response. Also, there was large memory usage due to various structure and variables hence brush was not working quite fast.

This week I tried to remove symmetry error. LetterRip told me check symmetry working codes and related stuff and check its functionality which could help. I checked on that and also tried to learn more about pbvh working and iteration. I tried storing variable in variants and invariants mode before starting of stroke but due to change in initialization options of other generic variables like cache->location and normal, the brush started crashing.

I tried checking on symmetric variable and its working to gain further knowledge. My plan for coming week was to work on this symmetric error and remove that error only. After that, I would head towards its working on dyntopo mode.

Since, I was not able to write much effective code, I skipped committing any unnecessary and messy codes and stuff. Most of the time was consumed in learning above things.

Week 6:

I successfully completed my first evaluation period. Thanks to my mentors for their constant help.

This week, I mainly focused on that mirroring/symmetric error. And it finally got solved. It required a lot of code changes and whole functions that I have implemented in variants/invariants was transferred to do_topo_grab_brush itself. Also, removing various structural variables from brush_variants function enhanced the speed of the brush.

Now, the next problem was to use a dynamic array instead of a static array. Here, since I have used a static array, the number of connected vertex that can be stored is limited. Hence, we needed an array which could store large number of data and its memory size should be flexible. Using large static array will consume lot of memory even if it is not in use. I asked Tom M and hackerman- about this and they suggested me to check on BLI_array.c.

This week, LetterRip send me a mail which stated other list of bugs that was currently present in my brush. Also, he also told me that there was some warning while building my branch in Linux. He didn't give me many details but still I tried solving a few warning related to input and output functions and data types that were obvious.

Commits :
Topograb: Added few debugging lines to check symmetry error
Topograb: Finally solved the symmetry error
Topograb: Code Cleanup after solving error

Week 7

In this week, I started out with dynamic array implementation in my brush. LetterRip and mont29 suggested checking BLI_array.c and use BLI_array function to increase array size dynamically and according to use. Still, there was some minor implementation problem as it was not working as expected rather there were few crashes. I changed my focus to dyntopo mode implementation before dynamic array as after dynamic array implementation; if there would be any problem in dyntopo then it would be difficult to remove. Hence, I put dynamic array implementation on hold for time being.

Now in dyntopo correction, the problem I was facing was related to continuous vertex index changing due to multithreading. While, storing index, I tried to limit threading and also imitate cache->first_time to create something like second_time in cache for calculation. The advantage of using second_time could be that it can calculate central vertex as a whole and it might not be affected by multithreading. But still no achievement was there. It was working same as before. I was thinking of stopping multithreading for time being and I asked mont29 and LetterRip in irc and they hinted me to make brush work without interrupting multithreading as it won’t be a great idea. I tried BLI_mutex and related function (inspired from layer brush) but still there was nothing much that I gained.

Finally, LetterRip hinted me to check what the coordinate status while using brush is. I checked and since grab brush uses original coordinate, we thought of using coordinate as index. I tried studying more about bm_log functions and it was a bit helpful. Finally I was able to develop Topograb brush which is working in dyntopo with few crashes (still there is some error related to mirroring in dyntopo but I think it can be solved easily now).

Commits:
Topograb: Implementation of BLI_array. First attempt for Topograb in dyntopo.
Topograb: Implementation of find_connected in mesh mode.
Topograb: Using Bmesh bm_log bmvert index instead for normal mesh vertex index for stable brush.

Week 8

This week, I mainly focused on creating a stable working Topograb brush at least in normal mode and dyntopo mode. In normal mesh mode, the brush was already working fine.

LetterRip sent me an email about a bug in Topograb, in which the brush grabs wrong position in mesh while using symmetry operator. The reason was the projection of brush. Since, current brush depend on the projection angle of the brush, it might be possible that while using the brush, vertex might be located in some other mesh part which is not directly connected. To solve it, I tried to change normal and it started working fine for simple mesh or planar mesh but for large mesh or curved mesh, it still needed more an exact normal of mesh at brush center. I tried using cache->sculpt_normal for projection normal but it was not working properly in some cases.

Next, there was few crashing problem in dyntopo even for simpler mesh in many cases (I find out that recently and that was mostly due to wrong array declaration and usage in connected bmesh function). I changed variables a bit and also modified connected mesh detection function and it is working fine for now. There is still some issue in mirroring but they are not that critical and I will be solving them in next week.

Also, I tried to work on multires mode of operation in brush but as I was unable to find vertex relation, it was getting difficult. I tried to import mvert details by changing few attributes in mesh updates functions in paint.c but it was not working. Hackerman- and mont29 has provided me some hints to find the vertex index or loop index. I will be working on that and will be giving updates on that soon.

For next week, I will be solving remaining bugs in Topograb in normal and dyntopo mode (like few mirroring issues, wrong topology grab, and dynamic array implementation). Next, I will be heading with multires after finishing above stuffs.

Commits:
Topograb: Attempt towards creating brush in multires
Topograb: Updating normal with sculpt->normal to fix wrong topology grab error