Fix #103244: ghosting in Eevee with sculpt paint brush and canvas #104557

Open
Colin Marmond wants to merge 9 commits from Kdaf/blender:fix-103244-sculpt-lighting-using-paint-brush-on-image into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
5 changed files with 7 additions and 18 deletions
Showing only changes of commit 0ed5ab64fd - Show all commits

View File

@ -253,9 +253,11 @@ int EEVEE_temporal_sampling_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data
const DRWContextState *draw_ctx = DRW_context_state_get();
const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
bool painting = false;
Review

This should be hidden in DRW_state_is_navigating or a similar function. Not sure yet if we need to split DRW_state_is_navigating... Best to ask direction in the eevee-viewport-module on blender.chat.

This should be hidden in `DRW_state_is_navigating` or a similar function. Not sure yet if we need to split DRW_state_is_navigating... Best to ask direction in the eevee-viewport-module on blender.chat.
if (draw_ctx->rv3d)
painting = draw_ctx->rv3d->rflag & RV3D_PAINTING;
if (((scene_eval->eevee.taa_samples != 1) || DRW_state_is_image_render()) &&
!(draw_ctx->region->do_draw & RGN_DRAW_SINGLE_SAMPLE)) {
if (((scene_eval->eevee.taa_samples != 1) || DRW_state_is_image_render()) && !painting) {
float persmat[4][4];
if (!DRW_state_is_image_render() && (scene_eval->eevee.flag & SCE_EEVEE_TAA_REPROJECTION)) {

View File

@ -71,7 +71,6 @@ void ED_region_update_rect(struct ARegion *region);
*/
void ED_region_floating_init(struct ARegion *region);
void ED_region_tag_redraw(struct ARegion *region);
void ED_region_tag_redraw_force_single_sample(struct ARegion *region);
void ED_region_tag_redraw_partial(struct ARegion *region, const struct rcti *rct, bool rebuild);
void ED_region_tag_redraw_cursor(struct ARegion *region);
void ED_region_tag_redraw_no_rebuild(struct ARegion *region);

View File

@ -658,21 +658,12 @@ void ED_region_tag_redraw(ARegion *region)
* but python scripts can cause this to happen indirectly */
if (region && !(region->do_draw & RGN_DRAWING)) {
/* zero region means full region redraw */
region->do_draw &= ~(RGN_DRAW_PARTIAL | RGN_DRAW_NO_REBUILD | RGN_DRAW_EDITOR_OVERLAYS |
RGN_DRAW_SINGLE_SAMPLE);
region->do_draw &= ~(RGN_DRAW_PARTIAL | RGN_DRAW_NO_REBUILD | RGN_DRAW_EDITOR_OVERLAYS);
region->do_draw |= RGN_DRAW;
memset(&region->drawrct, 0, sizeof(region->drawrct));
}
}
void ED_region_tag_redraw_force_single_sample(ARegion *region)
{
if (region && !(region->do_draw & RGN_DRAWING)) {
ED_region_tag_redraw(region);
region->do_draw |= RGN_DRAW_SINGLE_SAMPLE;
}
}
void ED_region_tag_redraw_cursor(ARegion *region)
{
if (region) {
@ -683,7 +674,7 @@ void ED_region_tag_redraw_cursor(ARegion *region)
void ED_region_tag_redraw_no_rebuild(ARegion *region)
{
if (region && !(region->do_draw & (RGN_DRAWING | RGN_DRAW))) {
region->do_draw &= ~(RGN_DRAW_PARTIAL | RGN_DRAW_EDITOR_OVERLAYS | RGN_DRAW_SINGLE_SAMPLE);
region->do_draw &= ~(RGN_DRAW_PARTIAL | RGN_DRAW_EDITOR_OVERLAYS);
region->do_draw |= RGN_DRAW_NO_REBUILD;
memset(&region->drawrct, 0, sizeof(region->drawrct));
}

View File

@ -5470,7 +5470,7 @@ void SCULPT_flush_update_step(bContext *C, SculptUpdateType update_flags)
}
if ((update_flags & SCULPT_UPDATE_IMAGE) != 0) {
ED_region_tag_redraw_force_single_sample(region);
ED_region_tag_redraw(region);
if (update_flags == SCULPT_UPDATE_IMAGE) {
/* Early exit when only need to update the images. We don't want to tag any geometry updates
* that would rebuilt the PBVH. */

View File

@ -742,9 +742,6 @@ enum {
/* Only editor overlays (currently gizmos only!) should be redrawn. */
RGN_DRAW_EDITOR_OVERLAYS = 32,
/* Force single sample for some specific cases (sculpt paint tool stroke). */
RGN_DRAW_SINGLE_SAMPLE = 64,
};
#ifdef __cplusplus