Page MenuHome

[WIP] Sculpt: stroke performance prototype
Changes PlannedPublic

Authored by Pablo Dobarro (pablodp606) on Sep 23 2020, 3:39 AM.
Tags
None
Tokens
"Love" token, awarded by ZackMercury."100" token, awarded by Kickflipkid687."Love" token, awarded by Takain."Love" token, awarded by blueprintrandom."Love" token, awarded by Tetone."Like" token, awarded by ThinkingPolygons."Love" token, awarded by DiogoX2."Love" token, awarded by bnzs."Love" token, awarded by DotBow."Mountain of Wealth" token, awarded by psy-fi."Love" token, awarded by tux21b."Love" token, awarded by Bit."Love" token, awarded by gilberto_rodrigues."Love" token, awarded by tiagoffcruz."Love" token, awarded by cet77."Love" token, awarded by mindinsomnia."100" token, awarded by Frozen_Death_Knight."Love" token, awarded by lopoIsaac."Love" token, awarded by ReinhardK."Dat Boi" token, awarded by ostapblender."Love" token, awarded by Brandon777."Love" token, awarded by erickblender.

Details

Reviewers
None
Summary

If you want to try this, only Clay Strips and Draw brushes work:

  • Use the brush default settings. Disable accumulate in Draw if it cause artifacts. Any other extra setting can fail.
  • Normal/Area sampling is still too slow, it needs to be done in a different way.
  • No dyntopo/multires
  • Flat shading
  • No undo

Diff Detail

Repository
rB Blender
Branch
sculpt-remove-pbvh-scheduler (branched from master)
Build Status
Buildable 10392
Build 10392: arc lint + arc unit

Event Timeline

Pablo Dobarro (pablodp606) requested review of this revision.Sep 23 2020, 3:39 AM
Pablo Dobarro (pablodp606) created this revision.
Pablo Dobarro (pablodp606) planned changes to this revision.Sep 23 2020, 3:39 AM
Pablo Dobarro (pablodp606) edited the summary of this revision. (Show Details)

Some quick notes reading the changed during the meeting.
More details i guess will come from Brecht.

source/blender/blenkernel/intern/pbvh.c
3054

Use BLI_parallel_range_settings_defaults.

source/blender/draw/intern/draw_manager_data.c
1025–1029

Is this really related to this change, or it can (should?) be done in master already?

source/blender/editors/sculpt_paint/sculpt.c
439–443

This seems to be unrelated to the performance.

2144–2148

Is this a no-op function?

2696–2697

Reduce scope, and use some more commonly used iterator. n is usually the upper limit of the loop, not the iterator. Iterator is usually i.

Becomes: for (int i = ...

2704–2706

Why iterator 2 is so much special?

2718–2720

I don't understand why one degenerated normal should stop the entire loop.

6433

Does this disable undo system completely?

8372

Are we disabling proxies all together?

  • Proxies and mesh restore working (grab brush now works)

Projecting textures (using mesh restore): master with 400k vertices, this patch with 1.4M vertices:

Pablo Dobarro (pablodp606) planned changes to this revision.Sep 23 2020, 7:13 PM

Wow that makes a huge difference! Do you think this will make it into 2.91?

  • Fix crash when deforming Multires
Pablo Dobarro (pablodp606) planned changes to this revision.Sep 24 2020, 3:18 PM
  • Implement Mesh Smooth brush
  • Implement data array Undo/Redo
  • Implement Draw Sharp
  • Implement Scrape
  • Optimize undo checks
  • Fix grab brush
  • Fix proxies with Multires
  • Fast Normals Updates for meshes working
Pablo Dobarro (pablodp606) planned changes to this revision.Sep 24 2020, 6:51 PM
  • Store drawbuffers in the middle of the tree (disable update bounding box updates)
Pablo Dobarro (pablodp606) planned changes to this revision.Sep 25 2020, 2:04 AM

@Sergey Sharybin (sergey) @Brecht Van Lommel (brecht) All discussed redesign are in place now. This includes

  • Use TBB for the vertex iterators. Never do multithreaded loops using the leaf nodes.
  • New Undo based on data arrays, only stores modified data.
  • Stroke proxies. Proxies are only created and combined when needed.
  • Normal updates only in modified data and in a single loop. Normal updates can be disabled per brush.
  • Draw Buffers stored in the middle of the tree. The leaf limit size is now 50 as the tree is now only used to get the affected area. Draw buffers are created for each 10k primitives.

The only missing part is updating the bounding boxes, which I still don't know how to do properly. If I update the BB with a leaf limit size of 50, it lags the same as before.
Of course this is not ready for review, but this should give us a more clear idea of what the plan should be and the performance we are going to get.

This is the performance increase in a 3990X
Before (almost one minute of lag to process the stroke):

After:

  • Rebase
  • Implement fast bounding box updates
Pablo Dobarro (pablodp606) planned changes to this revision.Sep 25 2020, 4:27 PM
Pablo Dobarro (pablodp606) retitled this revision from [WIP] Sculpt: Remove multithreaded loops using PBVHNodes to [WIP] Sculpt: stroke performance prototype.Sep 25 2020, 7:43 PM