From 385e5eb92edab8d8a50941c457dee971185c7af3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 9 May 2012 10:48:24 +0000 Subject: code cleanup: color/bw conversion - use BLI color function. change modifier to use the average of the RGB since perceptual conversion isn't really needed for modifiers. --- source/blender/modifiers/intern/MOD_util.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 2d8656e127b..aff6bf548e6 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -77,14 +77,15 @@ void get_texture_value(Tex *texture, float *tex_co, TexResult *texres) result_type = multitex_ext_safe(texture, tex_co, texres); /* if the texture gave an RGB value, we assume it didn't give a valid - * intensity, so calculate one (formula from do_material_tex). + * intensity, since this is in the context of modifiers don't use perceptual color conversion. * if the texture didn't give an RGB value, copy the intensity across */ - if (result_type & TEX_RGB) - texres->tin = (0.35f * texres->tr + 0.45f * texres->tg - + 0.2f * texres->tb); - else - texres->tr = texres->tg = texres->tb = texres->tin; + if (result_type & TEX_RGB) { + texres->tin= (1.0f / 3.0f) * (texres->tr + texres->tg + texres->tb); + } + else { + copy_v3_fl(&texres->tr, texres->tin); + } } void get_texture_coords(MappingInfoModifierData *dmd, Object *ob, -- cgit v1.2.3