Page MenuHome

Fix T72524: Weight Painting not correctly affecting the projected vertices
Needs RevisionPublic

Authored by Germano Cavalcante (mano-wii) on Dec 29 2019, 2:58 PM.



In both sculpt and weight paint, when the falloff is set to project, the brush's effect area is shaped like a cylinder rather than a cone as expected in perspective projection.

This can confuse the user who cannot understand why some of the vertices are not affected even though they were within the area indicated by the circle cursor.

The solution proposed in this patch is to calculate a cone-shaped range if the view is in perspective.

Note: I still haven't checked if it's also necessary to adjust the function that tests bvh nodes.

Ref T72524

Diff Detail

rB Blender
Build Status
Buildable 6122
Build 6122: arc lint + arc unit

Event Timeline

Jeroen Bakker (jbakker) requested changes to this revision.Mon, Dec 30, 9:20 AM

I added Pablo as reviewer as he is more familiar with the user side.


I know that the sculpt.c does not do this (yet) but we should use false and true for better readability.


It seems that the current code base isn't consistent if test->dist contains a squared or actual distance. It also seems that test->dist isn't used anywhere.

@Pablo Dobarro (pablodp606) is it an option to remove the test->dist from our codebase?


seems like this variable holds transformation part of the view_inv so view_inv_translation_orig is more exact.


Same for these parameters

This revision now requires changes to proceed.Mon, Dec 30, 9:20 AM
Germano Cavalcante (mano-wii) marked an inline comment as done.Mon, Dec 30, 5:00 PM
Germano Cavalcante (mano-wii) added inline comments.

test->dist is used here to calculate brush_fade: paint_vertex.c$1805-1806


I will change. But the translation component of inverse viewmatrix is just one way to get this value.
This same value can also be obtained by for example multiplying the perspective matrix by (0.0f, 0.0f, -1.0f).
It indicates the position of the observer.
In some fragment shaders it is called "cameraPos".