diff options
author | Ton Roosendaal <ton@blender.org> | 2011-06-09 20:12:10 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2011-06-09 20:12:10 +0400 |
commit | 10082b798625a6797ea48a6ffeb904951368297b (patch) | |
tree | 9f47f20a11174497f6ad97cad535ae331954a36d /source | |
parent | 55c488abf055897a1d55a694f2b460e94ac17c6b (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')
-rw-r--r-- | source/blender/render/intern/source/imagetexture.c | 13 |
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); |