diff options
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 7 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 8 |
2 files changed, 8 insertions, 7 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 65cfcd1f8db..c14b9565c1b 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -11105,14 +11105,13 @@ static int sculpt_face_sets_randomize_colors_invoke(bContext *C, int totnode; Mesh *mesh = ob->data; - int new_seed = BLI_hash_int(PIL_check_seconds_timer_i() & UINT_MAX); - mesh->face_sets_color_seed = new_seed; + mesh->face_sets_color_seed += 1; if (ss->face_sets) { const int random_index = clamp_i( - ss->totpoly * BLI_hash_int_01(new_seed), 0, max_ii(0, ss->totpoly - 1)); + ss->totpoly * BLI_hash_int_01(mesh->face_sets_color_seed), 0, max_ii(0, ss->totpoly - 1)); mesh->face_sets_color_default = ss->face_sets[random_index]; } - BKE_pbvh_face_sets_color_set(pbvh, new_seed, mesh->face_sets_color_default); + BKE_pbvh_face_sets_color_set(pbvh, mesh->face_sets_color_seed, mesh->face_sets_color_default); BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode); for (int i = 0; i < totnode; i++) { diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 5eae86e50f0..33f61b5f5f4 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -189,15 +189,17 @@ static void gpu_pbvh_batch_init(GPU_PBVH_Buffers *buffers, GPUPrimType prim) * \{ */ /* Returns the Face Set random color for rendering in the overlay given its ID and a color seed. */ +#define GOLDEN_RATIO_CONJUGATE 0.618033988749895f static void face_set_overlay_color_get(const int face_set, const int seed, uchar *r_color) { float rgba[4]; - const float random_mod_hue = BLI_hash_int_01(abs(face_set) + seed); + float random_mod_hue = GOLDEN_RATIO_CONJUGATE * (abs(face_set) + (seed % 10)); + random_mod_hue = random_mod_hue - floorf(random_mod_hue); const float random_mod_sat = BLI_hash_int_01(abs(face_set) + seed + 1); const float random_mod_val = BLI_hash_int_01(abs(face_set) + seed + 2); hsv_to_rgb(random_mod_hue, - 0.45f + (random_mod_sat * 0.35f), - 1.0f - (random_mod_val * 0.45f), + 0.6f + (random_mod_sat * 0.25f), + 1.0f - (random_mod_val * 0.35f), &rgba[0], &rgba[1], &rgba[2]); |