Leave Filter
  1/2   Next
 于2019/08/19

Week 12

Week 12

Things have done

  1. Made double variation of the math functions into a separate patch for review.
  2. LANPR now use BLI's math functions completely to eliminate the need of its own math library. Performance is the same as it used to be.
  3. Made LANPR software mode update into a separate thread to let the viewport draw progressively. However there are still problems within it. Probably a copied scene being freed before calculation finished.
  4. Some other code style fixes.

Next week (Post-GSoC)

  1. Stabilize progressive drawing in the viewport.
  2. Fix as many code style problems as I can.

I'm gonna continue refactoring the code and keeping the reviewing process going. Thanks for the support everyone! :)

 于2019/08/11

Week 11

Week 11

Finally into code review!

Things have done

  1. Fixed all memory problems within LANPR. (Turns out to be some batches are not freed upon quit, not drawing updates)
  2. Changed LANPR background to using world background and film transparency.
  3. Normal controlled line style now comes with default style.
  4. Fixed normal value errors in chained lines.
  5. F12 now shows rendering progress/status. Viewport rendering status not implemented yet.
  6. Various UI and code style fixes, including some doxygen styled comments, also slightly improved stability by solving some hidden access problems. Fewer crashes were observed.
  7. Split LANPR into a separate local branch, and cleaned up for code reviewing.

Next week

All about code reviewing. I'll try to attend the 10:00 CEST meeting and see what developers are thinking.

I will also include patches for other accessory modules for LANPR, including GPencil modifiers, smooth contour modifier, SVG functions and UI fixes. These patches will likely be generated upon LANPR for continuity.

LANPR's GPencil modifier doesn't have vertex weight support yet, there's only a stub on the UI. Should implement that soon, likely after LANPR is done reviewing.


Yiming

 于2019/08/03

Week 10

Week 10

Things have done

  1. Fixed most of compiler warnings in LANPR module, one or two left for better solution.
  2. Fixed shader and matrix assertions for deprecated shader. Thank to Sebastian's test.
  3. Camera projection function is updated by Antonioya, so I'll make svg output using the new one.
  4. Basic user document based on the new interface. Check back later for the link.
  5. Made many comment styles into oxygen standard. Not completely done yet.

Next week

  1. Fix warnings in SVG and GPencil module as well.
  2. Re-write GPU mode cache. (STILL!?!?)
 于2019/07/29

Week 9

Week 9

Things have done

  1. UI is settled, including LANPR main panel and modifier/separate tab (Feature line modifier configurations now in a separate tab, if LANPR engine is selected or enabled in other engines, it will appear). UI should only include minor changes in this stage.
  2. Fixed alpha problem during F12 render.
  3. Utilize the new GPencil modifier callback (with frame argument in deformStroke()) to make MultiStroke modifier more tolerant to multiple deform/generation modifier in the stack.
  4. Various code style fixes.

Next week

  1. Code fixes, eliminate warnings.
  2. Re-write GPU mode cache code path. (I'm not going to trace the memory issue in the legacy code, it's too messy...)
  3. Make SVG export function into a menu entry. (LANPR only for the moment)
  4. Check camera projection of GreasePencil, find a way for it to export view-space (flattened) stroke too.
  5. Basic documents based on the current UI workflow.
 于2019/07/20

Week 8

Week 8

Things have done

  1. Fixed segment counting errors in GPencil sample functions. Integrated the modifier with simplify modifier (became another mode in it).
  2. Multiplication modifier now renamed MultiStroke. Fixed previously not working stroke thickness variation function.
  3. Auto update GP strokes when not in LANPR engine.
  4. Moved all the non-drawing related code into editor/lanpr module, refactored naming and code structure to better align with the coding preference of blender. Also added few double version of vector math functions inside BLI math module.
  5. Normalization checkbox in GPencil thickness modifier now allows the use of curve as well.
  6. Fixed erroneous length extending modifier.
  7. Removed freestyle compile brackets regarding to edge/face mark operators. Renamed those into LANPR to keep them. Also added them back into the UI when LANPR is in use.
  8. Slight changes with GPU shader and APIs.
  9. Decided which functions are needed to merge in the first stage. The development won't focus on other stuff outside this stage's target. Good ideas will be added after this stage is completed solid. To see what we are planning to merge, check this document. We are getting so close!
  10. The GP team and me are working on a more workflow-oriented UI, which is of better consistency with current Blender UI. Will be implemented soon.

Next week

  1. UI should be mostly done with maybe only few slight changes in near the future.
  2. Vertex group support for LANPR oriented GP modifiers.
  3. Fix the stroke deform/generation order problem that one of my GP modifier induced. Should be quick as Antonioya already added frame argument in the deform callback.
  4. Still unable to fix that slight GPU memory leak somewhere in my code. Needs investigation.
  5. A Usable SVG API.
 于2019/07/08

Week 7

Week 7

Things have done

  1. Make operations in GPU and CPU modes more consistent, including object/collection usage flags and modifier selections.
  2. Option for using world background color.
  3. Rendering with background alpha now blends properly.
  4. CPU mode in viewport camera mode now aligned with actual scene, able to zoom and move around now.
  5. Initial SVG export investigation.
  6. Safer chaining value settings for CPU mode.

It's been a tough week for me the last few days. Thank god things finally cleared up on Monday :/ Next week should have a very free time frame.

Next week

  1. To Complete SVG export functions.
  2. To Complete Code style migrations, including file structure, naming conventions and internal function usages. Prepare the code to reserve time for the review.
  3. Should not have drawing errors and shader memory leaks by the end of the week.
  4. LANPR in GPencil mode will not automatically update, should fix this.
  5. GPencil Sample modifier is still problematic, fix it using another pre-process algorithm.
  6. Report says object/collection selection will not work properly in duplicated object/collections. This should not work in current code, will sure investigate this.
  7. Try remove Freestyle code base from Blender.
  8. Remove image filter mode from LANPR temporally. (It doesn't seem to get many love from the users or me :') )

If you want to use the crappy SVG exporter now...

Follow these steps:

  1. You should have a GPencil object to be exported.
  2. Select(Activate) the object, in object mode.
  3. Search(F3/Space) for "Export to SVG".
  4. Go to one of the text editors in Blender, pull the text file from the drop down selector, each corresponding to a GPencil layer.
  5. Use the text editor to save the content as *.svg file.

The file will suffer from ratio differences, way-off stroke width, filled regions, and uniform stroke pressure.

About documents

It's under way...

 于2019/07/08

SVG stuff

SVG stuff

Why

Workflow reasons. Easy connect different software.

SVG format

Here discusses the format that the proposed SVG exporter follows:

Reference from w3.org

<?xml version="1.0" standalone="no"?>
<svg width="4cm" height="4cm" viewBox="0 0 400 400"
     xmlns="http://www.w3.org/2000/svg" version="1.1">
  <title>Example triangle01- simple example of a 'path'</title>
  <desc>A path that draws a triangle</desc>
  <rect x="1" y="1" width="398" height="398"
        fill="none" stroke="blue" />
  <path d="M 100 100
           L 300 100
           L 200 300
           z"
        fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" />
</svg>

The main thing here is the <path> tag. d describes the points. The leading characters in the d string represent following meanings: (The table only includes the commands that are used in our exporter)

Command Arguments Meaning
L/l X Y Absolute/Relative line to (Actually draws stuff)
M/m X Y Absolute/Relative move to
Z/z None Close path

How to fill the d:

An example of this can be like the following, please note that you can insert new lines as space for visual clarity.

<path d="M 123 123 L 123 123 L 123 123 Z" />

To minimize the file size, the space between a command and a value can be omitted. For example, this is perfectly ok:

<path d="M123 123L123 123L123 123Z" />

Please note that the space between argument values can not be omitted.

For the fill and stroke part, they both describes color. If the tag is not present, then the path won't have such property.

In Blender, Grease pencil width value is measured 1000 as 1 Blender Unit, which is the size of a default viewport floor grid.

In SVG, if the unit is not specified, then values are all treated as px. We should follow this standard throughout the exporting process. In order to achieve DPI scale, we can specify width and height in the SVG header alone with viewbox property. If you have a 1000px wide viewbox, with a width set to 5 inch, then tis SVG file will be interpreted as a 200 dpi file (in width direction).

 于2019/07/08

LANPR: What's remaining?

LANPR: What's remaining?

Why are we discussing this

LANPR is a versatile module that could potentially have much greater extensive use in the future, its development goal grows along with the project itself now. It's not very realistic to do everything in a short period of time. So we need to distinguish what needs to be down in this stage (GSoC and shortly after), and what is reserved for the future. Here in this passage I'll propose my plan.

This stage

Propose to include these parts into the first merge, which is supposed to happen within the GSoC time frame:

  • LANPR Engine as it is now (Remove edge detection mode for it's lack of use).
  • LANPR to GP support.
  • Feature line modifier.
  • Extra GP modifiers from LANPR for supporting line styles.
  • Basic LANPR to SVG exporter (Which uses LANPR data directly).

Lower priority, if not able to then put into the next stage:

  • GP/General curve to SVG exporter (Because this may require camera transform and various other operations, like stroke solidify and so on).

Tasks to finish before we can reach the goal:

Striken out lines are done.

  • LANPR Engine
    • Slight memory bugs in GPU mode.
    • Buffer auto update outside the engine (When using GPencil).
    • Object/Collection selection for duplicated items isn't working properly.
  • GPencil
    • Sample modifier bugs.
    • Stroke thickness ineffective in duplication modifier.
    • Length modifier has some bugs.
    • generateStrokes() and deformeStroke() are in separate steps.
  • LANPR🡲SVG
    • Adapt stroke thickness and viewbox size.
    • Modal file dialog.

Actually, there's not much there left to do. I'm gonna spend most of my time making sure that those functions work in a stable state, in the mean time, I'll continue clean up the code to better meet BF's standard.

Current problems:

For LANPR auto update, it's only available for post frame change. When using GPencil as output, because the lack of drawing callback, auto update is ineffective. Currently I'm working on a workaround, a more "blender standard" way will be implemented in the future, and any help is welcomed. (It seems that the current method have some access conflict risk as it is probably running in another thread by depsgraph)

Thickness problem is solved. (Yeah!)

Stroke sample function bug is fixed.

Future plans

  • Vertex group selection in LANPR calculation.
  • Material selection in LANPR.
  • A more versatile SVG exporter for both LANPR and GPencil objects.
  • ...

We could update this part as things go along.

 于2019/07/01

GP + LANPR Usage at this stage

GP + LANPR Usage at this stage

LANPR engine alone

In order to use LANPR alone, you need to switch to LANPR engine first, in LANPR, everything is drawn by LANPR. You may find the overlay stuff a bit obscure, you can disable it.

CPU mode

When using LANPR engine, line styles are controlled by line layers. You can add/remove line layers using +/- buttons on the side. One line layer controls one set of occlusion levels. By default you can have a single level layer, which starts from 0 (Means visible), and increases incrementally (means multiple levels of occlusion). Same as QI Range in Freestyle. To use QI range, click the "Onion skin" icon on the left, which lets you select a visibility range. "Default" button creates 3 layers, which let you see the internal structures. However just click the "+" once if you only want to use visible lines.

By default, all the line types uses the same line style. If you would like to specify different styles for different types of lines, uncheck "Same Style".

When you are ready, click "Update" at the top of LANPR panel. It will calculate the lines and prepare data for drawing. If you choose "Auto Update", LANPR will automatically run once you moved a frame.

When switched to viewport render mode, you should be able to see the result immediately. If not, click the viewport once.

Chaining You can disable chaining in CPU mode. There are two thresholds that controls the chaining, default value is pretty optimal, but there have been a slight problem within image-space chaining, you may notice some wiggly lines here and there.

GPU mode

You need at least one line layer to be able to draw in GPU mode. It's always the first layer in the CPU mode.

Clicking the "Auto Update" will automatically update the intersection buffer (which should be quicker than CPU mode calculation).

To use LANPR with GPencil

If you are going to export strokes, you need to stay in other engines. There you can see a checkbox beside LANPR panel. Check it to enable. And currently only CPU mode is accepted.

You don't need to add line layers in LANPR in order to export its calculation result as GPencil strokes. The UI is removed now.

Simplest way to export LANPR strokes

Go to collection tab (which is a strange lonely tab in the middle...), Select the GPencil target object, Go back to Render🡲LANPR, click "Update GPencil Targets". Now you should be able to see the strokes. "Auto Update" should do the same thing when you change the frame but it's not working yet. If you want to replace existing frame, turn on "Override".

Object Feature Line modifier

When you have a Feature Line modifier for one of your object, When you update GP stroke, It will go into its own target. Collection target is updated lastly, all the lines (you selected) who hasn't been touched by Feature Line modifier will be added into collection target. You should also be able to use child-collection. Link duplicated collection/object reportedly doesn't work, but you could try out yourself.

Intersection lines are not associated with any objects at the moment, thus can only be added from collection target.

Usage Flag

In the collection tab and object tab, you can find LANPR usage flag (Include(Inherent)/Exclude/Occlusion Only). By default they are all in "Include(Inherent)" mode.

For collection:

Select "Exclude" or "Occlusion Only" will do the effect as the name implies. This will affect all the object in this collection unless the object has a object modifier, which will be included no matter what the collection tells it. If you check "Force", then objects with Feature Line modifier will also become "Excluded" or "Occlusion Only".

For object:

By default it's in Inherent mode. That means object usage will follow collection control. You can also override by selecting "Exclude" or "Occlusion Only".

This flag is also effective in LANPR engine, in both CPU/GPU modes.

 于2019/06/28

Week 6 Report

Week 6 Report

This week

Major stuff

  1. Fixed LANPR/GP Targets auto update when frame changes.
  2. Implemented GPencil multiply modifier. Capable of splitting strokes at a threshold angle and duplicate strokes around the original ones, fading effects included.
  3. Implemented High performance chaining algorithm, capable of handing very large scenes.
  4. Fixed Bugs in GPencil stretch modifier (now length modifier). Now you can stretch or shrink GPencil strokes, with both absolute and relative length.
  5. Fixed A bug in near-plane clipping code, now works flawlessly.

Minor stuff

  1. Usability improvements, including various interface improvements, automation and convenience functions.
  2. Modified some default values to reduce effort of adjusting them every time.
  3. Performance and stability improvements in CPU and GPU mode.
  4. Edge split modifier can be disabled using a global switch in LANPR, enabled by default, reduce the problem of feature line rendering.
  5. Various small bugs.

Tasks from the last week are all done except the remaining optimization of the Chaining algorithm.

Next week

  1. UI should still be more informative. For example, when there's no GP targets, there should be a message beside the update button.
  2. CPU mode preview improvements, including camera view and 3D view (3D: How?)
  3. GPU memory leak thing.
  4. Edge detection mode fix.
  5. Should use world's background color.
  6. Vertex group and material selection thing.
  7. I'll add when things occurs to me.

Cache update: how it works

LANPR doesn't automatically update it's data cache by default, because it's a computation-heavy task. For lighter scenes, you can enable auto update by clicking the "Auto Update" button under LANPR's mode selector, or you can manually update everything by clicking "Update" button on the right. In GPU mode, LANPR will only do Intersection cache updates to save time. If auto update is enabled, you should be able to view the result directly in your viewport when the frame is changed.

When not in LANPR engine (which means you are using GPencil objects as the result target), there's another option "Overwrite", by default it is disabled, so you can safely edit the strokes after updating. If you messed up a frame, you can re-genereate this frame by enabling "overwrite" and clicking the update button.


Original To-dos

  1. Edge Split modifier capability.
  2. Restore target GP Object location when updating (or message, or provide button)
  3. Selectively clean/update strokes for a specific object. "Update" in the modifier should only update strokes that are related to this object. Use frame force update instead. Should be able to do single target updates. (by putting update button in the target GP object).
  4. LANPR and GPencil frame data should be automatically updated by depsgraph. (After objects being moved)
  5. Chain optimization functions, including:
    • discard of very short segments
    • small loop preventing
    • overlapping reduction
  6. Don't do chains in LANPR standalone rendering. Keep the function for debug purpose for now. Chaining performance is very high now, don't need to do this.
  7. Modifiers: See this document
    • pattern: ???
    • random: ???
    • length: extending / shrinking
    • multiply: duplicating / angle splitting
    • image space projection
    • smooth: add sharp point preservation switch
  8. GP update button be put in to LANPR panel.
  9. Disable Layer settings and Effects panel when engine is not LANPR.
  10. Viewport update when clicking buttons in LANPR.
  11. GPencil viewport update when clicking buttons in LANPR.
  12. GPencil stretch function handles short segments correctly.
  13. Intersection update function.
  14. Only do intersections in GPU mode when rendering to image.
  15. GPencil stretch function will not only affect the end points some times. (Why?)
  16. A GPencil projection modifier might be needed.
  17. Higher performance chaining.
  18. Angle splitting should follow length and curvature thing (add an option).
  19. Length modifier should have percentage factor and mix factor with absolute length.
  20. Duplication density depends on the curvature.
  21. Max occlusion level.
  22. GP update button should do LANPR updates automatically as well.
  23. Delete GP strokes in target before update.
  24. Automatically update LANPR cache before drawing if auto is checked.
  25. Duplicated stroke expansion should rely on length.
  26. Contour by-pass flag for objects who has a smooth contour modifier.
  27. Near clipping decision condition fix.(Fixed, it's another bug inside.)
  28. Startup "UL" warning fix.
  29. GPU cache size selection.
  30. Layer add should increase level accordingly.
  31. Distance based GPencil thickness control (factor/switch).
  32. Occlusion mask bit.
  33. Material selection.
  34. Vertex group selection/property control.
  35. "Get connected line" doesn't need to search BA unless it's an intersection line. No adjacent info in vert, still needed.
  36. Re-chaining step should also search near-by BA's if the threshold is larger than the current BA it's in.
  37. GPU auto update 1 frame behind.
  38. Camera view follow zoom in LANPR CPU mode.
  39. Better default values for:
    • Chaining thresholds.
    • Colors.
    • Enable "ignore edge splits" by default.
  40. Background color use sky? (Alpha pre-multiply still use black)
  41. Better display in line layer list.
  42. Contour color chooser still active even when turned off.
  43. A little bit of memory leak in GPU mode.
  44. GPencil targets auto update button.
  45. Intersection enable/disable switch in GPU mode.
  46. Empty layer list prompt in GPU mode.
  47. Prompt when GPencil target is not empty at the current frame.
  48. Contour is always on.
  49. GPencil function: Dot-dash material, instead using a texture.
  50. Wiggly strokes in multiply modifier.
  51. Edge/face mark functions should be preserved, or use vertex group.
  52. Stroke duplicator should have a fade out option (curve in the future). Thickness not working properly yet.
  53. Don't use the checkbox when in LANPR engine.
  54. GPencil sample modifier still needs improvements for predictable memory allocation.
  1/2   Next