On 24/1/13 4:27 AM, AlicVB wrote:
> The main thing it missed is the fallback on borders.
> Here we have many solutions :
> 1- just add a second border, parallel to the main curve
> 2- as in 1) but let the user move each corner of this second curve
> 3- use a fully separated curve
>
> Of course the more cool solution is the third one, and the more "easy"
> to code is the first one ;)
> I'm ready to implement the third one if it's needed, but I've some
> problems because I have no idea how to define this second curve. In 1)
> and 2) the 2nd curve is not a bezier curve anymore, but that's not
> really a problem as it's define as "parallel to..." (or almost) but in
> the third case, we have nothing for reference, excepting the "non
> intersecting" condition. If someone use nuke, or other tools which did
> that, I'd like to have some tips...

Nuke (and any high end tool I used so far) uses 2, not 3. Also you could 
allow the user to not only adjust each CV of the offset curve, but also 
each CV's tangents. This gives already very fine grained control.
3 is not trivial to implement, as you already figured.

The common use case is that you need more control over the granularity 
of the curve shape than its falloff. In any case, if one had a tool that 
allowed moving handles with a falloff, i.e. like moving handles in the 
Equalizer module, this would be very nice (and Nuke doesn't have this, 
btw.).

> The second point where I need some help is to render the fallback. The
> "only" solution I'm thinking about is not really optimized imho :
> for each point on the fallback, find the distance to the 2 curves and
> use that. But it implies that you have to iterate through each points of
> the 2 curves (and this for each point in the fallback)

I suggest to create a 2d bezier mesh from the two curves and recursively 
tessellate this into quads. Each corner of a quad inherits the mask 
density value from the curve, tessellated.
Once quads approach the size of a pixel, rasterize them with subpixel 
precision into a buffer -- this is your mask.

P.S.: Once you have this code, it can be used to also draw brush strokes 
with arbitrary textures (just interpolate two coordinates along the quad 
corners, instead of a density value).

.mm

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
darktable-devel mailing list
darktable-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/darktable-devel

Reply via email to