[Soc-2014-dev] Weekly Report #13: NURBS Modernization

Jonathan deWerd jjoonathan at gmail.com
Tue Aug 19 20:30:53 CEST 2014


On Aug 19, 2014, at 5:30 AM, Sergey Sharybin <sergey.vfx at gmail.com> wrote:

> I'm not really sure why you spent time on adding some new functionality (which is not even documented and in the really questionable way) at the last coding week instead of making sure someone can actually test your work.
> - What is the whole point of the NURBS UV editor? And when this raised in the project?
I added the new functionality to make sure people could test my work. Both you and Ton were surprised and displeased when you found that the only way to get trims in Blender was to import a Rhino file. We never made specific plans for how to edit trims in blender but you said (and I agreed) that not being able to do this was "very bad" -- so I dropped what I was doing and prioritized the feature that allowed users to define and edit trims in Blender.

It would be nice to have the ability to define and edit trims from the 3D viewer. I sketched out several possible strategies to do this, but they all required nontrivial math that would have taken too long to get working well. The UV Editor is the "minimum viable product" and even so it barely managed to arrive on time. Since the UV Editor is needed both in the big picture (texturing NURBS, editing tessellations, aligning supersurfaces) and in the little picture (I need in-blender trim editing to show off my work) I still think it was a good move. But regardless of whether it was "good," it was necessary.

> Sample .blend files were requested ages ago, but the whole work is still remains a mystery (apart from some screenshots in the wiki which are not so much informative).
I put a sample .blend file in the wiki last week and importable Rhino files since ~midterm time.

http://wiki.blender.org/index.php/User:Jjoonathan/NURBS_UVEdit  search for "Sample_trimmed_nurbs.blend"

> - C90 is still not met, you've got loads of cases when you mix code and declarations. Here's the patch for you http://www.pasteall.org/53523/diff (and hey, most of the stuff i already sent to you like 2 weeks ago) 
> - This is tuesday already, and there's still C++11 existing in the code (c'mon, it takes 3min to zap it), also there's still no final summary page.
Thanks for the patch. The holdup on my end is not fixing the nonconforming C90 and C++11 bits, it's finding them in such a way that I know I have found all of them. I have put a total of ~2 working days into this task. Clang's dialect options (e.g. "-ansi", "-std=c89", "-std=gnu89", "-std=c90", etc) seem to be too strict to compile at all (errors everywhere in blender), too lenient to catch the nonconforming bits, or put out so many warnings that the interesting nonconforming bits are very difficult to find in millions of "extra semicolon", "comma at end of enum", etc warnings (officially those are C99 features?). It is a nontrivial task to use GCC because Xcode doesn't seem to support it and CMake seems to require tweaking to discover the 3rd party GCC installs even for "Unix Makefile" builds (and then gcc complains about the libraries in ../lib). I set up VS2013 on a Windows computer as an alternative but now the computer doesn't boot (and "automatic repair", whatever that's supposed to do, doesn't work) :/

I did manage to get Clang to emit useful errors for C89 violations. I have not managed to get it to emit useful C++98 violations. If I can't get it working in a few hours I'll try the buildbots.

> - It's too early to prepare patch for the review, the branch is to be cleaned up.
Yes. Now that the NURBS UV Editor ("Trim Editor"?) has reached minimum-viable-product status I will focus on cleanup.

> Things to be done ASAP:
> - Make sure your branch compiles for average artist (my bet is that the proposed patch makes it compilable, but it might be some extra things required)
I assume this means "builds on Windows/Linux with gcc". I'll grab some virtual machines and see what I can do. While those are building, I'll try the buildbot.

> - Write the final documentation, making sure artists can follow it and see the benefits
In progress.

> - Prepare sample .blend files which demonstrates the new functionality (which keeps being requested since weeks ago!)
It has been done since weeks ago :P

> And by ASAP i mean really ASAP, evaluation deadline is on friday.
Yep.

> On Sat, Aug 16, 2014 at 1:06 PM, Jonathan deWerd <jjoonathan at gmail.com> wrote:
> Progress:
> * Added editing functionality to the NURBS UV Editor.
> 	Knots and trim control vertices can be selected and G-key dragged
> 	Sundry selection tools (border select, invert selection, select all, etc)
> 	Add Trim menu, can delete trim with 'x'
> 	"View All" zooms the UV Editor over the set of active UV patches
> 	Added entries in the theme table to configure colors in the NURBS UV editor (trims get colored based on whether they are AND/SUB/ADD)
> * I got a build set up in Visual Studio for ensuring C89 (and C++90) compliance.
> 
> This Weekend:
> * Burn away all C99 and C++11 syntax sugar I was using, get things building in VS
> * Smash the NURBS branch into a patch for review
> * Write the final summary page
> 
> 
> This is my last weekly report, but seeing as I still have to assemble the final wiki page & such this weekend it won't be my last progress email to soc-2014. Therefore I'll hold off on the goodbyes for now :)
> 
> Cheers,
> Jon
> 
> On Aug 9, 2014, at 4:09 AM, Jonathan deWerd <jjoonathan at gmail.com> wrote:
>> http://wiki.blender.org/index.php/User:Jjoonathan/NURBS_UVEdit
>> 
>> Progress:
>> * Fixed algorithmic bug causing trim to fail if trim curve intersected vertex. This was a critical bug that prevented all but specially crafted trim curves from being created/imported.
>> * Added proper N-gon and per-loop normal support to the convert-to-mesh operator (higher quality meshes, supports curves with kinks)
>> * Added UV editor for trim curves. Visualization functionality is mostly complete; editing functionality is in progress (selections propagate but that's it).
>> * Fixed bug in .blend read/write code for NurbTrim that prevented undo manager from working and merged it back into my main soc-2014-nurbs branch
>> * Spent time trying to compile in C90 mode, but I can't seem to do any of 1. persuade clang to emit C90 nitpicky errors (variables declared at beginning of function etc) 2. build in Xcode with gcc 3. build using UNIX makefiles with gcc.
>> 
>> This weekend (i.e. before soft pencils-down):
>> * Finish edit functionality in UV Editor (add buttons to call add curve, move control points, simplify operators etc)
>> * Rotation surfaces
>> * Revive Zak's buggy loft/sweep NURBS surface creation code I recently unearthed in contrib
>> 
>> Next week (i.e. after soft pencils-down, before hard pencils-down):
>> * Get build working on a linux or windows computer (I think I had one working in December on Windows using VS) so that I can actually see the C90 errors
>> * Test and bugfix. I suspect there is enough to do on that front to keep me busy all week.
>> 
>> 
>> 
>> 
>> On Aug 2, 2014, at 2:34 AM, Jonathan deWerd <jjoonathan at gmail.com> wrote:
>>> Progress:
>>> * Finished trim curve tessellator [1]
>>> * Finished code to read/write trim curves from a .blend
>>> * Added loop-select modifier for NURBS control points (selects a U row or V column)
>>> * Minor UI tweaks (control mesh is thinner and Z-tested, NURBS weight is disambiguated from softbody weight, etc)
>>> * Wrote code to dump internal NURBS state from Blender into GLSL visualizer to track down a lingering bug (see below)
>>> 
>>> This weekend:
>>> * Track down the trim bug that is causing an explosion of trim polygon edges whenever a straight line runs parallel to an edge of a tessellation poly
>>> 
>>> Next week:
>>> * Rotation surfaces
>>> * Fix a bunch of style issues and warnings that Sergey brought to my attention
>>> * Prepare a squashed merge
>>> 
>>> [1] Two weeks ago I accidentally reported finishing trim curve tessellator when I meant to report that I had finished the surface tessellator. I later clarified the matter, but to resolve all doubt: this week both are finished. Well, except for the bug I mentioned, which is currently blocking the more complex demos.
>>> 
>>> On Jul 26, 2014, at 3:43 AM, Jonathan deWerd <jjoonathan at gmail.com> wrote:
>>> 
>>>> This week was largely eaten up by a task that I thought would be a quick copy/paste job but turned into a morass of debugging math code. Fortunately that part is done -- and the result is much prettier smooth curves:
>>>> 
>>>> http://wiki.blender.org/index.php/User:Jjoonathan/New_NURBS_Eval
>>>> 
>>>> Progress This Week:
>>>> * Finished the new evaluation code. Key features:
>>>> 	* Computes any number of partial derivatives analytically
>>>> 	* Immediate application 1: compute normals analytically = it looks smooth again :)
>>>> 		* No nasty lighting artifacts near trim edges
>>>> 		* No seams where curves touch/loop due to calculating normals at polygon corners
>>>> 	* Immediate application 2: handle (literal) edge cases of eval points lying on knots correctly
>>>> 	* Immediate application 3: uses 1/2 as many divisions, so possibly it's faster, although I didn't check
>>>> 	* Future application: computing error bounds
>>>> * Performed extensive verification of the new eval code
>>>> 	* Mesh points coincide with Rhino surfaces
>>>> 	* All 1st, 2nd (partial) derivatives agree with Mathematica's NURBS implementation (direction, amplitude correct).
>>>> * Made progress on the trim curve tessellator.
>>>> 	* NOTE: last week I mistakingly said that I had finished the trim curve tessellator when I actually meant to say that I had finished the surface tessellator.
>>>> 	* Refactored the import code so that it can make detatched curves
>>>> 	* Adjusted memory management & blenloader
>>>> 	* The trim curve tessellator isn't a sticking point, I only got around to working on it again today. The eval code was the sticking point.
>>>> 
>>>> Things that were done that don't officially constitute progress:
>>>> * Spent Thursday finishing rotation surface & interpolation surface chapters in P&T
>>>> 
>>>> Things that must be done before I can import the sample .3dm files:
>>>> * Finish the trim curve tessellator
>>>> * Rotation surfaces
>>>> 
>>>> Things I could use help on:
>>>> * Does anyone know of good example code for making a BMesh out of n-gons? N-gons would make the meshes produced by Alt+C *much* cleaner.
>>>> 
>>>> 
>>>> 
>>>> On Jul 19, 2014, at 1:28 PM, claas kuhnen <info at ckbrd.de> wrote:
>>>>> So agree I am very excited about this
>>>>> 
>>>>> On Jul 19, 2014 1:27 PM, "Sergey Sharybin" <sergey.vfx at gmail.com> wrote:
>>>>> Seems to be rather nice progress. Would be cool if all the bits are committed and some .blend in shared which demonstrates the stuff.
>>>>> 
>>>>> 
>>>>> On Sat, Jul 19, 2014 at 4:31 PM, Jonathan deWerd <jjoonathan at gmail.com> wrote:
>>>>> Progress:
>>>>> * Finished code to tessellate trim curves!
>>>>>         see: http://wiki.blender.org/index.php/User:Jjoonathan/NURBS_In_Blender
>>>>> * Rewrote knot code to match the conventions in the math literature, tested for compatibility by comparing meshes
>>>>> * Worked on adapting a better NURBS evaluation algorithm that can produce first and second derivatives (for normals and error bounds, respectively).
>>>>>         it's still buggy.
>>>>> * Worked further on the NurbEdge interface to handle imported trim curves
>>>>>         still working on code to match endpoints that are separated in UV space but coincide in R3 due to either wrapping in UV space (cyclic NURBS) or coving
>>>>> 
>>>>> Todo:
>>>>> * Finish tracking down the NaN-producing bugs in the new surface evaluator
>>>>>         From there, should be easy to implement good normals
>>>>> * Finish NurbEdge so that it at least handles wrapping in UV space. This will allow importing of most .3dm files.
>>>>> * Implement revolution surfaces.
>>>>>         Demo Claas's hairdryer model!
>>>>> 
>>>>> On Jul 12, 2014, at 11:14 AM, Jonathan deWerd <jjoonathan at gmail.com> wrote:
>>>>> 
>>>>> > (Apologies if this is a duplicate email. I see a copy of this email in gmail's "sent" folder but I don't see one in my inbox, so I'm sending again.)
>>>>> >
>>>>> > Progress:
>>>>> > * Finished the code that traverses BReps from 3dm files and cuts them into surfaces
>>>>> > * 2D Trim curves import as Nurb objects that are appended to a NurbList in their parent surface
>>>>> >       Just curves currently, I still have to get multi-part loops working
>>>>> >       Also they don't seem to be preserved by DNA even after calling makesdna...
>>>>> > * Moved surf_gridmesh into bf_blenkernel, promoted curve.c to curve.cpp (for future OpenNurbs use), fixed a few small bugs that caused, moved the GLUT debug code into blender/tests, convinced CMake to build and link it
>>>>> > * Wrote, debugged the method that builds the displist from the gridmesh
>>>>> > * Timed it, see pretty graph a few emails back
>>>>> > * Started writing NurbEdge structure to handle in general the sewing of trim edges and cyclic edges (e.g. so that spheres don't have seams)
>>>>> >
>>>>> > Next up:
>>>>> > * I still need to finish the code that tessellates the trim curves. I didn't get much time to work on it today, so I'm planning to work on it tomorrow as well.
>>>>> > * Get trim curves to load/save from .blend files by figuring out what I'm doing wrong with makesdna
>>>>> > * Finish NurbEdge interface for defining edges to sew, get it in DNA as well
>>>>> > * Use NurbEdge to implement revolution surfaces
>>>>> >
>>>>> 
>>>>> _______________________________________________
>>>>> Soc-2014-dev mailing list
>>>>> Soc-2014-dev at blender.org
>>>>> http://lists.blender.org/mailman/listinfo/soc-2014-dev
>>>>> 
>>>>> 
>>>>> 
>>>>> -- 
>>>>> With best regards, Sergey Sharybin
>>>>> 
>>>>> _______________________________________________
>>>>> Soc-2014-dev mailing list
>>>>> Soc-2014-dev at blender.org
>>>>> http://lists.blender.org/mailman/listinfo/soc-2014-dev
>>>>> 
>>>>> _______________________________________________
>>>>> Soc-2014-dev mailing list
>>>>> Soc-2014-dev at blender.org
>>>>> http://lists.blender.org/mailman/listinfo/soc-2014-dev
>>>> 
>>> 
>> 
> 
> 
> _______________________________________________
> Soc-2014-dev mailing list
> Soc-2014-dev at blender.org
> http://lists.blender.org/mailman/listinfo/soc-2014-dev
> 
> 
> 
> 
> -- 
> With best regards, Sergey Sharybin
> _______________________________________________
> Soc-2014-dev mailing list
> Soc-2014-dev at blender.org
> http://lists.blender.org/mailman/listinfo/soc-2014-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/soc-2014-dev/attachments/20140819/bdaa3bc8/attachment-0001.htm 


More information about the Soc-2014-dev mailing list