[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49933] trunk/blender/source/blender/ compositor: compositor - EWA filter was blurring too much by default, this caused the displace node to blur the image when no displacement was applied , making images fuzzy, the original C code has an interpolation option.
Campbell Barton
ideasman42 at gmail.com
Thu Aug 16 12:13:04 CEST 2012
Revision: 49933
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49933
Author: campbellbarton
Date: 2012-08-16 10:13:04 +0000 (Thu, 16 Aug 2012)
Log Message:
-----------
compositor - EWA filter was blurring too much by default, this caused the displace node to blur the image when no displacement was applied, making images fuzzy, the original C code has an interpolation option.
Added this option back and use for displace and UV composite nodes.
Modified Paths:
--------------
trunk/blender/source/blender/compositor/intern/COM_MemoryBuffer.cpp
trunk/blender/source/blender/compositor/intern/COM_MemoryBuffer.h
trunk/blender/source/blender/compositor/intern/COM_SocketReader.h
trunk/blender/source/blender/compositor/operations/COM_DisplaceOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_MapUVOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_ReadBufferOperation.h
Modified: trunk/blender/source/blender/compositor/intern/COM_MemoryBuffer.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_MemoryBuffer.cpp 2012-08-16 09:27:06 UTC (rev 49932)
+++ trunk/blender/source/blender/compositor/intern/COM_MemoryBuffer.cpp 2012-08-16 10:13:04 UTC (rev 49933)
@@ -259,7 +259,10 @@
return x;
}
-void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float dy)
+/**
+ * \note \a sampler at the moment is either 'COM_PS_NEAREST' or not, other values won't matter.
+ */
+void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float dy, PixelSampler sampler)
{
const int width = this->getWidth(), height = this->getHeight();
@@ -280,7 +283,7 @@
// Use a different radius based on interpolation switch, just enough to anti-alias when interpolation is off,
// and slightly larger to make result a bit smoother than bilinear interpolation when interpolation is on
// (minimum values: const float rmin = intpol ? 1.f : 0.5f;)
- const float rmin = 1.5625f / ff2;
+ const float rmin = ((sampler != COM_PS_NEAREST) ? 1.5625f : 0.765625f) / ff2;
imp2radangle(A, B, C, F, &a, &b, &th, &ecc);
if ((b2 = b * b) < rmin) {
if ((a2 = a * a) < rmin) {
Modified: trunk/blender/source/blender/compositor/intern/COM_MemoryBuffer.h
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_MemoryBuffer.h 2012-08-16 09:27:06 UTC (rev 49932)
+++ trunk/blender/source/blender/compositor/intern/COM_MemoryBuffer.h 2012-08-16 10:13:04 UTC (rev 49933)
@@ -202,7 +202,7 @@
- void readEWA(float result[4], float fx, float fy, float dx, float dy);
+ void readEWA(float result[4], float fx, float fy, float dx, float dy, PixelSampler sampler);
/**
* @brief is this MemoryBuffer a temporarily buffer (based on an area, not on a chunk)
Modified: trunk/blender/source/blender/compositor/intern/COM_SocketReader.h
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_SocketReader.h 2012-08-16 09:27:06 UTC (rev 49932)
+++ trunk/blender/source/blender/compositor/intern/COM_SocketReader.h 2012-08-16 10:13:04 UTC (rev 49933)
@@ -88,7 +88,7 @@
* @param dy
* @param inputBuffers chunks that can be read by their ReadBufferOperation.
*/
- virtual void executePixel(float output[4], float x, float y, float dx, float dy) {}
+ virtual void executePixel(float output[4], float x, float y, float dx, float dy, PixelSampler sampler) {}
public:
inline void read(float *result, float x, float y, PixelSampler sampler) {
@@ -97,8 +97,8 @@
inline void read(float *result, int x, int y, void *chunkData) {
executePixel(result, x, y, chunkData);
}
- inline void read(float *result, float x, float y, float dx, float dy) {
- executePixel(result, x, y, dx, dy);
+ inline void read(float *result, float x, float y, float dx, float dy, PixelSampler sampler) {
+ executePixel(result, x, y, dx, dy, sampler);
}
virtual void *initializeTileData(rcti *rect) { return 0; }
Modified: trunk/blender/source/blender/compositor/operations/COM_DisplaceOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_DisplaceOperation.cpp 2012-08-16 09:27:06 UTC (rev 49932)
+++ trunk/blender/source/blender/compositor/operations/COM_DisplaceOperation.cpp 2012-08-16 10:13:04 UTC (rev 49933)
@@ -95,8 +95,8 @@
dxt = signf(dxt) * maxf(fabsf(dxt), DISPLACE_EPSILON) / this->getWidth();
dyt = signf(dyt) * maxf(fabsf(dyt), DISPLACE_EPSILON) / this->getHeight();
- /* EWA filtering */
- this->m_inputColorProgram->read(output, u, v, dxt, dyt);
+ /* EWA filtering (without nearest it gets blurry with NO distortion) */
+ this->m_inputColorProgram->read(output, u, v, dxt, dyt, COM_PS_NEAREST);
}
void DisplaceOperation::deinitExecution()
Modified: trunk/blender/source/blender/compositor/operations/COM_MapUVOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_MapUVOperation.cpp 2012-08-16 09:27:06 UTC (rev 49932)
+++ trunk/blender/source/blender/compositor/operations/COM_MapUVOperation.cpp 2012-08-16 10:13:04 UTC (rev 49933)
@@ -107,7 +107,7 @@
u = inputUV[0] * this->m_inputColorProgram->getWidth();
v = inputUV[1] * this->m_inputColorProgram->getHeight();
- this->m_inputColorProgram->read(output, u, v, dx, dy);
+ this->m_inputColorProgram->read(output, u, v, dx, dy, COM_PS_NEAREST);
/* "premul" */
if (alpha < 1.0f) {
Modified: trunk/blender/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_ReadBufferOperation.cpp 2012-08-16 09:27:06 UTC (rev 49932)
+++ trunk/blender/source/blender/compositor/operations/COM_ReadBufferOperation.cpp 2012-08-16 10:13:04 UTC (rev 49933)
@@ -59,9 +59,9 @@
}
}
-void ReadBufferOperation::executePixel(float output[4], float x, float y, float dx, float dy)
+void ReadBufferOperation::executePixel(float output[4], float x, float y, float dx, float dy, PixelSampler sampler)
{
- m_buffer->readEWA(output, x, y, dx, dy);
+ m_buffer->readEWA(output, x, y, dx, dy, sampler);
}
bool ReadBufferOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
Modified: trunk/blender/source/blender/compositor/operations/COM_ReadBufferOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_ReadBufferOperation.h 2012-08-16 09:27:06 UTC (rev 49932)
+++ trunk/blender/source/blender/compositor/operations/COM_ReadBufferOperation.h 2012-08-16 10:13:04 UTC (rev 49933)
@@ -40,7 +40,7 @@
void *initializeTileData(rcti *rect);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
- void executePixel(float output[4], float x, float y, float dx, float dy);
+ void executePixel(float output[4], float x, float y, float dx, float dy, PixelSampler sampler);
const bool isReadBufferOperation() const { return true; }
void setOffset(unsigned int offset) { this->m_offset = offset; }
unsigned int getOffset() { return this->m_offset; }
More information about the Bf-blender-cvs
mailing list