User:Yiming/LineArt Modifier Continued

Line Art Modifier Continued

Development log for Line Art modifier...

0329 - 0404

  • Updated fading control and fixed curve ineffective bug in GPencil opacity/thickness modifiers.

0405 - 0411

  • Separate memories for line art run time structure and result data.
    • Use PointCache structure to do line art caching control for each frame. Disregarded, PointCache was not intended to work that way.

I made the boeing 727 file for demonstrating line art capability over the span of this week. Now on Blender Cloud.

0412 - 0418

  • New threaded loading code.
    • Better load spreading on loading code so threads handles similar amount of geometries.
    • Performance benchmark shows ~50% performance increase when loading the geometry.
  • Line Art now accepts multiple edge types for one edge.
  • Better tiling strategy for ortho and perspective camera. Different treatment for different camera types.
    • ~5-10% performance increase overall.
  • UI fixes for master.
  • Manual updates according to those changes.

0419 - 0425

  • Use array instead of list (as suggested by Falk David) for tile linked triangle list.
    • ~40% Performance increase in tested file in Release build. Depending on the distribution of the geometry, performance may vary but will be substantially faster.
  • Cache for modifier stack. Now line art runs only once for each modifier stack.
  • Manual updates.
  • Tried threading current intersection detection method but failed :/.

0426 - 0502

  • Added a use_cache switch so line art is more flexible in situations like filtering different vertex groups, using different chaining settings and so on.
    • [TODO] Should use a better code path where the ones that "doesn't use cache" will calculate less because there will be no source outside specified be shown.
  • Stroke offset function, this allows line art to be used with hand-drawn gpencil objects and produce correct occlusion using viewport depth instead of shown in front.
  • Fading patch in master now.
  • Still manual updates and various other tweaks.
  • Made some icons here.

Bug Fixes:

  • Fix incorrect fov when sensor fit is not Auto. (in master)

I went back to Chengdu for 3 days during Labour Day holiday for some family matters.

0503 - 0509

  • Occlusion effectiveness function: Specify materials to have 0-3 levels of equivalent occlusion. Suitable for complex structures where you want to manually control the density of lines.
  • Floating edge type can be selected separately.
    • Clipping has wrong behavior. Fixed.
  • Added a anti-jaggy algorithm post chaining, so this allows "angle split" function to work much better because there will now be no zig zag chaining paths.
  • Basic intersection filtering.

0510 - 0516

Mainly small fixes this week. Preparing patches for merging into new version of Blender.

  • Better chaining handling for floating edges where those edges were mainly for rendering small details that you might not want chain them together.
    • This and duplicated edge type can be toggled now.
  • Use array also for tile linked edges. With some performance boost.
  • Can now use face mark to filter edges.

0517 - 0523

Mainly preparing the patches this week.

  • Experimented with BVH for line art intersection calculation, current performance on par with legacy algorithm, but can be easily threaded. So there will be more improvements.

Bug Fixes:

  • Fix T88464: Incorrect baking with camera markers.

0524 - 0530

(In progress)

  • Naming conventions are fixed and merged.
  • List optimization merged.
  • use_lights option in adding GPencil object.

0531 - 0606

  • Allow custom camera to be selected as line art rendering source. This allows baking multiple camera views at once.
    • In stroke composition, an option to move strokes towards active camera or the selected one.
  • Better tolerance for faces that are perpendicular to view.
  • Fixed edge clipping index error.
  • Camera overscan (fixed value).
    • Discard edges that are out of frame. Need a frustum check to be even faster (don't even load objects that are outside view).

0607 - 0613

  • Adjustable camera overscan.
    • Also fixed an old bug where shifting would cause line art internal FOV to change. Now shifting works properly also with overscan.
  • Move BMesh conversion into loader worker thread so the loading is even faster.
  • Frustum culling now working.
  • Added custom vector (3f) in bGPDspoint, allows storage of line art normal in GPencil points for later manipulation. We then decided to go the custom data route so this is discarded.
  • Light based contour.

0614 - 0620

  • Cache patch and UI adjustment (now in master).
  • Made all remaining patches that relies on Cache/Threaded-loading/Line-type up to date with latest master here:
  • BVH based triangle intersection test is running correctly now, benchmarked to be a little bit faster in my test files that my legacy algorithm.
    • The math portion could be further sped up as my algo has a "fuzzier" tolerance than the one included in BLI_math.h and I return early in a lot of cases. So this needs some testing.
  • Fixed override limits to only include modifiers that's using cache instead of setting the value "globally".
  • Cleaned up remaining local branches.

0621 - 0627

  • While waiting for next bunch of reviews, trying to get Sebastian's smooth contour mesh modifier working...
    • Tried, BMesh seem to produce some assertion errors upon some normals that has "not correct length". And when it doesn't produce any errors, it doesn't produce calculated result :(
  • More patches went into master so the backlog is getting smaller.
  • Fixed edge type overlapping issue where sometimes edge mark doesn't show up with crease priority being too high and errors in early return.
  • Mesh smooth shading and mark sharp support.
  • Fix light contour default behaviour.
  • Hide collection tab when scene master collection is active.
  • Length modifier extension now follows curvature (curvature sample method is still being discussed).

0628 - 0704

  • Fix UI stuff.
    • Also made intersection/material mask bits into 8 bits for more flexibility and simplicity in flag transferring.
    • Change occlusion effectiveness into "material mask" name for better clarity.
    • Rename "floating"->"loose".
  • Merged intersection filtering code into master.
  • Back face culling option now available, automatically turned on when max occlusion level == 0 (only visible faces).
  • Threaded intersection calculation, preliminary ~50% increase of speed in intersection stage.

0705 - 0711

  • Fix culled triangle material mask assignment.
  • Various UI fixes.
  • Fix ineffective modifier apply caused by wrong flag in cache.
  • Branch lineart-shadow:
    • Started coding shadow support. Basic code path is laid out.
  • GPencil:

0712 - 0718

  • Discussed about line art UI clean ups, some back and forth an it's committed now. (
  • Branch lineart-shadow:
    • Able to run basic shadow now, parallel and perspective light projection working correctly in terms of geometry.
    • Edge cutting flag fixes, now projection cuts correctly in terms of visual result. May have some zero-length duplicated cut somewhere uncaught, fixed chaining algorithm to discard zero length segments.
  • GPencil:
    • Dash modifier back and forth. Mainly changed it to list instead of a weird looking table. Some bug fixes.

0719 - 0725

  • Branch lineart-shadow:
    • Div by 0 error caught, now no flying lines is visible. (Need to check if projection onto intersected triangles produce correct result)
    • Because the shadow is projected on to triangles so the traditional occlusion algorithm needs to know if it's on the front or the back face of said triangle or it will not calculate correct occlusion result from it. Because lack of edge-triangle pair reference across two runs of line art, it's gonna take some time to do this properly. Now the code for determining front/back is added, only need to have that pair reference info to be available.
    • Shadow branch has higher numeric stability in terms of triangle-edge relationship algorithm, maybe I'll modify the legacy code and make line art own occlusion stage more robust as well.
  • GPencil:
    • Dash modifier animation problem solved. The patch is Almost okay, waiting for approval. (
    • Further discussion about length modifier curve behaviour with Sebastian on the transformation method and end-point drifting problem, added inverted curve and curvature fading option. (
    • Researching a probable curve modifier for gpencil.