Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIRIE Shinsuke <irieshinsuke@yahoo.co.jp>2014-05-30 11:57:15 +0400
committerIRIE Shinsuke <irieshinsuke@yahoo.co.jp>2014-05-30 12:11:41 +0400
commit8008d9bdfd5730b15727d0fb16f4417a4b8a85cc (patch)
treeb636cb1dde3723f12c55de156367829de5b41d08 /source/blender/gpu/intern
parent50a7843ab1f339755a807a712280bb9e364b130e (diff)
Fix T40078: GLSL Lamp with OnlyShadow makes weird colors in object.
To prevent only shadow lamps from producing negative colors, shr->diff and shr->spec should've been clamped to positive values after lamp loop.
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_material.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 5594c085974..5ed47cda8f5 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -765,20 +765,18 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
}
if (lamp->mode & LA_ONLYSHADOW) {
- GPUNodeLink *rgb;
+ GPUNodeLink *shadrgb;
GPU_link(mat, "shade_only_shadow", i, shadfac,
- GPU_dynamic_uniform(&lamp->dynenergy, GPU_DYNAMIC_LAMP_DYNENERGY, lamp->ob), &shadfac);
-
- GPU_link(mat, "shade_mul", shi->rgb, GPU_uniform(lamp->shadow_color), &rgb);
- GPU_link(mat, "mtex_rgb_invert", rgb, &rgb);
+ GPU_dynamic_uniform(&lamp->dynenergy, GPU_DYNAMIC_LAMP_DYNENERGY, lamp->ob),
+ GPU_uniform(lamp->shadow_color), &shadrgb);
if (!(lamp->mode & LA_NO_DIFF)) {
- GPU_link(mat, "shade_only_shadow_diffuse", shadfac, rgb,
+ GPU_link(mat, "shade_only_shadow_diffuse", shadrgb, shi->rgb,
shr->diff, &shr->diff);
}
if (!(lamp->mode & LA_NO_SPEC))
- GPU_link(mat, "shade_only_shadow_specular", shadfac, shi->specrgb,
+ GPU_link(mat, "shade_only_shadow_specular", shadrgb, shi->specrgb,
shr->spec, &shr->spec);
add_user_list(&mat->lamps, lamp);
@@ -890,6 +888,10 @@ static void material_lights(GPUShadeInput *shi, GPUShadeResult *shr)
free_object_duplilist(lb);
}
}
+
+ /* prevent only shadow lamps from producing negative colors.*/
+ GPU_link(shi->gpumat, "shade_clamp_positive", shr->spec, &shr->spec);
+ GPU_link(shi->gpumat, "shade_clamp_positive", shr->diff, &shr->diff);
}
static void texture_rgb_blend(GPUMaterial *mat, GPUNodeLink *tex, GPUNodeLink *out, GPUNodeLink *fact, GPUNodeLink *facg, int blendtype, GPUNodeLink **in)