This task will describe the engineering parts of vertex painting in sculpt mode.
The reason for this isMy first impression was that the current patch is bloating and IMO that was not necessary. After discussing this, my second thought was that the scope that I had in mind for this patch was different.
The goal of this patch is to come to a clear design/scope/phasing, so it is clear what the changes entails. This is useful for code review, bug fixing, The goal of this patch is to come to a clear design that then can be implebug triaging and future developmenteds.
The state of this design is still in progress. Only start implementing this when everyone agrees upon these changes.
= Issues =
The current patch has several issues in how the original design was translated into code. To name a few:
**Architectural Issues**Decisions**
* Current patch assumes that vertex painting will be merged into sculpt vertex painting. But in the original design it is mentioned that vertex painting will be merged into attribute painting.To be validated
* Current patch takes steps into supporting `MVertCol` to render engines* The project makes a distinction between painting for display/rendering (vertex painting) and painting for modifiers and other parts (color attribute painting). It thereby takes precedence control over the rendering of vertex painting and thereby limits current functionality am not familiar with any designs for attribute painting so it could be that the patch is making assumptions that might be changed in the near future.
* The workflow for the user for the current patch is not well communicated to the user.* The project wants to rename the current vertex painting to something else. This is might eventually be the case, but is this the right moment to do this as the future design is still unclear.
**Technical Decisions**
* To be validated
** [RENDER]: Vertex Color Node will only allow the selection for Sculpt Vertex Groups. To use the attribute vertex colors use the attribute node. Migration code could convert old files using the Vertex Color Node. Other alternative would be to support both Vertex colors in the Vertex color node, but that introduces UX complexity.
** [DRAWING]: Should we support per vertex transparency in the workbench engine? The workbench engine is optimized for animation playback speed, adding actual transparency in more detail than materials would in the right way would need more preprocessing to determine if alpha values are used in the vertex buffer.
**Process Issues**
* On top ofDuring the undecided implementation new features are still addedcode review the patch received new features on a weeklyregular basis, making the code review process totally not efficient. People are spending a lot of time in reviewing and all needs to reviewed the week after, where new features are added, where it is unclear if the issues that were addressed in the previous review are handled correctly.
It is unclear what the scope of the patch is. In the original discussion it was mentioned that after this project a attribute painting project should start. This patch somehow already tried to take this future project into account. Currently we need to reverse engineer the patch and try to understand what might be the scope of the project. where it is unclear if the issues that were addressed in the previous review are handled correctlyThis seems like lacking documentation.
The current patch scope is perhaps too limited as it can crash when you want to do for example attribute vertex painting.
**Implementation Issues**
* Color management: user is painting in display space.
* Vertex colors are actually averaged into a face color. But in the UI we say Vertex Colors. It is unclear why the colors needs to be averaged. IMO in sculpting you have dense meshes and you don't see the difference. But perhaps there are cases why this is neededReason for this is to have some visual similarity with masking. If soIMO we should describenot do this as it tells these use cases users something different.
* Cycles and EEVEE rendering in current patch are broken.
* It is currently required to have a `MVertCol` and `MLoopCol` for rendering in sculpt-mode.urrently in the patch it is not possible to do attribute vertex painting. On technical level it will just crash and the old vertex paint mode forces workbench in the vertex color mode for the specific object, what than doesn't draw the colors you want to see, but the sculpt vertex colors. It has been mentioned that there is a attribute overlay needed to fix this, I would expected that only onbut that depends again on the would be needed.rkflow of attribute painting, As `MVertCol` has more precedence this makes it impossible to do any Vertex Painting.what is not designed.
= Alternatives =
Personally I miss the information why the Sculpt Vertex Painting cannot use the `MLoopCol`. If this is possible the workflow for the user is more clear and the implementation does not have so many issues/limitations.
**Alternative 1: current sculpt patch**
This should describe the current implementation as of end of 2019. As more and more features are added it is not easy to extract an design from the current implementation. The issues described above outlines the current workings/limitations.e above gives an description of the current sculpt patch, Perhaps Pablo can put in the ideas hereafter reverse engineering and discussions.
**Alternative 2: expectation how I expected the original design to be implemented**
Current design is a goal implementation where attribute painting has been added. As we currently don't have a clear understanding how attribute painting will look like this we should not make any assumptions yet on the implementation. Therefore my expectation was a hard separation between `MVertCol` and `MLoopCol`. Both could be used during rendering and an operation to sync between the active `MVertCol` and `MLoopCol`.
Current patch has parts of it, but as the current development is limiting functionality it is unclear if this alternative is actually what is the goal for
= Roadmap =
It is unclear what the scope is of Sculpt Vertex Painting. What makes it hard to describe a roadmap at this time. Below mentioned the initial idea I had when starting on reviewing the patch.
**Long term road map**
* Get the basics correct with the next use cases in mind
** A sculptor wants to paint during sculpting.
** A modeller/lighter wants to use vertex painting as it can hold more precise data.
* Design attribute painting
* Implement attribute painting
** Will merge current vertex painting into attribute painting
**What should be done in the current patch**
This part of the design isn't finished and will change when more and more gets clear in the current design.
Focus on the bare minimum and the stuff that has been agreed upon. Don't add fancy stuff on top of it, before we settle on the basics.
As in the initial design is mentioned that sculpt vertex painting is an implementation for an edge case, so should not take control of the other implementations as it currently does.
* It must be possible use sculpt vertex colors without vertex colors and vise versa.
* Remove the face averaging. It feels like a hack where users has no control over and communicates the wrong information to users. Or we should come up with an actual user benefit. If we were able to use `MLoopCol` this isn't a problem, but as we are not storing the data here this limitation introduces some edge cases with incorrect feedback to users. The later could also be solved by user documentation, but as there isn't any design or user documentation at all...
* As `MVertCol` is for artistic drawing only, I would not expect that it has precedence over vertex painting. The user should be able to control which layer is displayed (by the name). `MLoopCol` should have more precedence then `MVertCol` as it holds more data and use cases and is also the expected format for modellers/lighters.
* Change the default name of sculpt vertex colors (Col) to something that does not clash with regular vertex colors.
* Change* Add migration code for the Attribute/Vertex Color Shader node to support both vertex colors (or any shading stuff)
* Fix existing the crashes
** Activate vertex painting mode (No vcol layer available in vertpaint, but batches requested anyway!)
* Vertex color drawing in the workbench should perhaps be mode specific. By default use Sculpt Vertex Colors, and when in attribute vertex color mode use the Vertex Colors
* If you want to support alpha rendering in the workbench we should use the transparency_accum buffers. The current implementation a hack to get it working in the viewport. This should be done in a separate patch. This should be done in a separate patchNote that doing this correctly (minor performance regressions) needs more work.
* Usability: When starting sculpting and there is no `MVertCol` layer, a default needs to be added.
* Usability: When Sculpt painting brush is active the context menu should have a color picker.
If this is the case, than we should also find better names for Sculpt Vertex Color...