Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2011-06-09 20:12:10 +0400
committerTon Roosendaal <ton@blender.org>2011-06-09 20:12:10 +0400
commit10082b798625a6797ea48a6ffeb904951368297b (patch)
tree9f47f20a11174497f6ad97cad535ae331954a36d /source/blender/render
parent55c488abf055897a1d55a694f2b460e94ac17c6b (diff)
Bugfix #27081
Displacement mapping didn't do linear interpolation between pixels, causing render artefacts. Now it uses for image render without AA a default interploation filter of 1 pixel size. Fix provided by Miika Hamalainen. Thanks!
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/intern/source/imagetexture.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 7d2c7b35247..cb08ae96bf7 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -76,6 +76,8 @@
extern struct Render R;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
+static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float maxy, TexResult *texres, int imaprepeat, int imapextend);
+
/* *********** IMAGEWRAPPING ****************** */
@@ -201,7 +203,16 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, TexResult *texre
ibuf->rect+= (ibuf->x*ibuf->y);
}
- ibuf_get_color(&texres->tr, ibuf, x, y);
+ /* interpolate */
+ if (tex->imaflag & TEX_INTERPOL) {
+ float filterx, filtery;
+ filterx = (0.5f * tex->filtersize) / ibuf->x;
+ filtery = (0.5f * tex->filtersize) / ibuf->y;
+
+ boxsample(ibuf, fx-filterx, fy-filtery, fx+filterx, fy+filtery, texres, (tex->extend==TEX_REPEAT), (tex->extend==TEX_EXTEND));
+ }
+ else /* no filtering */
+ ibuf_get_color(&texres->tr, ibuf, x, y);
if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
ibuf->rect-= (ibuf->x*ibuf->y);