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>2003-12-30 21:03:37 +0300
committerTon Roosendaal <ton@blender.org>2003-12-30 21:03:37 +0300
commitd8b21b01c38bf2b7007458c221b2c1685d766cfd (patch)
treed4001fd3c914f10602ec095341307f64569a4941 /source/blender/blenkernel/intern/world.c
parent6c80064ab7e0ea1e5ec9b5a164db08497a94ccf4 (diff)
Added improved exposure calculation
- based at 1.0-exp(-color) trick in Yafray. But to guarantee backwards compatibility, and some more control, Stefano Selleri hacked a useful formula for it. - We now have 2 values to set: - "exp": the exponential correction value (0-1) - "range": the light range that maps on color 1.0 (0-5) - Using exp(x) (is e^x) we can much better prevent overflows from render, which are currently hard-clipped in Blender. Setting a small 'exp' value wil efficiently smooth out high energy and map that back to a color for display. - total formula: newcol= linfac*(1.0-exp(col*logfac)) col, newcol are colors linfac= 1.0 + 1.0/((2.0*wrld.exp +0.5)^10) logfac= log( (linfac-1.0)/linfac )/wrld.range wrld.exp and wrld.range are the button values - default setting: exp=0.0 and range=1.0 give results extremely close to previous rendering. - graph: http://www.selleri.org/Blender/buffer/Image1.png for 'exp' setting ranging from 0-1, and with 'range'=2 Thanks Stefano for the help!
Diffstat (limited to 'source/blender/blenkernel/intern/world.c')
-rw-r--r--source/blender/blenkernel/intern/world.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index b482140e373..ea4f9bd790b 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -86,11 +86,13 @@ World *add_world(char *name)
wrld->horb= 0.6f;
wrld->skytype= WO_SKYBLEND;
- wrld->exposure= 1.0f;
wrld->stardist= 15.0f;
wrld->starsize= 2.0f;
wrld->gravity= 9.8f;
-
+
+ wrld->exposure= 0.0f;
+ wrld->range= 1.0f;
+
return wrld;
}
@@ -199,6 +201,10 @@ void init_render_world()
}
else {
memset(&R.wrld, 0, sizeof(World));
- R.wrld.exposure= 1.0;
+ R.wrld.exposure= 0.0;
+ R.wrld.range= 1.0;
}
+
+ R.wrld.linfac= 1.0 + pow((2.0*R.wrld.exposure + 0.5), -10);
+ R.wrld.logfac= log( (R.wrld.linfac-1.0)/R.wrld.linfac )/R.wrld.range;
}