Fix #125185: Weight Paint Overlay doesn't work with EEVEE-Next

Use less or equal depth comparison for EEVEE and Overlay, since their
depths no longer match.
The main disadvantage of this approach is that material masked
transparency won't work anymore with overlays, so there's still another
(arguably not as bad) regression.

Pull Request: https://projects.blender.org/blender/blender/pulls/125722
This commit is contained in:
Miguel Pozo
2024-08-01 17:40:53 +02:00
parent 387cc06c12
commit 644e7bf309

View File

@@ -89,7 +89,13 @@ void OVERLAY_paint_cache_init(OVERLAY_Data *vedata)
case CTX_MODE_PAINT_WEIGHT: {
opacity = is_edit_mode ? 1.0 : pd->overlay.weight_paint_mode_opacity;
if (opacity > 0.0f) {
state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND_ALPHA;
state = DRW_STATE_WRITE_COLOR;
const bool is_workbench = (draw_ctx->v3d->shading.type <= OB_SOLID) ||
BKE_scene_uses_blender_workbench(draw_ctx->scene);
/* Support masked transparency in Workbench.
* EEVEE can't be supported since depth won't match. */
state |= is_workbench ? DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND_ALPHA :
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WRITE_DEPTH;
DRW_PASS_CREATE(psl->paint_color_ps, state | pd->clipping_state);
const bool do_shading = draw_ctx->v3d->shading.type != OB_WIRE;