Page MenuHome

LANPR line rendering (summer of code)
Needs ReviewPublic

Authored by YimingWu (NicksBest) on Aug 9 2019, 3:28 AM.
"Love" token, awarded by Okavango."Love" token, awarded by mistajuliax."Love" token, awarded by belich."Love" token, awarded by samytichadou."Love" token, awarded by Way."Love" token, awarded by kynu."Like" token, awarded by HARDNAX."Manufacturing Defect?" token, awarded by momotron2000."Love" token, awarded by johantri.




This is the patch for soc-2019-npr branch. Now modified as containing only LANPR changes

This patch doesn't include the following:

  • GPencil modifiers.
  • Smooth contour modifier.
  • SVG.
  • Affected UI scripts.
  • Freestyle changes.

Those above will be submitted in other diffs.

Diff Detail

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
YimingWu (NicksBest) marked 18 inline comments as done.Sep 4 2019, 8:12 AM
YimingWu (NicksBest) added inline comments.

CALLBACK_INVOKE(scene->master_collection->, IDWALK_CB_USER);

I just added this in case ID_SC, seems not crashing. But I don't know if it is correct to do so.

YimingWu (NicksBest) marked 4 inline comments as done.Sep 4 2019, 8:22 AM
YimingWu (NicksBest) added inline comments.

I'll remove snake mode completely until a better image filtering solution come up.

YimingWu (NicksBest) marked 25 inline comments as done.Sep 4 2019, 9:11 AM
YimingWu (NicksBest) added inline comments.

Removed for future implementation.


Removed with snake mode code.


Removed this functionality.

YimingWu (NicksBest) marked 7 inline comments as done.Sep 4 2019, 9:15 AM
YimingWu (NicksBest) added inline comments.

Include order fixed.

YimingWu (NicksBest) marked an inline comment as done.EditedSep 4 2019, 4:54 PM

I'm posting the updated patch for Smooth Contour and some GP modifiers as sub tasks here. (Tomorrow) They do not directly interact with LANPR but they will be included anyway. Main part is still being fixing, hopefully be ready before the end of the week.

YimingWu (NicksBest) marked 2 inline comments as done.Sep 5 2019, 5:55 AM
YimingWu (NicksBest) marked 3 inline comments as done.Sep 5 2019, 9:23 AM

Update on the fixes. This is still the LANPR bulk.

There are too many conflicts when updating the modifier code, probably due to the wrong index somewhere in the git. I'll clean up more later.

Dalai Felinto (dfelinto) retitled this revision from soc-2019-npr LANPR Patch to LANPR line rendering (summer of code).Sep 10 2019, 9:56 PM

Changed target material and layer selector from number into string selector.

Multiple layer and material for different line types is implemented.

Auto update in LANPR mode is problematic due to evaluated scene being deleted before background evaluation finishes. Still looking for solution for this.

YimingWu (NicksBest) edited the summary of this revision. (Show Details)

Undone Freestyle changes.

A symbol problem in one of the python script. Fixed. Sorry...

Removed MOD_Featureline.c. No longer needed.

YimingWu (NicksBest) marked 2 inline comments as done.Sep 12 2019, 10:39 AM
Way awarded a token.Sep 13 2019, 8:37 PM
YimingWu (NicksBest) updated this revision to Diff 19263.EditedWed, Oct 30, 9:39 AM


  • Shader variables naming now consistent.
  • There used to be another merge problem from long time ago in one of the eevee shaders now fixed.
  • Included camera and object UI panels for easy debugging. (other UI changes in separate child patch)
  • Fixed reportedly wrong edge flags for intersection and material separator lines.

For compiling, use temp-lanpr-cleanup2 because it seems that I messed up temp-lanpr-cleanup Commits again...
temp-lanpr-cleanup is ok now., use temp-lanpr-cleanup2 instead.

This diff is in sync with 2.82 master

Looks like after some diff operations I've managed to make temp-lanpr-cleanup working again. Let me check if I the second branch can be deleted.

Removed "reset object transformations" script for grease pencil target.

It's not needed, and LANPR should take care of the target transformation when exporting to grease-pencil.

Deleted temp-lanpr-cleanup, use temp-lanpr-cleanup2 instead.

2 Fixes:

  • Occlusion limit value error when it's the first ever calculation.
  • Occasional memory leaks when scenes were created differently.

I don't think this was fixed (?)

If we disregard the object name issue, you shouldn't need to reset transformations on objects.
The render engine should be able to handle objects that have transformations.

Sorry, the file was probably merged back from anther temp branch. Now fixed.


  • Removed the redundant is_unit_transformation() script.

These should still stay the same as before I think.

So no name renaming, simply reuse the freestyle data types.


Same here.


Same here.

YimingWu (NicksBest) marked 3 inline comments as done.


  • Reverted "lanpr" to "freestyle" for edge mark operators.

Cleaned up lanpr conditions in

Added freestyle option back for the edge mark UI.

Added compiler options for LANPR in various places. Now you will be able to compile with or without LANPR.

Added build options for LANPR in python scripts.

3360 ↗(On Diff #19363)

Why was this changed? I would think that LANPR wouldn't handle smoke anyways.

If this has to do with mesh data, then I think we need to make sure that this doesn't break anything.


Is there a reason why the lines here are commented?

YimingWu (NicksBest) marked an inline comment as done.

Reverted the changes in smoke.c to origin/master

YimingWu (NicksBest) marked an inline comment as done.Mon, Nov 4, 2:32 PM
YimingWu (NicksBest) added inline comments.

This used to cause runtime crashes. Not entirely sure what are the difference between direct_link_scene and lib_link_scene. I'll do some inspections. Currently things are working correctly, So I might remove this part.


Missing braces {} around the if statements in this part of the file.


I talked to Bastien and you can remove the commented lines here. (Also the now empty for loop too).


deg and rad can be removed as they don't seem to be used anymore in the code.


This is still used in one place in the code source/blender/draw/engines/lanpr/lanpr_snake.c. Replace it and remove the define here.


It there any specific reason why these two are set to 3e30?

It is fine if these numbers are from testing, but I think there should be a comment simply explaining where this number comes from.

YimingWu (NicksBest) marked 2 inline comments as done.
  • Removed redundant code in readfile.c
  • Fixed the bracket issue.
YimingWu (NicksBest) marked 4 inline comments as done.
  • More clear statement for endpoint flag value in chain drawing.
  • Removed redundant snake mode file. Cleaned up header defines.

Added compiler switch in the space_api folder.

Fixed memory leak when using auto update in the viewport.