Sculpt: fix T103156: Scale square brush uvs by sqrt2.

Scale texture coordiantes for square brushes by sqrt2,
proportionally to how square they are (how close
tip_roundness is to zero).

Note: this is done in `calc_brush_local_mat()`, the
result of which appears to be used exclusively for
texture mapping.
This commit is contained in:
Joseph Eagar 2022-12-26 21:03:26 -08:00
parent 997eb77fd4
commit 204de8c6db
Notes: blender-bot 2023-02-14 08:29:54 +01:00
Referenced by issue #103156, Regression: Clay Strips Brush plus an alpha texture produces artefacts.
1 changed files with 8 additions and 1 deletions

View File

@ -2908,8 +2908,15 @@ static void calc_brush_local_mat(const MTex *mtex, Object *ob, float local_mat[4
copy_v3_v3(mat[3], cache->location);
/* Scale by brush radius. */
float radius = cache->radius;
/* Square tips should scale by square root of 2. */
if (sculpt_tool_has_cube_tip(cache->brush->sculpt_tool)) {
radius += (radius * M_SQRT2 - radius) * (1.0f - cache->brush->tip_roundness);
}
normalize_m4(mat);
scale_m4_fl(scale, cache->radius);
scale_m4_fl(scale, radius);
mul_m4_m4m4(tmat, mat, scale);
/* Return inverse (for converting from model-space coords to local area coords). */