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.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user