From a59777c33fe2356bec9223b9f736dcc98bfa874d Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 16 Aug 2013 13:58:34 +0000 Subject: Tweaks to MapUV and PlaneTrack nodes to make results less doggy This disables crazy adaptive sampling happening in diagonal direction. This still gives some doggyness, but it's much less dramatic now, and behavior is pretty damn the same as EWA filtering when rendering textures with Blender Internal. --- source/blender/compositor/operations/COM_MapUVOperation.cpp | 5 ++++- .../compositor/operations/COM_PlaneTrackWarpImageOperation.cpp | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'source/blender/compositor') diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp index 1fa484ea2b6..1cea8e84219 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.cpp +++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp @@ -71,6 +71,7 @@ void MapUVOperation::executePixel(float output[4], float x, float y, PixelSample dy = 0.5f * (uv_u + uv_d); +#if 0 /* more adaptive sampling, red and green (UV) channels */ this->m_inputUVProgram->read(uv_a, x - 1, y - 1, COM_PS_NEAREST); this->m_inputUVProgram->read(uv_b, x - 1, y + 1, COM_PS_NEAREST); @@ -91,6 +92,7 @@ void MapUVOperation::executePixel(float output[4], float x, float y, PixelSample dx += 0.25f * (uv_l + uv_r); dy += 0.25f * (uv_u + uv_d); +#endif /* UV to alpha threshold */ const float threshold = this->m_alpha * 0.05f; @@ -98,10 +100,11 @@ void MapUVOperation::executePixel(float output[4], float x, float y, PixelSample if (alpha < 0.f) alpha = 0.f; else alpha *= inputUV[2]; +#if 0 /* should use mipmap */ dx = min(dx, 0.2f); dy = min(dy, 0.2f); - +#endif /* EWA filtering */ u = inputUV[0] * this->m_inputColorProgram->getWidth(); diff --git a/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp b/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp index 9bbf45682f2..8e30a99b2a0 100644 --- a/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp +++ b/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp @@ -93,6 +93,7 @@ BLI_INLINE void resolveUVAndDxDy(const float x, const float y, const float corne dy = 0.5f * (uv_u + uv_d); +#if 0 /* more adaptive sampling, red and green (UV) channels */ ok1 = resolveUV(x - 1, y - 1, corners, uv_a); ok2 = resolveUV(x - 1, y + 1, corners, uv_b); @@ -117,6 +118,10 @@ BLI_INLINE void resolveUVAndDxDy(const float x, const float y, const float corne /* should use mipmap */ *dx_r = min(dx, 0.2f); *dy_r = min(dy, 0.2f); +#else + *dx_r = dx; + *dy_r = dy; +#endif *u_r = inputUV[0]; *v_r = inputUV[1]; @@ -163,7 +168,7 @@ void PlaneTrackWarpImageOperation::executePixel(float output[4], float x, float u *= this->m_pixelReader->getWidth(); v *= this->m_pixelReader->getHeight(); - this->m_pixelReader->read(current_color, u, v, dx, dy, COM_PS_BICUBIC); + this->m_pixelReader->read(current_color, u, v, dx, dy, COM_PS_NEAREST); premul_to_straight_v4(current_color); add_v4_v4(color_accum, current_color); } -- cgit v1.2.3