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:
authorMatt Ebb <matt@mke3.net>2010-05-26 12:06:51 +0400
committerMatt Ebb <matt@mke3.net>2010-05-26 12:06:51 +0400
commit440917cb0b2fe7f736d5911eb40318a0bfc8f0d4 (patch)
tree6bc197fa279d85ce6f936a02db54c9a39cae4489 /source/blender/render
parent244cda6f1ae3a0311c118953197704f1391eb702 (diff)
Fix [#22418] Displace Node also makes entire image fuzzy
Changed displace node sampling to use EWA filtering, and removed old hacks for calculating derivatives - I think it should be generated correctly now.
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/intern/source/imagetexture.c110
1 files changed, 60 insertions, 50 deletions
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 21077c289c3..8d1caf2b8b9 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -586,49 +586,19 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max
}
}
-void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *result)
-{
- TexResult texres;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
-
- if(ibuf==NULL) {
- result[0]= result[1]= result[2]= result[3]= 0.0f;
- return;
- }
-
- if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
- ibuf->rect+= (ibuf->x*ibuf->y);
-
- boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1, 0);
- result[0]= texres.tr;
- result[1]= texres.tg;
- result[2]= texres.tb;
- result[3]= texres.ta;
-
- if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
- ibuf->rect-= (ibuf->x*ibuf->y);
-}
-
-void ibuf_sample(ImBuf *ibuf, float fx, float fy, float dx, float dy, float *result)
-{
- TexResult texres;
-
- if(ibuf==NULL) {
- return;
- }
-
- memset(&texres, 0, sizeof(texres));
- boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1, 0);
- result[0]= texres.tr;
- result[1]= texres.tg;
- result[2]= texres.tb;
- result[3]= texres.ta;
-}
-
-
//-----------------------------------------------------------------------------------------------------------------
// from here, some functions only used for the new filtering
+// anisotropic filters, data struct used instead of long line of (possibly unused) func args
+typedef struct afdata_t {
+ float dxt[2], dyt[2];
+ int intpol, extflag;
+ // feline only
+ float majrad, minrad, theta;
+ int iProbes;
+ float dusc, dvsc;
+} afdata_t;
+
// this only used here to make it easier to pass extend flags as single int
enum {TXC_XMIR=1, TXC_YMIR, TXC_REPT, TXC_EXTD};
@@ -713,16 +683,6 @@ static int ibuf_get_color_clip_bilerp(float *col, ImBuf *ibuf, float u, float v,
return ibuf_get_color_clip(col, ibuf, (int)u, (int)v, extflag);
}
-// anisotropic filters, data struct used instead of long line of (possibly unused) func args
-typedef struct afdata_t {
- float dxt[2], dyt[2];
- int intpol, extflag;
- // feline only
- float majrad, minrad, theta;
- int iProbes;
- float dusc, dvsc;
-} afdata_t;
-
static void area_sample(TexResult* texr, ImBuf* ibuf, float fx, float fy, afdata_t* AFD)
{
int xs, ys, clip = 0;
@@ -1775,3 +1735,53 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
return retval;
}
+
+void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *result)
+{
+ TexResult texres;
+ ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+
+ if(ibuf==NULL) {
+ result[0]= result[1]= result[2]= result[3]= 0.0f;
+ return;
+ }
+
+ if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
+ ibuf->rect+= (ibuf->x*ibuf->y);
+
+ boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1, 0);
+ result[0]= texres.tr;
+ result[1]= texres.tg;
+ result[2]= texres.tb;
+ result[3]= texres.ta;
+
+ if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
+ ibuf->rect-= (ibuf->x*ibuf->y);
+}
+
+void ibuf_sample(ImBuf *ibuf, float fx, float fy, float dx, float dy, float *result)
+{
+ TexResult texres;
+ afdata_t AFD;
+
+ if(ibuf==NULL) {
+ return;
+ }
+
+ AFD.dxt[0] = dx; AFD.dxt[1] = dx;
+ AFD.dyt[0] = dy; AFD.dyt[1] = dy;
+ //copy_v2_v2(AFD.dxt, dx);
+ //copy_v2_v2(AFD.dyt, dy);
+
+ AFD.intpol = 1;
+ AFD.extflag = TXC_EXTD;
+
+ memset(&texres, 0, sizeof(texres));
+ ewa_eval(&texres, ibuf, fx, fy, &AFD);
+
+
+ result[0]= texres.tr;
+ result[1]= texres.tg;
+ result[2]= texres.tb;
+ result[3]= texres.ta;
+} \ No newline at end of file