My name's Nate Vollmer. I'm working on implementing PBVH based vertex selection with Bastien Montagne. Me and Bastien talked a bit over email about some first steps. I'm currently working on configuring my IDE and getting Blender to compile. I'll also be looking through other student's proposals, just so I know who's doing what. Then, I'm planning on going through the blender architecture documentation, specifically general documentation and the meshes documentation. A lot of information in that documentation will apply to my project. I'm still in school at the moment, but our finals are over on the 3rd of May. I should be a little more focused then.
Weekly Report #01, PBVH Painting
Sorry if this is a bit late. I thought I had till midnight before the mailing list sent. >.<
What I did this week:
- I've learned a lot about how to use git. I've touched on it a bit before, but never on a project as big as blender. Learned how to make branches, merge master into development, etc.
- Met with a local user and got to know how he uses vwpainting in his projects in mass communication and 3D animation projects. We'll be meeting every now and then as I get more changes developed.
- I read a lot of code related to general blender operators, sculpt mode and vertex paint in particular. PBVH based vwpaint draws a lot of parallels with sculpt mode, and I'm trying to take advantage of that. I've been taking notes on things like stack traces by hand.
- I was able to construct and free a PBVH in both vertex and weight paint.
- I got the PBVH to display when entering debug number 14 by recycling sculpt.c code. My original attempt was a little inefficient, so Bastien helped me optimize it.
- I'm initializing a stroke session struct similar to in sculpt.c which should help me out later on in the project. That stroke session also prevents the PBVH from being prematurely free'd.
Here's an example of a dog model in vertex paint being used to build a PBVH: https://wiki.blender.org/uploads/b/b3/GSOC-N8V-VertexPainting-Example-Dog.png
- I need to get more familiar with how vwpaint currently selects the loops it uses to modify a mesh.
- I plan on using the PBVH to select these loops instead. I'll probably try selecting all loops within a PBVH leaf first. I'll also be researching how sculpt.c selects vertices, and see if I can recycle some code from there.
Weekly Report #02, PBVH Painting
Hi everyone. Here's my Friday update.
- I studied 3D viewport raycasting. Sculpting does a ray cast to determine the location of the 3D cursor. The raycast requires some linear algebra, so I studied how the raycast into the 3d view works.
- I learned about PBVH raycast callbacks, and how I can use them to keep track of selected PBVH nodes.
- I was able to get vertex painting to do a ray cast like in sculpt mode. Using the PBVH, I'm able to detect when the cursor is over the mesh, and at what location.
- I wrote my own PBVH raycast callback, which keeps track of the nearest leaf node.
- I figured out how to get vertices from the PBVH node.
- I have those vertices mapped to loops, which I can use to paint.
Tomorrow, I should have a PBVH leaf painting. I'll also be adding leaf painting to weight paint. Next Week:
- I'll determine how to select the vertices within my brush region, and paint loops those. I'll be talking to my mentor about how to do this. I'm thinking I can use an inverse perspective transformation and then use a cylindrical intersection algorithm.
Weekly Report #03, PBVH Painting
What I did this week:
I looked into how sculpt mode selects vertices within PBVH Nodes. I originally thought I would be writing a cylinder/cone intersection algorithm to select points, but sculpt mode uses a much more simple sphere intersection algorithm. After talking to my mentor, we decided to recycle a couple sculpt methods. I was able to get vertex painting to use a similar method to quickly avoid painting vertices outside the brush region. By using a 3D location sphere intersection comparison instead of a cylindrical intersection comparison, PBVH vertex painting now avoids "splashing" paint, which was one of the features I wanted to add.
I have some adjustments to make over the weekend to get the PBVH painting method feeling a little more natural. Some of the older paint blending techniques need some adapting to work with our newer technique. I'll also be modifying weight paint to do act the same as how I have vertex paint working.
Side note: I had a bad case of strep throat this week, and although I got my objective done I wasn't able to fully replicate Ray traced vertex painting with PBVH painting this week. I'll probably have a fully functioning prototype next week that I can show to my stakeholders though, so things are looking good so far.
Weekly Report #04, PBVH Painting
This week I was able to:
- Get full PBVH based vertex painting implemented. At this point, an artist could choose either one and be able to get their work done.
- Add back in vpaint blur. I need to talk to my mentor a bit on how things are working now with blur. The old vertex blurring would average every loop in the mesh, regardless of if the loop was under the brush region or not. The PBVH blur now averages only the vertices under the brush region. I really like how the new brush works compared to the old brush, but I'm concerned what I created is more like photoshop's "smudge" brush, rather than a gausian blur type brush. I think what I'll do is add smudge as another vertex painting option, and recreate the old blur tool by averaging every vertex loop color, not just the ones under the brush.
- Optimize vertex to loop map creation.
- Fix a bug with PBVH brush strength.
- Add smudge as an additional option (on mentor approval)
- I'd like to look a bit more into implementing a "nearest to ray" PBVH raycast similar to the current BVH "nearest to ray" raycast. If I get this working, we can paint a mesh without the cursor being directly over a poly.
- Midterm stuff.
Here's a gif of PBVH Blur. (Framerate is much faster outside screen capture): https://goo.gl/ei3MRW
Weekly Report #05, PBVH Painting
This week I was able to:
- Fix a bug with PBVH brush strength.
- I modified what last week I was calling a "blur" brush to instead be called an "average" brush, since it averages all the colors under the brush region instead of averaging neighboring colors together. The average brush can be chosen from the blending mode menu, although I haven't quite figured out how to get the average brush to appear under the default vertex paint brush options in the square box on the top of the tools menu.
- I recreated the older "blur" brush using the PBVH. Unlike average, the blur brush calculates a unique average for each vertex under the brush region by averaging all neighboring loops to that vertex. Although the actual blur effect is no different than the older technique, the new blur is magnitudes faster.
- I am now creating and deleting vert to poly and vert to loop maps while initializing the "sculpt session". Before, I was unintentionally creating and deleting the maps every paint stroke cache, causing a performance hit when initially painting.
- I looked at and am still looking at what all needs to change to get the "nearest to ray" raycast working in the PBVH. I'm planning on first creating a new PBVH search and gather method. That method will chose the nearest pbvh nodes within a certain distance instead of selecting only pbvh nodes actually being intersected by the ray. From there, the logic should be similar to a method in BLI_kdopbvh.c, which only supports BVH trees.
- get mirrored painting working
- continue working on "nearest to ray" selection.
- fix a seg fault when "undo"ing a paint stroke.
Here's a gif of the difference between blur and average: http://i.giphy.com/3o6gDYANVxC5xgeKn6.gif
Weekly Report #06, PBVH Painting
This week I did the following,
- I fixed a bug with the undo operator in vertex painting. I didn't fully understand how the undo mechanic worked in blender until this week, where I discovered my "sculpt session" struct was being free'd, along with all my map data. I added a check to see if the sculpt session or the maps are free'd, and if they are, then initialize them again. This makes undo'ing, and then drawing initially a little slower since the maps need to be recreated, but it's not a significant slow down and is better than the alternative.
- I got mirrored painting working. (see gif below) I took a day or two to figure out how python/C interop works, and then I added some toggles and some sliders for mirrored painting. Everything works fundamentally the same as sculpt mode.
- I'll be adding the pbvh painting technique to weight paint mode.
- I'll be adding mirroring options to weight paint mode as well.
- I'll be implementing many of the "weight tools" in the tools menu.
Weekly Report #07, PBVH Painting
- I had some hardware trouble with my laptop, and had to send it in for repairs. I'm borrowing a friends laptop in the meantime. It took a little while to set up another development environment.
- I read up a lot on vertex groups and weight painting code. Initially I thought weight paint would be much more straight forward than vertex paint mode, but things actually seem to be the other way around.
- I was able to get weight paint to use PBVH painting.
- I added buttons to the gui for mirror mode and radial mirroring, and I added support for symmetrical brush actions similar to sculpt and vertex paint mode.
What I plan on doing next week:
- Although I was able to get weight paint to use the PBVH tree, something's still slowing down my code. I'd like to check out where that slow down happens and see if I can speed it up.
- A couple Weight Tools still need implementing, like the mirror button.
- I need to add support for multi-paint mode. I have an idea how I'm going to do this.
On a side note, my original proposal I planned on adding something next week called a "Dynamic brush region". Things have changed a bit, and the idea I originally had doesn't seem like a helpful feature anymore. Instead, I'd prefer focusing on making weight painting as optimized and as reliable as possible. Hope that's okay with everyone.
Also, here's a gif of old vs new weight paint mode. https://twitter.com/NathanVollmer/status/751990951283789825
Weekly Report #08, PBVH Painting
First, sorry for the late update. I've been getting into a bad habit of waiting to update until saturday afternoon to squeeze things in. I'll post earlier next week.
- I worked on weight painting a bit more. All the buttons in the "Weight Tools" menu seem to be working. I took some time to learn how armatures work in blender, and double checked that everything is in working order.
- I took some time to determine what slows weight painting down when painting dense meshes (around 330,000 faces). Every update, we were copying every deform vertex struct from every vertex into a dvert_prev array. That array was used to determine if a vertex had been panted before a 'done' was called to avoid painting that vertex twice. I'm planning on using an alternative approach which seems to be much faster from my initial tests.
- I got the average blend mode working with weight paint.
- I dug some more into how to add a tool to a brush in the blender GUI, but didn't have much luck. I'm talking to some core devs on how to do this.
Next week: I have a big problem with my timeline, and I'm actually way ahead schedule. I'll be talking to my mentor to figure out what potential extras to start on first. I'm also planning on meeting with a couple of my local blender users.
Weekly Report #09, PBVH Painting
- This week's been a little busy for me. I've been getting ready to present to a research conference next week. I'll be gone from next Tuesday to next Thursday.
- Early this week I talked to Campbell and Antony on how to add the average brush as a default option in both weight painting and vertex painting.
- I've also been figuring out what I'd like to do with my extra free time, and I'm planning on adding the following features to wvpaint next week:
- Advanced Splash Prevention
- Currently, spherical vertex selection has the tendency to accidentally paint vertices in saddle point topology, and geometry that is very thin (like a cylinder). I plan on comparing the surface normal of the 3D brush location with each vertex's normal. If the normals are orthogonal or obtuse, don't paint them. As the normals become more acute, the cooresponding vertices take on more of the brush's color.
- Smudge tool
- To replicate a smudge tool found in gimp or photoshop, I plan getting the direction that the brush is moving and using that direction to weight the blur of vertex colors/weights to a particular direction.
- Cone tool
- Instead of using a spherical vertex intersection test, we'd use a cone intersection test, where the tip of the cone is at the 3D brush location and the direction of the cone would opposite the direction the brush is moving.
- Advanced Splash Prevention
- I have some sudo code for each of these features, and I think they'll help artists out quite a bit.
- Today me and Bastien were able to roughly figure out what was causing a bug that prevented vertices from being painted.
So that's where I'm at this week. Let me know anyone has questions/feature requests! -Nate
Weekly Report #10, PBVH Painting
This week I went to a research conference to present my undergraduate research project. (If you're curious, you can see the poster here: http://www2.cose.isu.edu/~bitinat2/poster-surf.pdf ) As a result, I was rather busy creating the poster, preparing a presentation, and attending the conference. I actually just got back yesterday. The conference was a huge success, and I actually met a couple blender users who were pretty excited about the changes coming to vertex and weight painting.
This weekend I'm moving out of my temporary apartment (should be fully moved out on the 2nd), and after that I should be 100% again.
Next week, I want to have advanced splash prevention, smudge mode, and the cone paint option all working.
Let me know if you have any questions, -Nate V
Weekly Report #11, PBVH Painting
- I added smudge mode to both vertex painting and weight painting. Here's a gif: http://giphy.com/gifs/painting-blender-smudge-3o7TKwKAAXmsnDzucE
- I added advanced splash prevention. Volumetric painting inherently does a little splash prevention, but I added some code which uses normals to avoid painting back faces. Here's a gif: http://giphy.com/gifs/painting-blender-splash-prevention-3o7TKrM3yWN45PrnTq
- I added back in spray support for weight paint. Before, wpaint always 'sprayed'. Now it can be toggled off. Here's a gif: http://giphy.com/gifs/3d-painting-blender-3o6ZsZW5cUHOTBnjgs
- Today I attempted to get spray support added back to vertex paint, although I have a bug I can't seem to figure out...
- I want to add a 'fill' button, which paints the entire mesh with the selected color. This tool could be used with face selection masking to speed up painting specific selections.
- I'm going to start working on documentation on the wiki page, and start cleaning up my code. I might also start a review task on pharicator.
Let me know if you have any questions, -Nate
Weekly Report #12, PBVH Painting
- This week I worked on documenting my project. I got Arcanist/Phabricator set up on my environment and created a code review on differential. You can check it out here: https://developer.blender.org/D2150
- I forgot about texture painting support in terms of PBVH based painting, so I did some research to figure out how texture painting works. I can avoid using opengl to select vertices while still sampling the texture with the mouse coordinates. Here's a gif of texture paint up and running with PBVH painting: http://i.giphy.com/3o7TKNikvq2dQYLqaA.gif
- I wasn't able to get a 'fill' button working, since I was more concerned about texture painting support. I might get to it if I have time, but it's mostly a candy feature and I have documentation to continue working on.
Let me know if anyone has questions. -Nate
Weekly Report #13, PBVH Painting
- This week I addressed all the problems I was able to find on my pull request. I learned how to use git difftool, which was really helpful in cleaning up noisy changes. I'm a little paranoid I haven't had enough traffic on my differential page, so if anyone has time I'd really appreciate any feedback I can get.
- Here's my diff post: https://developer.blender.org/D2150
- I finished developer documentation and user documentation, which can be found here:
- GSoC Finals
Let me know if anyone has any questions, -Nate