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:
Diffstat (limited to 'source/blender/gpu/intern/gpu_material.c')
-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)