Page MenuHome

Overlay: Retopology
Needs ReviewPublic

Authored by Jeroen Bakker (jbakker) on Sep 27 2019, 4:32 PM.
"Burninate" token, awarded by DotBow."Love" token, awarded by brilliant_ape."Love" token, awarded by tilapiatsu."Mountain of Wealth" token, awarded by TheAngerSpecialist."Mountain of Wealth" token, awarded by franMarz."Love" token, awarded by undo."Orange Medal" token, awarded by billreynish."Love" token, awarded by Rusculleda."Like" token, awarded by erickblender."Love" token, awarded by xorrito."Love" token, awarded by roman13."Love" token, awarded by andruxa696."Love" token, awarded by Brandon777."100" token, awarded by Frozen_Death_Knight."Love" token, awarded by michaelknubben."Love" token, awarded by Alrob."Like" token, awarded by 1D_Inc."Love" token, awarded by amonpaike.
This revision needs review, but there are no reviewers specified.



This patch started out as a prototype for a retopology overlay. Before we started there were
several ideas how to tackle this issue (Frontface Backface and average back+front face shifting)

In the end we go the best results by mixing back and front depth buffers including a slider. With
this situation users can control what suits best for their needs.

And this patch needs a lot of testing it changes the Depth buffer and by doing that it can
intervene with the workings of other tools that needs the original depth buffer.


  • fix depth fighting issues (rain model with mirror-modifier enabled)

Points of attention for future developments

  • When slider is set to 0.0 we should not do any depth testing. As backfaces could become visible we should separate the color drawing and the alpha blending.
  • Improve snapping tools with a collection to snap against. As how we could see it this collection might be selectable per mesh. The snapping tools will have an option to use this collection. (Use Retopology Collection) This needs a clear design and use cases.
  • After the snapping tools we could improve the drawing of the retopology overlay by ignoring objects that are not inside this collection.
  • Add option to draw the retopology faces using other colors like material viewport colors or vertex colors.

Notes from discussion with Retopoflow:

  • experiment with average buffer in stead of the depth buffer
  • what about migrating this overlay into the workbench engine (just like we do for tpaint) (future work?) the goal is for external add-ons to extend from the buffers with a DEPTH_EQUAL buffer.

Diff Detail

rB Blender
T70267 (branched from master)
Build Status
Buildable 5551
Build 5551: arc lint + arc unit

Event Timeline


Should be inset a bit


0.4, 0.5 0.2, 0.2 is the default


remove line


alpha should be 0.2


Make a decision which location should be used.

Jeroen Bakker (jbakker) marked 5 inline comments as not done.Sep 27 2019, 4:50 PM

Should we use a different name in the API?

Jeroen Bakker (jbakker) retitled this revision from Retopology: Overlay to [WIP] Retopology: Overlay.Sep 29 2019, 2:36 PM

Added Facefill
Added retopology panel
Removed hidden wire drawing code

Jeroen Bakker (jbakker) retitled this revision from [WIP] Retopology: Overlay to Overlay: Retopology.Oct 15 2019, 3:32 PM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)

Updated python panel

Yo @Jeroen Bakker (jbakker) i was trying to apply this patch to today's Master, but i m having this problem

I wanted to test it and share some feedback :)

Rebased with latest master

@Erick Tukuniata (erickblender)

I rebased with latest master. See if that works for you. Any feedback is appreciated!
BTW the devs use a tool called arcanist that will resolve these merge issues by applying the diff on the hash it was created on.

@Erick Tukuniata (erickblender)
I rebased with latest master. See if that works for you. Any feedback is appreciated!
BTW the devs use a tool called arcanist that will resolve these merge issues by applying the diff on the hash it was created on.

Thanks for the hint, but i have tried arcanist once and it was a bit complicated for me but may be i should give it another shot.
Thanks for rebasing to master and now it compiles without any problem.


  • You save us from a lot clicks, the ability to turn hidden wire and front and color in one go is marvelous.
  • The way the wires behind the mesh are hidden is really really great.

For me this can already go to master, but there is always room for improvement:

  • There is some kind of anti-aliasing problem that i circled in red
  • The fact that the feature is affecting only one viewport is minus even though i don't use two viewports to retopo.

Here is the same problem on a different pc (Nvidia)

In the image below you will see how painful it is to retopo with the actual master while all those back wires are poop in your face. Notice no anti-aliasing and the settings affect for all the viewports.

Hi, would be possible to have this overlay active on sculpt mode too? I use the smooth brush sometimes to even out the topology. Everything works great, thanks!
I know this is unrelated to this task but I'd like to have an option, during retopo, to have the circle select or lasso select to only affect front facing geometry, similar to the option "front faces only" which is available for sculpting brushes. Thanks again.

@Erick Tukuniata (erickblender) Thanks for the feedback!

The UX issues I'll leave to the tool developers, they are more familiar with the use-cases and consequences. I stick to the rendering.

That said..... we use a stencil buffer and that introduces the AA artifacts

Trickery has been added to get most of the AA working again. I haven't been able to find a good solution to remove the rest.
Implementing the overlay without the stencil buffer would slow down the drawing.

@Lucas (xorrito) enabling this mode in sculpting is complex. I am proposing changes to the drawing code that might make this possible eventually, but that needs to be discussed and agreed upon.

I gave myself the pleasure of testing this patch by retopoing an old sculpt here are 3 more feedback:

  • Sometimes, i mean it, sometimes we can select the hidden part of the mesh ( the unwanted) with the circle selection tool. This is pretty undesirable effect special since with retopo we have snapping turn on the mesh

see video:

  • There is some kinds of glitch if the Dyntopo mesh is not thick enough. This is not a big deal, i wanted just to let you know about this. see video:

The third one is just the same above that you have already answered, it will be really really good to have this in sculpt mode for the use smooth brush.

Thanks and keep up good work :)

I agree, sculpt mode retopo overlay would be really nice. Especially with the awesome relax brush Pablo Dobarro is working on. (it seems almost special made for retopology.)

I will have a look at the circle selection. Thanks for reporting

The glitch I am aware of. I wasn't able to reduce these artifacts without adding more disturbing artifacts at this moment. What you see are front faces that are not hidden by other faces. I will have a go by using two depth buffers and see if these artifacts can be reduced. Will have some negative impact on performance

Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Fri, Oct 25, 1:41 PM
Jeroen Bakker (jbakker) updated this revision to Diff 19252.EditedTue, Oct 29, 4:39 PM

Added an option for averaging the depth. This will remove the need for the stencil buffer. Removes some artifacts, but introduces others. Will need to check if it is better or not.

Stencil method

Average Depth

Jeroen Bakker (jbakker) updated this revision to Diff 19268.EditedWed, Oct 30, 11:51 AM
  • Added a slider to finetune the depth mixing

I would say all base features are added. and we could send this patch to review.

First look on the update, the slider value seems to be initialize with 50 and when adjusted it stays fixed at 1.
I will try it later with a character.

  • fix default depth_mix_factor to 0.5f when migrating old files

You're right. Was a left over from a previous test. Have added a fix.
Would love to hear what you think about it now.