Index: source/blender/render/intern/source/shadeoutput.c =================================================================== --- source/blender/render/intern/source/shadeoutput.c (revision 15025) +++ source/blender/render/intern/source/shadeoutput.c (working copy) @@ -1179,7 +1179,7 @@ { Material *ma= shi->mat; VlakRen *vlr= shi->vlr; - float lv[3], lampdist, lacol[3], shadfac[4]; + float lv[3], lampdist, lacol[3], shadfac[4], lashdw[3]; float i, is, i_noshad, inp, *vn, *view, vnor[3], phongcorr=1.0f; float visifac; @@ -1219,7 +1219,14 @@ lacol[1]= lar->g; lacol[2]= lar->b; - if(lar->mode & LA_TEXTURE) do_lamp_tex(lar, lv, shi, lacol); + lashdw[0]= lar->shdwr; + lashdw[1]= lar->shdwg; + lashdw[2]= lar->shdwb; + + if(lar->mode & LA_TEXTURE) { + do_lamp_tex(lar, lv, shi, lacol); + if(lar->mode & LA_SHAD_TEX) do_lamp_tex(lar, lv, shi, lashdw); + } /* tangent case; calculate fake face normal, aligned with lampvector */ /* note, vnor==vn is used as tangent trigger for buffer shadow */ @@ -1342,13 +1349,13 @@ if((lar->mode & LA_ONLYSHADOW) && i>0.0) { shadfac[3]= i*lar->energy*(1.0f-shadfac[3]); - shr->shad[0] -= shadfac[3]*shi->r; - shr->shad[1] -= shadfac[3]*shi->g; - shr->shad[2] -= shadfac[3]*shi->b; + shr->shad[0] -= shadfac[3]*shi->r*(1.0f-lashdw[0]); + shr->shad[1] -= shadfac[3]*shi->g*(1.0f-lashdw[1]); + shr->shad[2] -= shadfac[3]*shi->b*(1.0f-lashdw[2]); - shr->spec[0] -= shadfac[3]*shi->specr; - shr->spec[1] -= shadfac[3]*shi->specg; - shr->spec[2] -= shadfac[3]*shi->specb; + shr->spec[0] -= shadfac[3]*shi->specr*(1.0f-lashdw[0]); + shr->spec[1] -= shadfac[3]*shi->specg*(1.0f-lashdw[1]); + shr->spec[2] -= shadfac[3]*shi->specb*(1.0f-lashdw[2]); return; } @@ -1366,6 +1373,10 @@ else add_to_diffuse(shr->shad, shi, is, i*lacol[0], i*lacol[1], i*lacol[2]); } + /* add light for colored shadow */ + if (i_noshad>i && !(lashdw[0]==0 && lashdw[1]==0 && lashdw[2]==0)) { + add_to_diffuse(shr->shad, shi, is, lashdw[0]*(i_noshad-i)*lacol[0], lashdw[1]*(i_noshad-i)*lacol[1], lashdw[2]*(i_noshad-i)*lacol[2]); + } if(i_noshad>0.0f) { if(passflag & (SCE_PASS_DIFFUSE|SCE_PASS_SHADOW)) { if(ma->mode & MA_SHADOW_TRA) Index: source/blender/render/intern/source/convertblender.c =================================================================== --- source/blender/render/intern/source/convertblender.c (revision 15025) +++ source/blender/render/intern/source/convertblender.c (working copy) @@ -3553,6 +3553,9 @@ lar->r= lar->energy*la->r; lar->g= lar->energy*la->g; lar->b= lar->energy*la->b; + lar->shdwr= la->shdwr; + lar->shdwg= la->shdwg; + lar->shdwb= la->shdwb; lar->k= la->k; // area Index: source/blender/render/intern/include/render_types.h =================================================================== --- source/blender/render/intern/include/render_types.h (revision 15025) +++ source/blender/render/intern/include/render_types.h (working copy) @@ -417,6 +417,7 @@ float co[3]; short type, mode; float r, g, b, k; + float shdwr, shdwg, shdwb; float energy, haint; int lay; float spotsi,spotbl; Index: source/blender/makesdna/DNA_lamp_types.h =================================================================== --- source/blender/makesdna/DNA_lamp_types.h (revision 15025) +++ source/blender/makesdna/DNA_lamp_types.h (working copy) @@ -49,6 +49,7 @@ short colormodel, totex; float r, g, b, k; + float shdwr, shdwg, shdwb, shdwpad; float energy, dist, spotsize, spotblend; float haint; @@ -122,10 +123,11 @@ /* yafray: lamp shadowbuffer flag, softlight */ /* Since it is used with LOCAL lamp, can't use LA_SHAD */ #define LA_YF_SOFT 16384 +#define LA_SHAD_TEX 32768 /* let texture affect shadow color */ /* falloff_type */ #define LA_FALLOFF_CONSTANT 0 -#define LA_FALLOFF_INVLINEAR 1 +#define LA_FALLOFF_INVLINEAR 1 #define LA_FALLOFF_INVSQUARE 2 #define LA_FALLOFF_CURVE 3 #define LA_FALLOFF_SLIDERS 4 Index: source/blender/src/buttons_shading.c =================================================================== --- source/blender/src/buttons_shading.c (revision 15025) +++ source/blender/src/buttons_shading.c (working copy) @@ -2620,6 +2620,13 @@ uiDefButBitS(block, TOG, LA_ONLYSHADOW, B_LAMPPRV,"OnlyShadow", 10,110,80,19,&la->mode, 0, 0, 0, 0, "Causes light to cast shadows only without illuminating objects"); + if(ELEM4(la->type, LA_AREA, LA_SPOT, LA_SUN, LA_LOCAL) && ((la->mode & LA_SHAD_RAY)||(la->mode & LA_SHAD_BUF))) { + uiBlockBeginAlign(block); + uiDefButF(block, COL, 0, "Shadow ", 10,90,39,19,&la->shdwr, 0, 0, 0, B_COLLAMP, "Sets the shadow color; default is black (RGB 0,0,0)"); + uiDefButBitS(block, TOG, LA_SHAD_TEX, 0,"Tex", 50,90,40,19,&la->mode, 0, 0, 0, 0, "Causes lamp textures to affect shadow color"); + uiBlockEndAlign(block); + } + if(la->type==LA_SPOT) { uiBlockBeginAlign(block); uiDefButBitS(block, TOG, LA_SQUARE, B_LAMPREDRAW,"Square", 10,60,80,19,&la->mode, 0, 0, 0, 0, "Sets square spotbundles");