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>2006-02-03 23:39:36 +0300
committerTon Roosendaal <ton@blender.org>2006-02-03 23:39:36 +0300
commit6ac2c83016c4f0cd713e3170ce55f22b5e99707c (patch)
treeeee13b4ae9c0fd4205c6d29b0d3c82b6fed235a8 /source/blender/render
parent7a7c33ea2713e06c1f9581838a3b2c0e8ce1f48c (diff)
Redoing the blur filters for composit;
http://www.blender.org/bf/filters/ I found out current blur actually doesn't do gauss, but more did regular quadratic. Now you can choose common filter types, but more specifically; - set gamma on, to emphasize bright parts in blur more than darker parts - use the bokeh option for (current circlular only) blur based on true area filters (meaning, for each pixel it samples the entire surrounding). This enables more effects, but is also much slower. Have to check on optimization for this still... use with care!
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/extern/include/RE_pipeline.h4
-rw-r--r--source/blender/render/intern/source/initrender.c35
2 files changed, 37 insertions, 2 deletions
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h
index 1afce546791..07d0b0a1315 100644
--- a/source/blender/render/extern/include/RE_pipeline.h
+++ b/source/blender/render/extern/include/RE_pipeline.h
@@ -171,8 +171,8 @@ void RE_test_break_cb (struct Render *re, int (*f)(void));
void RE_test_return_cb (struct Render *re, int (*f)(void));
void RE_error_cb (struct Render *re, void (*f)(const char *str));
-
-
+/* should move to kernel once... still unsure on how/where */
+float RE_filter_value(int type, float x);
#endif /* RE_PIPELINE_H */
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index 9a36cf99e27..19d593a9409 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -153,6 +153,41 @@ static float filt_mitchell(float x) /* Mitchell & Netravali's two-param cubic */
return 0.0;
}
+/* x ranges from -1 to 1 */
+float RE_filter_value(int type, float x)
+{
+ float gaussfac= 1.6f;
+
+ x= ABS(x);
+
+ switch(type) {
+ case R_FILTER_BOX:
+ if(x>1.0) return 0.0f;
+ return 1.0;
+
+ case R_FILTER_TENT:
+ if(x>1.0) return 0.0f;
+ return 1.0f-x;
+
+ case R_FILTER_GAUSS:
+ x*= gaussfac;
+ return (1.0/exp(x*x) - 1.0/exp(gaussfac*gaussfac*2.25));
+
+ case R_FILTER_MITCH:
+ return filt_mitchell(x*gaussfac);
+
+ case R_FILTER_QUAD:
+ return filt_quadratic(x*gaussfac);
+
+ case R_FILTER_CUBIC:
+ return filt_cubic(x*gaussfac);
+
+ case R_FILTER_CATROM:
+ return filt_catrom(x*gaussfac);
+ }
+ return 0.0f;
+}
+
static float calc_weight(Render *re, float *weight, int i, int j)
{
float x, y, dist, totw= 0.0;