Maniphest T98593

Paint Mode: Backface Occlusion
Closed, ResolvedDESIGN

Assigned To
Joseph Eagar (joeedh)
Authored By
Julien Kaspar (JulienKaspar)
Jun 4 2022, 5:37 PM
Tags
  • Sculpt, Paint & Texture
Subscribers
Daniel Bystedt (dbystedt)
Gareth Jensen (garethjensen)
Jeroen Bakker (jbakker)
Joseph Eagar (joeedh)
Julien Kaspar (JulienKaspar)
Ramil Roosileht (Limarest)
Tokens
"Pterodactyl" token, awarded by Gavriel5578.

Description

NOTE: This design still needs to be discussed and completed.

Issues

The current implementation of occlusion painting has certain issues:

Falloff capped at 90 degrees

Right now the normal falloff while texture painting is not going beyond 90 degrees and eventually caps at a harsh transition.
A better behaviour would be to have the falloff go past 90 degrees, instead of only inwards to any surface below 90 degrees.

Performance

For performance reasons the occlusion setting is often turned off or a simple "Front Face Only" option is used instead.
The goal should be to make full occlusion auto-masking perform well on high resolution meshes and textures.

Not available with Spherical Falloff

Currently there is only a projection based falloff available for texture painting.
With the new 3D paint brush based on sculpt mode we have the opportunity for a much more intuitive painting behaviour.
The combination of a spherical brush falloff and occlusion auto-masking would be the more intuitive default for occlusion painting.

Goal

The primary goal is to implement a brush that is ideal for projection painting.
For this it is vital to have fast performing and intuitive backface occlusion settings, similar to the ones in the current texture paint mode.

Design

Automasking

The best way to implement this as both a per brush setting and a global toggle is by using auto-masks.
This way we can support these auto-masking modes for both sculpt & paint mode:

  1. Mask via View Normals
    • Additional toggle for Occlusion
  2. Mask via Area Normals

The second one would be more beneficial for sculpting tools but both would work very similar.
Auto-masks would also support any tool in these modes. Not just brushes.

Falloff & Occlusion

To provide a better feel while painting, we need to provide a full 180 degrees for the normal falloff slider.
Even when masking by view normals and occlusion, it's important to have a smooth falloff that goes a bit beyond 90 degrees to avoid harsh transitions while painting.

Remove Front-Faces Only

With the new auto-masking settings being way more accessible that the old "Front Faces Only" toggle, it should be the only setting necessary for brushes.

Open questions:

  • What about modes that don't support auto-masking yet? Weight Paint mode could keep the current front faces only toggle or we could add auto-masking support. Making this accessible via shortcuts could be the main issue.

Revisions and Commits

rB Blender
D15297

Event Timeline

Julien Kaspar (JulienKaspar) created this task.Jun 4 2022, 5:37 PM
Julien Kaspar (JulienKaspar) moved this task from Backlog to To Do on the Sculpt, Paint & Texture board.
Joseph Eagar (joeedh) added a comment.Jun 4 2022, 10:46 PM

Sculpt-dev has an automasking mode for this. IIRC it's pretty simple code, I can port it over.

Joseph Eagar (joeedh) added a comment.Jun 4 2022, 10:48 PM

I think making this an automasking mode makes the most sense from a code point of view, however we don't have to present it as such in the UI.

Julien Kaspar (JulienKaspar) mentioned this in T96225: PBVH image texture painting implementation.Jun 5 2022, 12:49 PM
Ramil Roosileht (Limarest) added a comment.Jun 6 2022, 10:27 PM

I agree that making it an automasking mode is better than having the old "use front faces" checkbox lost somewhere in the UI

Julien Kaspar (JulienKaspar) added a comment.Jun 9 2022, 10:41 AM

From the recent module meeting:

We agreed that this makes sense as a mode-wide auto-mask option.
Joe already implemented this in sculpt-dev. It just requires a scene wide setting for the occlusion falloff.
Both area and view normal occlusion are good to implement since they benefit very different brushes.
View normal occlusion is more useful for projection painting while area normal will be more used for sculpting brushes.

This new feature could completely replace “Front Faces Only”. Occlusion auto-masking is way faster to toggle and potentially doesn’t have performance downsides compared to Front-Faces Only.

Julien Kaspar (JulienKaspar) moved this task from To Do to In Progress on the Sculpt, Paint & Texture board.Jun 27 2022, 10:09 AM
Julien Kaspar (JulienKaspar) added a revision: D15297: Normal Based Automasking Modes.
Julien Kaspar (JulienKaspar) updated the task description.Jun 27 2022, 11:12 AM
Julien Kaspar (JulienKaspar) assigned this task to Joseph Eagar (joeedh).Jun 28 2022, 9:52 AM
Julien Kaspar (JulienKaspar) added a comment.Jul 28 2022, 11:43 AM

From recent meeting notes:

  • Joe added occlusion support
  • Julien shared feedback
    • Replace Occlusion with Area Normal auto-masking in pie menu
    • Make Occlusion a sub-setting of view normal auto-masking
    • Implement a way to use limit and falloff settings for occlusion?
  • Joe also suggested that we can add blur propagation steps like in cavity auto-masking
    • This might already give the minimal required results
    • We might want to add that in general since regular view/normal auto-masking can also lead to hard edges
  • Could also use cotangent weights for vertex painting to calculate limit and falloff
  • Texture painting needs its own solution
    • We'll talk with Brecht and Jeroen if they have suggestions
Julien Kaspar (JulienKaspar) updated the task description.Jul 29 2022, 10:10 AM
Julien Kaspar (JulienKaspar) triaged this task as High priority.Sep 21 2022, 12:55 PM
Julien Kaspar (JulienKaspar) moved this task from In Progress to In Review on the Sculpt, Paint & Texture board.Sep 26 2022, 10:43 AM
Joseph Eagar (joeedh) added a commit: rBbbc69563d070: Sculpt: Normal-based automasking modes.Sep 29 2022, 8:22 AM
Gavriel Lavi (Gavriel5578) awarded a token.Sep 29 2022, 1:23 PM
Julien Kaspar (JulienKaspar) closed this task as Resolved.Sep 29 2022, 2:18 PM