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
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2007-12-28 21:58:40 +0300
committerTon Roosendaal <ton@blender.org>2007-12-28 21:58:40 +0300
commitc3ecba1d65c7e644c713646683c2be778aba93bf (patch)
tree5b8a74ccdd9b8d67ca21a7f945b49deb2eb2dec8 /source
parent1c02a5f6201ed23545a2fb7157018834502144a0 (diff)
And there's another annoyance I got poked for:
Image texture "Filter size" was not well usable for making the appearance soft filtered, this because it multiplied the sample values, and such values could be extreme small. Added next to "Filter" buton a new "Min" option, which enforces a filter size to be a minimum of 'filter' pixels in size.
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesdna/DNA_texture_types.h1
-rw-r--r--source/blender/render/intern/source/imagetexture.c9
-rw-r--r--source/blender/src/buttons_shading.c5
3 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index 14ece2b31b2..182ac6025fd 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -248,6 +248,7 @@ typedef struct TexMapping {
#define TEX_CALCALPHA 32
#define TEX_NORMALMAP 2048
#define TEX_GAUSS_MIP 4096
+#define TEX_FILTER_MIN 8192
/* imaflag unused, only for version check */
#define TEX_FIELDS_ 8
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 23b5e597070..cc0ce57bb99 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -702,6 +702,15 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *dxt, f
minx= tex->filtersize*(maxx-minx)/2.0f;
miny= tex->filtersize*(maxy-miny)/2.0f;
+ if(tex->imaflag & TEX_FILTER_MIN) {
+ /* make sure the filtersize is minimal in pixels (normal, ref map can have miniature pixel dx/dy) */
+ float addval= (0.5f * tex->filtersize) / (float) MIN2(ibuf->x, ibuf->y);
+
+ if(addval > minx)
+ minx= addval;
+ if(addval > miny)
+ miny= addval;
+ }
if(tex->filtersize!=1.0f) {
dxt[0]*= tex->filtersize;
dxt[1]*= tex->filtersize;
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index 3b597e47fa5..c82aee0155a 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -1244,9 +1244,10 @@ static void texture_panel_image_map(Tex *tex, MTex *mtex)
uiDefButBitS(block, TOG, TEX_USEALPHA, B_TEXPRV, "UseAlpha", 10, 160, 100, 20, &tex->imaflag, 0, 0, 0, 0, "Click to use Image's alpha channel");
uiDefButBitS(block, TOG, TEX_CALCALPHA, B_TEXPRV, "CalcAlpha", 110, 160, 100, 20, &tex->imaflag, 0, 0, 0, 0, "Click to calculate an alpha channel based on Image RGB values");
uiDefButBitS(block, TOG, TEX_NEGALPHA, B_TEXPRV, "NegAlpha", 210, 160, 100, 20, &tex->flag, 0, 0, 0, 0, "Click to invert the alpha values");
- uiBlockEndAlign(block);
- uiDefButF(block, NUM, B_TEXPRV, "Filter :", 10,120,150,20, &tex->filtersize, 0.1, 25.0, 10, 3, "Sets the filter size used by mipmap and interpol");
+ uiBlockBeginAlign(block);
+ uiDefButBitS(block, TOG, TEX_FILTER_MIN, B_TEXPRV, "Min", 10, 120, 30, 20, &tex->imaflag, 0, 0, 0, 0, "Use Filtersize as a minimal filter value in pixels");
+ uiDefButF(block, NUM, B_TEXPRV, "Filter: ", 40,120,120,20, &tex->filtersize, 0.1, 25.0, 10, 3, "Multiplies the filter size used by mipmap and interpol");
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, TEX_NORMALMAP, B_NOP, "Normal Map", 160,120,(mtex)? 75: 150,20, &tex->imaflag,