GPencil: Improve random Vertex Color to treat dark color better. #107315

Open
casey-bianco-davis wants to merge 2 commits from casey-bianco-davis/blender:temp-gpencil-random-vertex-color into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 8 additions and 1 deletions
Showing only changes of commit 2f285ab03a - Show all commits

View File

@ -2930,7 +2930,14 @@ static void gpencil_sbuffer_vertex_color_random(
}
rgb_to_hsv_v(tpt->vert_color, hsv);
add_v3_v3(hsv, factor_value);
/* Hue and Saturation can just be added; but Value should be multiplied
* because we want the ratio of the origin to modified value to not depend on the origin Value.
* Exp is used because we need a function that is positive
* and has the property that 'f(-x) = 1/f(x)' */
hsv[0] += factor_value[0];
hsv[1] += factor_value[1];
hsv[2] *= exp(factor_value[2]);
/* For Hue need to cover all range, but for Saturation and Value
* is not logic because the effect is too hard, so the value is just clamped. */
if (hsv[0] < 0.0f) {