Fix #103244: ghosting in Eevee with sculpt paint brush and canvas #104557
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#104557
Loading…
Reference in New Issue
No description provided.
Delete Branch "Kdaf/blender:fix-103244-sculpt-lighting-using-paint-brush-on-image"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When the user is drawing on an image with the paint brush in sculpt mode, the mutlisamping is creating ghosting (because of the optimisation of redrawing when only an image is modified).
To fix it (and improve perfs), I created a new region tag redraw function, forcing 1 sample redraw.
This fixes the issue of ghosting, and limit the number of samples to 1 during paint stokes.
PS : (maybe extend it to all sculpt brushes ? it could optimize a bit the redrawing)
{{Issue|103244}} Fix shading in Eevee when using the canvas option in the paint brush (sculpt mode).to #103244: fix shading in Eevee when using the canvas option in the paint brush (sculpt mode).Do you have an example when this happens. It would make the PR more clear.
eg. with what setup is recalc shading needed, when only the texture pixels are changed. Recalc shading is an expensive process and can lead to performance penalties. For that reason there was an early exit.
I linked an example for illustration, and added a more specific condition for the shading redraw.
I'm sorry that this so little fix takes so much time, I'm also exploring the source code to get used to it in the future.
@ -5380,6 +5381,10 @@ void SCULPT_flush_update_step(bContext *C, SculptUpdateType update_flags)
if ((update_flags & SCULPT_UPDATE_IMAGE) != 0) {
ED_region_tag_redraw(region);
if (update_flags == SCULPT_UPDATE_IMAGE) {
if (ELEM(v3d->shading.type, OB_MATERIAL, OB_TEXTURE, OB_RENDER)) {
I see what you're doing and why you have chosen this solution. I did have something else in mind to fix this, what doesn't need re-evaluating materials, shaders etc.
When the user is painting (Paint model operator is active) eevee should only use a single sample.
When the user finishes the stroke the rest of the samples can be calculated.
The ghosting effect appears as previous samples might have different colors. Blending multiple samples together leads to the ghosting. By just drawing a single sample we can make sure ghosting isn't working.
Although the final result is the same, I expect it to be lighter on the painting pipeline and improves the performance when using larger textures and complexer shaders.
We should prototype the other approach and see which one would be better in terms of performance and maintencance.
Oh, my bad, now I see the difference you are talking about. But I'm not sure how to start this prototype, as I do not have enough knowledge on this area.
Should I take the time, or is this patch needed in a short delay ?
#103244: fix shading in Eevee when using the canvas option in the paint brush (sculpt mode).to WIP: #103244: fix shading in Eevee when using the canvas option in the paint brush (sculpt mode).I have had some little problems with my git, but everything is now clean.
I probably did what you was thinking If that not the case, I'm so sorry.
Idea is what is expected, but here is already a flag for painting check
RV3D_PAINTING
.This should be set in
RegionView3D.flags
. This would makeDRW_state_is_navigating
do the right thing already.
So for this task we should check if this flag will be set when performing sculpt texture painting.
BTW if you want a proper review, best to remove the 'WIP:' from the title.
WIP: #103244: fix shading in Eevee when using the canvas option in the paint brush (sculpt mode).to #103244: fix shading in Eevee when using the canvas option in the paint brush (sculpt mode).I'm sorry for this messy PR, I'll do better in the next ones.
This should be fine now.
#103244: fix shading in Eevee when using the canvas option in the paint brush (sculpt mode).to fix #103244: fix shading in Eevee when using the canvas option in the paint brush (sculpt mode).@ -253,8 +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;
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.fix #103244: fix shading in Eevee when using the canvas option in the paint brush (sculpt mode).to Fix #103244: ghosting in Eevee with sculpt paint brush and canvasThis PR still needs some changes.
Yes,
I would like to close this but as you mentionned the condition is to be placed in a safe place. I cant decide myself where it should be. If anyone can take just a quick look, it would be nice.
Checkout
From your project repository, check out a new branch and test the changes.