diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-05-29 18:50:32 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-05-29 18:50:51 +0300 |
commit | 929c78e33c06f55af4a3d98240959c4afcf9f39c (patch) | |
tree | 7fa3aa1d68799a92e2e6afe42f6f52ce643ab70c /source | |
parent | 08b8fa086396ef581e23c14b78504c96a7a1d005 (diff) |
EEVEE: LookDev blurred background
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/studiolight.c | 14 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/default_world_frag.glsl | 6 |
2 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c index 56765f06a59..2cdffb88212 100644 --- a/source/blender/blenkernel/intern/studiolight.c +++ b/source/blender/blenkernel/intern/studiolight.c @@ -178,6 +178,11 @@ static void studiolight_create_equierectangular_radiance_gputexture(StudioLight BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IMAGE_LOADED); ImBuf *ibuf = sl->equirectangular_radiance_buffer; sl->equirectangular_radiance_gputexture = GPU_texture_create_2D(ibuf->x, ibuf->y, GPU_RGBA16F, ibuf->rect_float, error); + GPUTexture *tex = sl->equirectangular_radiance_gputexture; + GPU_texture_bind(tex, 0); + GPU_texture_filter_mode(tex, true); + GPU_texture_wrap_mode(tex, true); + GPU_texture_unbind(tex); } sl->flag |= STUDIOLIGHT_EQUIRECTANGULAR_RADIANCE_GPUTEXTURE; } @@ -189,6 +194,11 @@ static void studiolight_create_equierectangular_irradiance_gputexture(StudioLigh BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IRRADIANCE_IMAGE_CALCULATED); ImBuf *ibuf = sl->equirectangular_irradiance_buffer; sl->equirectangular_irradiance_gputexture = GPU_texture_create_2D(ibuf->x, ibuf->y, GPU_RGBA16F, ibuf->rect_float, error); + GPUTexture *tex = sl->equirectangular_irradiance_gputexture; + GPU_texture_bind(tex, 0); + GPU_texture_filter_mode(tex, true); + GPU_texture_wrap_mode(tex, true); + GPU_texture_unbind(tex); } sl->flag |= STUDIOLIGHT_EQUIRECTANGULAR_IRRADIANCE_GPUTEXTURE; } @@ -404,6 +414,10 @@ static void studiolight_calculate_irradiance_equirectangular_image(StudioLight * } sl->equirectangular_irradiance_buffer = IMB_allocFromBuffer(NULL, colbuf, STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH, STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT); MEM_freeN(colbuf); +#if 0 + IMB_saveiff(sl->equirectangular_irradiance_buffer, "/tmp/studiolight_specular_irradiance.png", IB_rectfloat); +#endif + } sl->flag |= STUDIOLIGHT_EQUIRECTANGULAR_IRRADIANCE_IMAGE_CALCULATED; } diff --git a/source/blender/draw/engines/eevee/shaders/default_world_frag.glsl b/source/blender/draw/engines/eevee/shaders/default_world_frag.glsl index d2a654cecda..1f0ef76da0c 100644 --- a/source/blender/draw/engines/eevee/shaders/default_world_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/default_world_frag.glsl @@ -1,3 +1,4 @@ + #define M_PI 3.14159265358979323846 uniform float backgroundAlpha; @@ -35,8 +36,9 @@ void node_tex_environment_equirectangular(vec3 co, sampler2D ima, out vec4 color float v = atan(nco.z, hypot(nco.x, nco.y)) / M_PI + 0.5; /* Fix pole bleeding */ - float half_width = 0.5 / float(textureSize(ima, 0).x); - v = clamp(v, half_width, 1.0 - half_width); + float width = float(textureSize(ima, 0).x); + float texel_width = 1.0 / width; + v = clamp(v, texel_width, 1.0 - texel_width); /* Fix u = 0 seam */ /* This is caused by texture filtering, since uv don't have smooth derivatives |