Fix T44984: wrong texture clamping when applying saturation > 1.0
Applying saturation > 1.0 in HSV space easily leads to negative values in RGB space, so we have to clamp again...
This commit is contained in:
parent
b79a33e2d4
commit
9927849708
Notes:
blender-bot
2023-02-21 17:59:30 +01:00
Referenced by issue #44984, Clamping in 'texture context -> colors panel' doesn't work under some extreme circumstances.
|
@ -56,6 +56,11 @@
|
|||
_hsv[1] *= tex->saturation; \
|
||||
hsv_to_rgb(_hsv[0], _hsv[1], _hsv[2], \
|
||||
&texres->tr, &texres->tg, &texres->tb); \
|
||||
if ((tex->saturation > 1.0f) && !(tex->flag & TEX_NO_CLAMP)) { \
|
||||
if (texres->tr < 0.0f) texres->tr= 0.0f; \
|
||||
if (texres->tg < 0.0f) texres->tg= 0.0f; \
|
||||
if (texres->tb < 0.0f) texres->tb= 0.0f; \
|
||||
} \
|
||||
} \
|
||||
|
||||
struct HaloRen;
|
||||
|
|
|
@ -2431,7 +2431,7 @@ void do_material_tex(ShadeInput *shi, Render *re)
|
|||
|
||||
BKE_image_pool_release_ibuf(ima, ibuf, re->pool);
|
||||
}
|
||||
|
||||
|
||||
if (mtex->mapto & MAP_COL) {
|
||||
float colfac= mtex->colfac*stencilTin;
|
||||
texture_rgb_blend(&shi->r, tcol, &shi->r, texres.tin, colfac, mtex->blendtype);
|
||||
|
|
Loading…
Reference in New Issue