Page MenuHome

Overlay: Fade Inactive Geometry

Authored by Pablo Dobarro (pablodp606) on Aug 22 2020, 7:00 PM.
"Pterodactyl" token, awarded by shader."Like" token, awarded by Fracture128."Love" token, awarded by tiagoffcruz."Love" token, awarded by franMarz."Burninate" token, awarded by Brandon777."Burninate" token, awarded by fclem."Love" token, awarded by astrand130."Love" token, awarded by jmztn."Love" token, awarded by rbx775."Burninate" token, awarded by n-pigeon."100" token, awarded by Frozen_Death_Knight."Love" token, awarded by lopoIsaac."Love" token, awarded by RodDavis."Love" token, awarded by andruxa696.



Same functionality as D7516 but implemented as an overlay instead of
changing the workbench material color.
This is especially needed for sculpt mode as there is no other overlay
or indication in the viewport to display which object is active.

This is intended to be used with D7510 in order to have a faster
workflow when sculpting models with multiple objects.

Diff Detail

rB Blender

Event Timeline

Pablo Dobarro (pablodp606) requested review of this revision.Aug 22 2020, 7:00 PM

Personally I dislike the term darken. I would name it something like Mask Inactive.
Would it be that it is better for some themes to render them with a different color. Perhaps it should be theme-able or merge with the background color when in Solid/wireframe mode.

7 ↗(On Diff #28063)

Use gpu_shader_uniform_color_frag.glsl

7 ↗(On Diff #28063)

Use facing_vert.glsl, but rename to a more common name. We already have depth_only_vert.glsl that is also the same, but would leave that one separate. perhaps position_only_vert.glsl

@Jeroen Bakker (jbakker) Maybe the name could be “fade inactive” and mix background color instead of black? Mask inactive sounds like the user did something to make those objects not editable, and it is just an overlay.

Pablo Dobarro (pablodp606) marked 2 inline comments as done.
Pablo Dobarro (pablodp606) edited the summary of this revision. (Show Details)
  • Review Update: remove duplicated shaders and fade background color

I removed all shaders and use OVERLAY_shader_uniform_color instead. This is now using the background color instead of black. It looks like this

If this is ok, then it should probably be renamed to fade inactive.

53 ↗(On Diff #28110)

Maybe this should be part of ED_view3d_background_color_get?

This has quite a performance impact as it draws every inactive mesh YET another time. But it's the same issue we have for bone selection. I was thinking of a stencil buffer trick to invert the number of object to draw.
But that is a bit more tricky: You would have to draw the active object with stencil on. Then draw a fullscreen pass with the color of choice + the render alpha (to conserve AA borders) with stencil test set to NOT_EQUAL. This would be much faster as only one object would need to be rendered and only render stencil.
This would needs to happen just after OVERLAY_background_draw to not get in the way of the other overlays. This is a bit more tricky so I don't mind doing it afterwards.

The idea itself is kindof a semi-isolation mode and I quite like it!
Qestion: Does it work in any mode?

Maybe we should use the same overlay for bone selection.

+1 for renaming it fade inactive / overlay_fade in the code.

  • Rename Overlay Darken to Overlay Fade
Pablo Dobarro (pablodp606) retitled this revision from Overlay: Darken Inactive Geometry to Overlay: Fade Inactive Geometry.Aug 25 2020, 5:32 PM

Qestion: Does it work in any mode?

Yes, it works in all modes except for Pose and Object (Pose was disabled following some comments in D7516, this can be changed in overlay_should_fade_object)

Clément Foucault (fclem) requested changes to this revision.Sep 17 2020, 3:00 PM

I really think this should be only drawing the active mesh.
Another approach. No stencil, just after the OVERLAY_background_draw:

  • Render fullscreen black fade layer, only where the the render has alpha (inverse logic of the background shader).
  • Render the sculpt active mesh without blending and override the pixel color to be (0.0f, 0.0f, 0.0f, 0.0f), thus making the render color show 100%.
This revision now requires changes to proceed.Sep 17 2020, 3:00 PM

@Clément Foucault (fclem) I remember that there was a bug report after adding the Face Sets overlay that it was causing performance issues in sculpt mode drawing because it needed to draw the entire mesh twice using the PBVH (now it only draws that overlay when there are Face Sets of a color that is not white). I would say that for Sculpt Mode on projects that require high poly meshes, it should be faster to redraw all objects except for the active one instead of just the active one. Other objects will likely be in Multires at a lower preview resolution, the active will have full resolution and drawing performance will directly affect stroke performance.
As an example, I'm considering performance in a 96M vertex scene like this one.

Will, I did not consider the case where the active object is higher resolution than rest of the scene.

With this assumption I think the patch is fine.

This revision is now accepted and ready to land.Sep 17 2020, 3:59 PM
This revision was automatically updated to reflect the committed changes.

Qestion: Does it work in any mode?

Yes, it works in all modes except for Pose and Object (Pose was disabled following some comments in D7516, this can be changed in overlay_should_fade_object)

Should we communicate this a bit better in the UI?
Right now it shows in all modes [can already see the bugreports coming]
Also it doesnt work for GPencil afaict [any mode]

There was a bit of a discussion in D7516 about this being useful in other modes than sculptmode.

  • we do have it in editmode now -- enabled by default (was this intended?)
  • we do have it in other modes now to (weightpaint?, also not sure about vertex-/texturepaint) -- enabled by default (was this intended?)
  • just noting this because if I read correctly, this has a performance penalty for no obvious benefit...