diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-10-07 13:06:38 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-10-07 13:06:53 +0400 |
commit | 14c57b6c783302a86175412d6f4abf70408f19d3 (patch) | |
tree | a2203768b3407448001b094723d1164a716c95ec /source/blender/gpu/intern/gpu_material.c | |
parent | 5e809c45edf253e828813b417770889f83a95bb6 (diff) |
Fix T42074, textured lamps influncing other layers
The solution is to do the multiplication with the energy in the shader
after texture application.
We might be able to avoid setting dyncol completely, but this needs
better investigation. Some shader paths also look a bit redundant.
Also, texture mapping is not supported very well for light lamps, might
also need investigation.
Diffstat (limited to 'source/blender/gpu/intern/gpu_material.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_material.c | 16 |
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 81dcd9cf450..edb5b2ae654 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -739,8 +739,9 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la i = is; GPU_link(mat, "shade_visifac", i, visifac, shi->refl, &i); - GPU_link(mat, "set_value", GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob), &lcol); + GPU_link(mat, "set_value_v3", GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob), &lcol); shade_light_textures(mat, lamp, &lcol); + GPU_link(mat, "shade_mul_value_v3", GPU_dynamic_uniform(&lamp->dynenergy, GPU_DYNAMIC_LAMP_DYNENERGY, lamp->ob), lcol, &lcol); #if 0 if (ma->mode & MA_TANGENT_VN) @@ -1716,9 +1717,9 @@ void GPU_lamp_update_colors(GPULamp *lamp, float r, float g, float b, float ener lamp->energy = energy; if (lamp->mode & LA_NEG) lamp->energy= -lamp->energy; - lamp->col[0]= r* lamp->energy; - lamp->col[1]= g* lamp->energy; - lamp->col[2]= b* lamp->energy; + lamp->col[0]= r; + lamp->col[1]= g; + lamp->col[2]= b; } void GPU_lamp_update_distance(GPULamp *lamp, float distance, float att1, float att2) @@ -1750,9 +1751,9 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l lamp->energy = la->energy; if (lamp->mode & LA_NEG) lamp->energy= -lamp->energy; - lamp->col[0]= la->r*lamp->energy; - lamp->col[1]= la->g*lamp->energy; - lamp->col[2]= la->b*lamp->energy; + lamp->col[0]= la->r; + lamp->col[1]= la->g; + lamp->col[2]= la->b; GPU_lamp_update(lamp, ob->lay, (ob->restrictflag & OB_RESTRICT_RENDER), ob->obmat); @@ -2015,6 +2016,7 @@ GPUNodeLink *GPU_lamp_get_data(GPUMaterial *mat, GPULamp *lamp, GPUNodeLink **co *col = GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob); visifac = lamp_get_visibility(mat, lamp, lv, dist); + /* looks like it's not used? psy-fi */ shade_light_textures(mat, lamp, col); if (GPU_lamp_has_shadow_buffer(lamp)) { |