Page MenuHome

Workbench: Support Active Vertex Color

Authored by Jeroen Bakker (jbakker) on Apr 16 2019, 4:51 PM.
"Like" token, awarded by fclem."Love" token, awarded by ThinkingPolygons."Like" token, awarded by TheRedWaxPolice."Like" token, awarded by xrg."Love" token, awarded by elbox01."Like" token, awarded by YAFU."Like" token, awarded by brecht.



Currently it is not possible to view the vertex colors of an object. To
optimize the workflow, workbench will need to support Vertex Colors.

The Vertex Colors is a new option in shading->color_type. When objects
do not have vertex color, the objects will be rendered with the

In order to support vertex colors in workbench the current texture/solid
shading structure is migrated to a primary shaders and fallback shaders.

Fix: T57000

Diff Detail

rB Blender

Event Timeline

675 ↗(On Diff #14761)

Update text: "Use separator to expand to next row"

Rebased with master (clang-format)

Rebased with latest master.
Still todo: sculpting drawing

Jeroen Bakker (jbakker) planned changes to this revision.Apr 18 2019, 2:00 PM

Support Sculpting drawing

Test commit: sculpt drawing

Jeroen Bakker (jbakker) retitled this revision from Workbench: Support Active Vertex Color to Workbench: Support Active Vertex Color (WIP).

Support for sculpt drawing

Harbormaster completed remote builds in B3378: Diff 14819.

Code style + cleanup

Harbormaster completed remote builds in B3379: Diff 14820.
Jeroen Bakker (jbakker) retitled this revision from Workbench: Support Active Vertex Color (WIP) to Workbench: Support Active Vertex Color.Apr 19 2019, 10:08 AM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
Clément Foucault (fclem) requested changes to this revision.Apr 19 2019, 1:40 PM

A few comment but overall it looks great. I have not much to say. :)


I find the name is_primary_shader really confusing. Took me a really long time to understand what it meant. I think is_const_color or is_uniform_color is better and revert its value back to what it was (when it was use_textures).


I'm not really happy with that but we have the same issue with the "msk" attrib. It's always allocated even if not used.

I have no real solution for this at the moment. So maybe add a TODO about this as comment.


I think we should only do that if the vcol is also being displayed. (i.e. have a bool show_vcol)

This revision now requires changes to proceed.Apr 19 2019, 1:40 PM

In terms of design and behavior this looks good.

Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)

Optional generating vcol vertex data

Jeroen Bakker (jbakker) planned changes to this revision.Tue, Apr 23, 9:43 AM

change to is_uniform_color.
Test why vertex colors are not showing when opening older sculpt blend files

Fixed issue when a workbench material is used multiple times,
but not all objects have a vertex color. They shared the same
hash, but that would draw the objects using the incorrect

@Clément Foucault (fclem) I couldn't find a 100% good solution for the show_vcol parameter.
For now I propose to check in the draw manager if it is active and if so it will pass the show_vcol via a parameter. I didn't like to add show_vcol to the PBVH as that would need the draw manager modify that setting. I also didn't like adding this to the depsgraph evaluation as it scatters drawing code to the depsgraph. Do you have an idea to make it more clean?

Also I don't like that the Draw Manager knows about the specifics of the workbench. We could hide it by implementing a new callback of a draw_engine, to get specific draw control data.
Please advice.

Jeroen Bakker (jbakker) marked 3 inline comments as done.

Added TODO comment

This revision is now accepted and ready to land.Tue, Apr 23, 11:47 AM

Code style: Formatting

This revision was automatically updated to reflect the committed changes.