Page MenuHome

Parallelize remesh reprojections
ClosedPublic

Authored by Erik Abrahamsson (erik85) on Aug 6 2022, 9:31 AM.
Tokens
"The World Burns" token, awarded by Frozen_Death_Knight."Yellow Medal" token, awarded by MetinSeven."Love" token, awarded by aras_p."Like" token, awarded by EAW."Like" token, awarded by 1D_Inc."Like" token, awarded by TheRedWaxPolice."Love" token, awarded by Dangry."Love" token, awarded by silex."Love" token, awarded by Crumbled.

Details

Summary

In high poly meshes the reprojections after remesh can become slow.
This patch parallelizes the reprojection of face sets, paint mask and vertex paint.

Here are before/after timelines of remeshing a 3.4M poly mesh (in sculpt mode).

Before: 19.6s
After: 8.7s

Diff Detail

Repository
rB Blender

Event Timeline

Erik Abrahamsson (erik85) requested review of this revision.Aug 6 2022, 9:31 AM
Erik Abrahamsson (erik85) created this revision.
  • Update grain size
Erik Abrahamsson (erik85) retitled this revision from Parallelize remesh reprojects to Parallelize remesh reprojections.Aug 6 2022, 9:53 AM
Erik Abrahamsson (erik85) edited the summary of this revision. (Show Details)
  • Add PROP_NO_DEG_UPDATE to remesh props.
  • Exit early if source has no face sets
This revision was not accepted when it landed; it landed in state Needs Review.Aug 7 2022, 7:49 PM
This revision was automatically updated to reflect the committed changes.

Reopening again as I accidentally pushed it and then reverted.

That's quite measurable speedup :)

Add PROP_NO_DEG_UPDATE to remesh props.

Did this get lost? or was it committed separately.

@Jacques Lucke (JacquesLucke) what.I am wondering is whether it is more readable to capture with [&] or woth [&bvhtree, &target_verts, &target_mask, &source_mask]. Do we have some guide w.r.t "capture explicitly"?
Also, shall the rather big lambda become a named predicator class?

@Sergey Sharybin (sergey) I don't think we have a general guideline for this yet. Currently my take on this is as follows:

  • When the lambda will only be called in the scope it is created in, use [&]. This is the case here.
  • In all other cases explicitly capture the variables by reference/copy. So don't use [=].

I probably wouldn't move the lambda to a separate function here. In practice I didn't find that this makes it easier for. Also, if that is done, it should probably be done separately since the patch is much simpler in its current form.

This revision is now accepted and ready to land.Sep 14 2022, 11:44 AM

That's quite measurable speedup :)

Add PROP_NO_DEG_UPDATE to remesh props.

Did this get lost? or was it committed separately.

Oh you're right, seems like that got lost when i accidentally committed this because it was in another local commit and fabricator replaced the code.

Thanks Jacques, makes sense.

On the code side the change seems good to me. So if you've tested it and confident go ahead with the commit :)

This revision was automatically updated to reflect the committed changes.